Read the statement by Michael Teeuw here.
MMM-MQTTbridge doesn't seem to report USER_PRESENCE correctly?
-
I can see that MMM-Remote-Control set’s the USER_PRESENCE depending on the state of the monitor.
I try to interpret that to update the status of the switch in HomeAssistant by having it set up in the notiDictionaryThe config looks like this:
var notiHook = [ { notiId: "USER_PRESENCE", notiPayload: [ { payloadValue: true, notiMqttCmd: ["SCREENON"] }, { payloadValue: false, notiMqttCmd: ["SCREENOFF"] }, ], }, ]; var notiMqttCommands = [ { commandId: "SCREENOFF", mqttTopic: "bathroom/mirror/monitor", mqttMsgPayload: "{'state':'OFF'}" }, { commandId: "SCREENON", mqttTopic: "bathroom/mirror/monitor", mqttMsgPayload: "{'state':'ON'}" }, ]; module.exports = { notiHook, notiMqttCommands };
The logs looks like this:
0|mm | [2020-10-16 09:44:34.089] [LOG] 0|mm | [MQTT bridge] NOTI->MQTT. Topic: bathroom/mirror/monitor, payload: false 0|mm | [2020-10-16 09:44:34.101] [LOG] 0|mm | Powering off HDMI 0|mm | [2020-10-16 09:44:34.102] [LOG] 0|mm | [2020-10-16 09:44:36.936] [LOG] 0|mm | [MQTT bridge] NOTI->MQTT. Topic: bathroom/mirror/monitor, payload: {"state":"ON"} 0|mm | [2020-10-16 09:44:37.793] [LOG] 0|mm | Powering on HDMI with preferred settings 0|mm | [2020-10-16 09:44:37.795] [LOG]
So when it turns off, it doesn’t report state: off it just reports ‘false’ and it only reports state:on when it’s on.
I do see the messages appear in the MQTT, but as they are incorrectly formatted, HA doesn’t update it properly.
-
@fribse please send here as well console log. Also, could you please wait and check wat is happening when FALSE is sent by user_presence for the second time.
E.g. it would help full to see behaviour : false, true, … false -
-
The config that works looks like this:
var notiHook = [ { notiId: "USER_PRESENCE", notiPayload: [ { payloadValue: '1', notiMqttCmd: ["SCREENON"] }, { payloadValue: '0', notiMqttCmd: ["SCREENOFF"] } ] } ]; var notiMqttCommands = [ { commandId: "SCREENOFF", mqttTopic: "state/bathroom/mirror/monitor", mqttMsgPayload: "OFF" }, { commandId: "SCREENON", mqttTopic: "state/bathroom/mirror/monitor", mqttMsgPayload: "ON" } ]; module.exports = { notiHook, notiMqttCommands };
Thankyou again for your excellent help and sharp eyes Serge!. :flexed_biceps: :heart_suit: