door sensor and sonoff bridge
Posted: Tuesday 09 June 2020 21:17
Hi All,
I got several door sensors and a sonoff bridge.
I uploaded tasmota to the bridge and it is working fine. I can connect to its IP and also see it in domoticz following the instructions from Jelle Peters on youtube
https://www.youtube.com/watch?v=Y4UlFjPT5do.
I can see the door sensor in both logs (domoticz and bridge), but I am really struggling to assign a switch were I can see if the door is open or closed.
After reading over the last week, seems this can be done with node-red, but also with scripts directly in domoticz. My preference would be to do not install anything else. Seems the scripts are fairly straight forward and I will not need anything else, but simply reading if the door is open/closed.
I think I read all the posts, but really did not find a clear answer.
I followed what is in the post https://www.domoticz.com/forum/viewtopic.php?t=25748, but I am stuck on the switch/script.
Here are my readings from the domoticz log when I open/close the door switch:
2020-06-09 21:06:50.116 MQTT: Topic: domoticz/in, Message: {"idx":15,"nvalue":0,"svalue":"9759754","Battery":100,"RSSI":7}
2020-06-09 21:07:08.181 MQTT: Topic: domoticz/in, Message: {"idx":15,"nvalue":0,"svalue":"9759758","Battery":100,"RSSI":7}
I also tried to copy one of the scripts and edit it:
return {
on = { devices = { "sonoff bridge" } },
execute = function(dz, item)
if item.rawData[1] == "9759758" then
item.switchOn().checkFirst().silent()
else
item.switchOff().checkFirst().silent()
end
end
}
but my switch does not update the status....
I guess I am doing something really dumb... Any thougths/help?
Tks so much!
Henry
I got several door sensors and a sonoff bridge.
I uploaded tasmota to the bridge and it is working fine. I can connect to its IP and also see it in domoticz following the instructions from Jelle Peters on youtube
https://www.youtube.com/watch?v=Y4UlFjPT5do.
I can see the door sensor in both logs (domoticz and bridge), but I am really struggling to assign a switch were I can see if the door is open or closed.
After reading over the last week, seems this can be done with node-red, but also with scripts directly in domoticz. My preference would be to do not install anything else. Seems the scripts are fairly straight forward and I will not need anything else, but simply reading if the door is open/closed.
I think I read all the posts, but really did not find a clear answer.
I followed what is in the post https://www.domoticz.com/forum/viewtopic.php?t=25748, but I am stuck on the switch/script.
Here are my readings from the domoticz log when I open/close the door switch:
2020-06-09 21:06:50.116 MQTT: Topic: domoticz/in, Message: {"idx":15,"nvalue":0,"svalue":"9759754","Battery":100,"RSSI":7}
2020-06-09 21:07:08.181 MQTT: Topic: domoticz/in, Message: {"idx":15,"nvalue":0,"svalue":"9759758","Battery":100,"RSSI":7}
I also tried to copy one of the scripts and edit it:
return {
on = { devices = { "sonoff bridge" } },
execute = function(dz, item)
if item.rawData[1] == "9759758" then
item.switchOn().checkFirst().silent()
else
item.switchOff().checkFirst().silent()
end
end
}
but my switch does not update the status....
I guess I am doing something really dumb... Any thougths/help?
Tks so much!
Henry