Updating a device from multiple triggers doesn't work properly
Posted: Saturday 21 December 2019 12:43
Hi,
I'm facing an issue that I'm not sure how to explain properly, but I'll try to do my best.
We have a thermostat that allows us to get the current state via JSON. The current state of the thermostat is fetched every minute and updated in Domoticz. One example is that whenever the thermostat program changes on the thermostat itself, it will be reflected in a dummy device in Domoticz after a minute tops. This is all working fine.
Recently I have written a basic Telegram Bot that allows me to send messages to it, which will be handled by Domoticz. Domoticz makes the initial call to the Telegram API with long polling, limited to 50 seconds (which is the maximum value). Whenever a message is sent, the response will be received by Domoticz. Domoticz is then able to handle the message and starts a new request, so the process starts over again. This works with the domoticz.openURL feature, which triggers the script to run (again) when a response is received from the Telegram API, basically a never ending loop.
However, a strange thing is happening that I cannot figure out by debugging. Whenever the thermostat program state changes in real life, the change will be collected from the thermostat at the next every minute timer trigger. Right before I update the thermostat program dummy device, I write a log to confirm that the dummy device will be updated. I can see that the log is being written, but the device does not update to the new state. Now whenever the long polling request of the Telegram API reaches its timeout, the device is updated to the new state. This doesn't make any sense to me.
This behavior only shows up when I have my Telegram Bot script turned on. When I turn it off, fetching the current state from the thermostat and reflecting it in Domoticz is working perfect.
Is there anyone who is possible able to tell me why this is happening? The behavior I described above is currently leading to very unexpected results in Domoticz, with devices being in wrong states and not reflecting the real world.
I'm facing an issue that I'm not sure how to explain properly, but I'll try to do my best.
We have a thermostat that allows us to get the current state via JSON. The current state of the thermostat is fetched every minute and updated in Domoticz. One example is that whenever the thermostat program changes on the thermostat itself, it will be reflected in a dummy device in Domoticz after a minute tops. This is all working fine.
Recently I have written a basic Telegram Bot that allows me to send messages to it, which will be handled by Domoticz. Domoticz makes the initial call to the Telegram API with long polling, limited to 50 seconds (which is the maximum value). Whenever a message is sent, the response will be received by Domoticz. Domoticz is then able to handle the message and starts a new request, so the process starts over again. This works with the domoticz.openURL feature, which triggers the script to run (again) when a response is received from the Telegram API, basically a never ending loop.
However, a strange thing is happening that I cannot figure out by debugging. Whenever the thermostat program state changes in real life, the change will be collected from the thermostat at the next every minute timer trigger. Right before I update the thermostat program dummy device, I write a log to confirm that the dummy device will be updated. I can see that the log is being written, but the device does not update to the new state. Now whenever the long polling request of the Telegram API reaches its timeout, the device is updated to the new state. This doesn't make any sense to me.
This behavior only shows up when I have my Telegram Bot script turned on. When I turn it off, fetching the current state from the thermostat and reflecting it in Domoticz is working perfect.
Is there anyone who is possible able to tell me why this is happening? The behavior I described above is currently leading to very unexpected results in Domoticz, with devices being in wrong states and not reflecting the real world.