Xenomes / Domoticz-TUYA-Plugin

Implements the special Tuya Home Assistant API.
22 stars 8 forks source link

Do not send unneeded updates for devices that are not available #48

Closed joro75 closed 1 year ago

joro75 commented 1 year ago

A device that is not available, is being turned on very briefly. This is causing that 'LightingLog' table in the Domoticz database becomes very large. It also could be generating a lot of events if the device is being used in script-triggers.

The Domoticz log shows, that the device is only turned on for 70 ms.

2023-06-16 21:24:48.230 TUYA: DEV name=RGB Christmas Light state=True id=999987013c6105883db6 online=False
2023-06-16 21:24:48.288 TUYA: Update 1:'On' (Kerstboom verlichting) TimedOut=True
2023-06-16 21:24:48.353 TUYA: Update 0:'Off' (Kerstboom verlichting) TimedOut=True
2023-06-16 21:24:48.354 TUYA: DeviceID=999987013c6105883db6 Turned off because device is offline.

This however happens every 70 seconds.

The code change prevents the temporarily turning 'On' and 'Off' of the device, and only activates the final state.

Xenomes commented 1 year ago

Thanks for the improvement!