Xenomes / Domoticz-TUYA-Plugin

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

Cover (and curtain track) Update Domoticz Status when opening/closing #33

Closed davewins closed 1 year ago

davewins commented 1 year ago

Code for Open/Close cover requires updating so that it updates the Domoticz status correctly:

change the code from:

elif dev_type == 'cover': if Command == 'Open': dev.open_cover() elif Command == 'Stop': dev.stop_cover() elif Command == 'Close': dev.close_cover() UpdateDevice(Unit, 1, 'On', not dev.available()) to:

elif dev_type == 'cover': if Command == 'Open': dev.open_cover() UpdateDevice(Unit, 1, 'On', not dev.available()) elif Command == 'Stop': dev.stop_cover() elif Command == 'Close': dev.close_cover() UpdateDevice(Unit, 0, 'Off', not dev.available());

Xenomes commented 1 year ago

Hi davewins, I think by the new cover control that the code can be:

elif dev_type == 'cover':
if Command == 'Open':
dev.open_cover()
UpdateDevice(Unit, 1, 'Open', not dev.available())
elif Command == 'Stop':
dev.stop_cover()
UpdateDevice(Unit, 0, 'Stop', not dev.available())
elif Command == 'Close':
dev.close_cover()
UpdateDevice(Unit, 0, 'Close', not dev.available())

https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s#Open-Close_Blinds

Xenomes commented 1 year ago

The plugin is fixed.