I’ve been pulling my hair the last few days sinces i cant for the life of me figure out where i went wrong and would appricitate some help.
What i’m trying to acchive is that when PIR-sensor in Home-Assistant (HA) detects presence it send MQTT to home-assistant/MagicMirror2 with payload “USER_PRESENCE_TRUE” wich then should trigger mqttNotiCommands to send MM MQTT–> NOTI USER_PRESENCE: 1.
The MQTT is recceived and printed in log but then nothing happens.
2020-11-19 06:05:16.563] [LOG] [MQTT bridge] MQTT message received. Topic: home-assistant/MagicMirror2, message: USER_PRESENCE_TRUE
As I said I cant for the LIFE of me figure out where the typo or error is and would appriciate your help!
my config:
module: 'MMM-MQTTbridge',
disabled: false,
config: {
mqttServer: "mqtt://10.0.1.15:1883",
mqttConfig:
{
listenMqtt: true,
interval: 300000,
},
notiConfig:
{
listenNoti: true,
ignoreNotiId: ["CLOCK_MINUTE", "NEWS_FEED"],
ignoreNotiSender: ["system", "NEWS_FEED"],
},
// set "NOTIFICATIONS -> MQTT" dictionary at /dict/notiDictionary.js
// set "MQTT -> NOTIFICATIONS" dictionary at /dict/mqttDictionary.js
},
mqttDicitionary.js
var mqttHook = [
{
mqttTopic: "home-assistant/MagicMirror2",
mqttPayload: [
{
payloadValue: "USER_PRESENCE_TRUE",
mqttNotiCmd: ["USER_PRESENCE_TRUE"]
},
{
payloadValue: "USER_PRESENCE_FALSE",
mqttNotiCmd: ["USER_PRESENCE_FALSE"]
},
],
},
];
var mqttNotiCommands = [
{
commandId: "USER_PRESENCE_TRUE",
notiID: "USER_PRESENCE",
notiPayload: '1'
},
{
commandId: "USER_PRESENCE_FALSE",
notiID: "USER_PRESENCE",
notiPayload: '0'
},
];
module.exports = { mqttHook, mqttNotiCommands};