i am trying to sync some domoticz switches with home assistant. So i made a config in home assistant that
- reads domitcz/out/<idx> for the switch state
- can send to domoticz/in commands when a button is pushed from home assistant.
Config seems to be fine:
- If a switch state is changed in domoticz, the following messages is read on domoticz/out/idx-of-the-device:
Code: Select all
{
"Battery" : 255,
"LastUpdate" : "2024-12-08 11:19:12",
"RSSI" : 12,
"description" : "",
"dtype" : "Lighting 1",
"hwid" : "8",
"id" : "65",
"idx" : 1872,
"name" : "Test",
"nvalue" : 0,
"org_hwid" : "8",
"stype" : "X10",
"switchType" : "On/Off",
"unit" : 1
}
and if i flip a switch in home assistant, the following message is published on domoticz/in
Code: Select all
{ "command": "switchlight", "idx": idx-of-the-device, "switchcmd": "Off" }
However the hass state flips back after a few seconds. I analyzed and did some testing and found out that if a device is changed by a message on domoticz/in, the same state is not reflected on domoticz/out... and that's where it goes wrong, cause then hass assumes the command failed.
i confirmed this theory a manual test be sending manually the domoticz/out message rightaway after the domoticz/in message and then it works correct.
Looking a bit further this also explains why my homekit integration (using homebridge and the edomoticz plugin) also has the same behaviour. There i also sometimes see the wrong states in homebridge.
I think this is incorrect behaviour: i think the correct behaviour should be that when the mqtt client interface is enabled, any device change should always be reflected on domitcz/out (so also when the change was initiated by a pauload on the domoticz/in topic) and this is a bug
My question to the experts on the forum here: Is my way of thinking correct? Then i will post an issue on github... If not: Where do i go wrong and how can i fix my issue in another way?