clach04 / python-tuya

Python interface to ESP8266MOD WiFi smart devices from Shenzhen Xenon. NOTE I'm not using any devices with this library so I can't test :-(
MIT License
239 stars 54 forks source link

function state fix and mode scene added #36

Open tixi opened 6 years ago

tixi commented 6 years ago

Hi clach04,

The function state() generate a KeyError exception in case the device do not provide colour temperature. I fix it by putting in the state only the 6 first keys if they are provided by the device. The mapping is done with DPS_2_STATE. The function set_white() is modified accordingly to take into account the presence/absence of colour temperature.

I have also added the scene mode.

tixi commented 6 years ago

Hi clach04, I finally succeed to have some time to manage it. A backup of the code is now here: https://github.com/tixi/python-tuya-experimental I will create a new pull request for the minor bug so I think you can close that one. I have developed outlet and bulb plugins for domoticz based on your code. You can find them here: https://github.com/tixi/Domoticz-Tuya-SmartPlug-Plugin https://github.com/tixi/Domoticz-Tuya-SmartBulb-Plugin