Open Trippersgarage opened 4 years ago
Hi,
I always test it with node using a copy of the JSON received via MQTT
return( ( JSON.parse(message).RfReceived.Data == 'C27017' ) ? 1 : null || ( JSON.parse(message).RfReceived.Data == 'C2701E' ) ? 0 : null);
I'd try with:
return( ( JSON.parse(message).RfReceived.Data == 'C27017' ) ? 1 : 0 || ( JSON.parse(message).RfReceived.Data == 'C2701E' ) ? 0 : 0);
Because it must return some value, and null
is not a value.
Hi there. Been having a problem getting the app to work with my sonoff RF bridge flashed with tasmota.
My setup Homebridge on pi, Sonoff RF bridge running Tasmota 8.1.0, Eclipse Mosquitto on the same pi and a Kerui door sensor. The sensor works, the RF bridge sees it fine and outputs the following;
18:39:30 MQT: tele/RFPub/RESULT = {"Time":"2020-02-12T18:39:30","RfReceived":{"Sync":9410,"Low":320,"High":910,"Data":"C27017","RfKey":"None"}} 18:39:33 MQT: tele/RFPub/RESULT = {"Time":"2020-02-12T18:39:33","RfReceived":{"Sync":9410,"Low":280,"High":920,"Data":"C2701E","RfKey":"None"}}
The mosquitto broker sees the info from the RF bridge fine.
This is my config;
{ "accessory": "mqttthing", "type": "contactSensor", "name": "Door", "url": "mqtt://192.168.1.55", "topics": { "getContactSensorState": "tele/RFPub/RESULT", "apply": "return( ( JSON.parse(message).RfReceived.Data == 'C27017' ) ? 1 : null || ( JSON.parse(message).RfReceived.Data == 'C2701E' ) ? 0 : null);" }, "integerValue": true, "logMqtt": true }
For some reason, I cannot get the changes to the door to show up in the home app. I'm assuming the issue lies with mqttthing and my apologies if I'm wrong, but for the life of me, I can't seem to figure this out.
Any help greatly appreciated.
Thank you!