Open MathieuMQc opened 2 years ago
Where did you see statusLowBatteryValue
documented or did you make it up?
Try something like...
"getStatusLowBattery": {
"topic": "security/sensors345/686604/status",
"apply": "return (message == 'LOWBATT');"
I tried something but didn't find it in the documentation
I tried but it's not working :
{
"type": "contactSensor",
"name": "Porte 3",
"username": "",
"password": "",
"topics": {
"getContactSensorState": "/security/sensors345/176014/alarm",
"getPositionState": "/security/sensors345/176014/alarm",
"getStatusLowBattery": {
"topic": "security/sensors345/176014/status",
"apply": "return (message == 'LOWBATT');"
},
"getStatusTampered": {
"topic": "security/sensors345/176014/status",
"apply": "return (message == 'TAMPER');"
}
},
"integerValue": true,
"onValue": "ALARM",
"offValue": "OK",
"accessory": "mqttthing"
},
Check your javascript in the apply setting will return an expected value. If you're using the integerValue
setting then you might need to return something like ((message == 'LOWBATT') ? 1 : 0);
I tried with ((message == 'LOWBATT') ? 1 : 0); I tried this too : "topic": "/security/sensors345/176014/status", "apply": "return ((message == 'TAMPER') ? ALARM : OK);" but it's not working
paste a copy of the relevant mqtt messages captured using mosquitto_sub -t '#' -v
I'd recommend dropping integerValue
setting and just send boolean true
/ false
values on more descriptive subjects instead of "status" because your current implementation cannot represent a status with both tamper and low battery simultaneously.
I got this :
/ # mosquitto_sub -t '#' -v Connection error: Connection Refused: not authorised.
I'm running eclipse-mosquitto on docker. Not sure what to do about this...
Edit (found it on internet) :
/security/sensors345/176014/alarm OK /security/sensors345/176014/status OK /security/sensors345/176014/alarm OK /security/sensors345/176014/status TAMPER /security/sensors345/176014/alarm ALARM /security/sensors345/176014/status TAMPER /security/sensors345/176014/alarm ALARM /security/sensors345/176014/status OK /security/sensors345/176014/alarm OK /security/sensors345/176014/status OK /security/sensors345/176014/alarm OK /security/sensors345/176014/status TAMPER /security/sensors345/176014/alarm ALARM /security/sensors345/176014/status TAMPER
Ok now I have done this. The Open/close is working but not the tamper/low battery :
{
"type": "contactSensor",
"name": "Porte 3",
"username": "",
"password": "",
"topics": {
"getContactSensorState": {
"topic": "/security/sensors345/176014/alarm",
"apply": "return (message == 'ALARM');"
},
"getStatusLowBattery": {
"topic": "security/sensors345/176014/status",
"apply": "return (message == 'LOWBATT');"
},
"getStatusTampered": {
"topic": "security/sensors345/176014/status",
"apply": "return (message == 'TAMPER');"
}
},
"accessory": "mqttthing"
},
That config works fine for me. You may need to force close and reopen your Home app to see the change take effect immediately. That's an apple limitation I believe. And you won't see both Tamper and Low Battery at the same time because you are sharing the same topic so one cancels out the other.
I'm doing it directly on my homebridge web page
Me too. Works fine. The Low Battery and Status Tampered Yes elements in my screens above were produced by:
mosquitto_pub -t "security/sensors345/176014/status" -m "TAMPER"
or
mosquitto_pub -t "security/sensors345/176014/status" -m "LOWBATT"
and then restarting the iPhone Home app.
Hey guys ! I have honeywell 345MHz sensor that I convert to MQTT and it works just fine but I can't get the tamper and low batt to work.
{ "type": "contactSensor", "name": "Door 1", "username": "****", "password": "****", "topics": { "getContactSensorState": "/security/sensors345/686604/alarm", "getPositionState": "/security/sensors345/686604/alarm", "getStatusLowBattery": "/security/sensors345/686604/status", "getStatusTampered": "/security/sensors345/686604/status" }, "integerValue": true, "onValue": "ALARM", "offValue": "OK", "statusLowBatteryValue": "LOWBATT", \Here I tried this but didn't find it anywere. Maybe there is another way to write it ? "statusTamperedValue": "TAMPER", \Here too "accessory": "mqttthing" },
Here is one of my sensor, With ContactSensorState, I can say that the value is ALARM and OK but with Low Battery and Tampered, it doesn't seems to work. The low battery and the tamper is on the same topic. Thanks you !