Page 15 of 26

Re: Python Plugin: TUYA

Posted: Thursday 03 June 2021 14:58
by Chimeras
Does anyone now if the Tuya Smart IR (WIFI to IR) is also controllable via this Domoticz plugin.
I would like to control my airco with this module, but it would be an extra if this is possible directly via Domoticz instead of the Smart Life app.

Re: Python Plugin: TUYA

Posted: Thursday 03 June 2021 22:06
by Xenomes
Chimeras wrote: Thursday 03 June 2021 14:58 Does anyone now if the Tuya Smart IR (WIFI to IR) is also controllable via this Domoticz plugin.
I would like to control my airco with this module, but it would be an extra if this is possible directly via Domoticz instead of the Smart Life app.
If it is connected to the Smart Life app you can configure and run the "debug_discovery.py" in the tools directory. you can see if it is detected. The climate part of the plug-in is still in development. I don't have the device so I am do it on feedback of others.

Re: Python Plugin: TUYA

Posted: Saturday 05 June 2021 23:12
by Chimeras
Thanks. I just ran the script, but the devices are not shown. They are connected to the Smart life app however.
Can I be of assistence to provide you with some more information to be able to support devices like these?

I just found out that when I add a "Tap-to-Run" scene in the Smart Life app, these scenes are being showed. This gives me a workaround, but it's not optimal.

Re: Python Plugin: TUYA

Posted: Tuesday 08 June 2021 22:50
by manjh
I'm using the plugin for a while now, with 9 LSC lamps. Ran into a few problems, sometimes the lamps are unusable after a restart of my R-Pi. It is easy to fix: simply go to the hardware page, disable the plugin, and the enable it again. This brings everything back to life.
But it is inconvenient since I have to be logged on to do this. Would it be possible to automate this in the plugin? If no lights are received, simply reset and try again?

Re: Python Plugin: TUYA

Posted: Wednesday 09 June 2021 11:02
by Xenomes
Chimeras wrote: Saturday 05 June 2021 23:12 Thanks. I just ran the script, but the devices are not shown. They are connected to the Smart life app however.
Can I be of assistence to provide you with some more information to be able to support devices like these?

I just found out that when I add a "Tap-to-Run" scene in the Smart Life app, these scenes are being showed. This gives me a workaround, but it's not optimal.
If the "debug_discovery.py" device section in the json is empty the device is not supported by the older Tuya /homeassistant API see https://github.com/PaulAnnekov/tuyaha#h ... our-device
There is a new one in the make but I don't know if its compatible with current plug-in.

Re: Python Plugin: TUYA

Posted: Wednesday 09 June 2021 11:05
by Xenomes
manjh wrote: Tuesday 08 June 2021 22:50 I'm using the plugin for a while now, with 9 LSC lamps. Ran into a few problems, sometimes the lamps are unusable after a restart of my R-Pi. It is easy to fix: simply go to the hardware page, disable the plugin, and the enable it again. This brings everything back to life.
But it is inconvenient since I have to be logged on to do this. Would it be possible to automate this in the plugin? If no lights are received, simply reset and try again?
I don't have this issue, what is the version of your plugin and Tuyaha?

edit:
If you restart you PI often, maybe a virtual button with this command and off course one with true.

Code: Select all

/json.htm?type=command&param=updatehardware&htype=<type>&name=<name>&enabled=false&idx=<hardware idx>
source:https://www.domoticz.com/wiki/Domoticz_ ... e_hardware

Re: Python Plugin: TUYA

Posted: Wednesday 09 June 2021 16:54
by manjh
Xenomes wrote: Wednesday 09 June 2021 11:05
manjh wrote: Tuesday 08 June 2021 22:50 I'm using the plugin for a while now, with 9 LSC lamps. Ran into a few problems, sometimes the lamps are unusable after a restart of my R-Pi. It is easy to fix: simply go to the hardware page, disable the plugin, and the enable it again. This brings everything back to life.
But it is inconvenient since I have to be logged on to do this. Would it be possible to automate this in the plugin? If no lights are received, simply reset and try again?
I don't have this issue, what is the version of your plugin and Tuyaha?

edit:
If you restart you PI often, maybe a virtual button with this command and off course one with true.

Code: Select all

/json.htm?type=command&param=updatehardware&htype=<type>&name=<name>&enabled=false&idx=<hardware idx>
source:https://www.domoticz.com/wiki/Domoticz_ ... e_hardware
Good, this is a nice pragmatic approach. My only problem is how do I get this into a switch? I tried the on/off action, but the text turns red and I cannot save. Alternative is to put it into a lua script and have the switch trigger that. But in both cases: how?
Preferably, how do I issue a json command from LUA?

Re: Python Plugin: TUYA

Posted: Wednesday 09 June 2021 17:18
by Xenomes
manjh wrote: Wednesday 09 June 2021 16:54 Good, this is a nice pragmatic approach. My only problem is how do I get this into a switch? I tried the on/off action, but the text turns red and I cannot save. Alternative is to put it into a lua script and have the switch trigger that. But in both cases: how?
Preferably, how do I issue a json command from LUA?
U need to put http://<127.0.0.1 or IP>:<port>/json.htm?type=command&param=updatehardware&htype=<type>&name=<name>&enabled=false&idx=<hardware idx>

You need to change IP, port, type, name and hardware idx in your setting, and that url you can put in the on/off switch.

Re: Python Plugin: TUYA

Posted: Wednesday 09 June 2021 18:01
by manjh
Xenomes wrote: Wednesday 09 June 2021 17:18
manjh wrote: Wednesday 09 June 2021 16:54 Good, this is a nice pragmatic approach. My only problem is how do I get this into a switch? I tried the on/off action, but the text turns red and I cannot save. Alternative is to put it into a lua script and have the switch trigger that. But in both cases: how?
Preferably, how do I issue a json command from LUA?
U need to put http://<127.0.0.1 or IP>:<port>/json.htm?type=command&param=updatehardware&htype=<type>&name=<name>&enabled=false&idx=<hardware idx>

You need to change IP, port, type, name and hardware idx in your setting, and that url you can put in the on/off switch.
OK, that helps. I am now able to disable the Tuya hardware line. But I have not been able to enable it again... I thought I could get away with changing the "enabled=false" into "enabled=true", but that does not work.
I checked the wiki, it shows a different json command to enable the hardware, including port and loglevel. But neither of these can be seen in the hardware overview...
These are the commands I now have:

Code: Select all

http://127.0.0.1:8080/json.htm?type=command&param=updatehardware&htype=TUYA&name=Tuya_devices&enabled=true&idx=22
http://127.0.0.1:8080/json.htm?type=command&param=updatehardware&htype=TUYA&name=Tuya_devices&enabled=false&idx=22

Re: Python Plugin: TUYA

Posted: Wednesday 09 June 2021 21:30
by Xenomes
manjh wrote: Wednesday 09 June 2021 18:01 OK, that helps. I am now able to disable the Tuya hardware line. But I have not been able to enable it again... I thought I could get away with changing the "enabled=false" into "enabled=true", but that does not work.
I checked the wiki, it shows a different json command to enable the hardware, including port and loglevel. But neither of these can be seen in the hardware overview...
These are the commands I now have:

Code: Select all

http://127.0.0.1:8080/json.htm?type=command&param=updatehardware&htype=TUYA&name=Tuya_devices&enabled=true&idx=22
http://127.0.0.1:8080/json.htm?type=command&param=updatehardware&htype=TUYA&name=Tuya_devices&enabled=false&idx=22
The enable command bricked my system! .... I think it not a great idea ... please ignore it!

edit:
It removed all data in the hardware, had to recreate it with sqllite

Re: Python Plugin: TUYA

Posted: Thursday 10 June 2021 17:10
by manjh
Xenomes wrote: Wednesday 09 June 2021 21:30
manjh wrote: Wednesday 09 June 2021 18:01 OK, that helps. I am now able to disable the Tuya hardware line. But I have not been able to enable it again... I thought I could get away with changing the "enabled=false" into "enabled=true", but that does not work.
I checked the wiki, it shows a different json command to enable the hardware, including port and loglevel. But neither of these can be seen in the hardware overview...
These are the commands I now have:

Code: Select all

http://127.0.0.1:8080/json.htm?type=command&param=updatehardware&htype=TUYA&name=Tuya_devices&enabled=true&idx=22
http://127.0.0.1:8080/json.htm?type=command&param=updatehardware&htype=TUYA&name=Tuya_devices&enabled=false&idx=22
The enable command bricked my system! .... I think it not a great idea ... please ignore it!

edit:
It removed all data in the hardware, had to recreate it with sqllite
Same here. The Tuya hardware line suddenly had a totally different type. I had to remove it, and re-install. Not a big deal, except that it also removed all nine LSC lamps that I had added, including all references in scenes and so on. Took me some time to get it back together. :?
So: this is not worth the risk... when it happens again, I will simply disable and re-enable the hardware line. Safe and quick.

Re: Python Plugin: TUYA

Posted: Thursday 10 June 2021 19:55
by Xenomes
manjh wrote: Thursday 10 June 2021 17:10 Same here. The Tuya hardware line suddenly had a totally different type. I had to remove it, and re-install. Not a big deal, except that it also removed all nine LSC lamps that I had added, including all references in scenes and so on. Took me some time to get it back together. :?
So: this is not worth the risk... when it happens again, I will simply disable and re-enable the hardware line. Safe and quick.
We found a bug 😅, why didn't you restore a backup? But I find it still strange that you have to restart the plug-in, on my live and test system I can start Domoticz and the plug-in start a minute later without any problem/error.

Edit:
The bug is fixed in the beta.

Re: Python Plugin: TUYA

Posted: Thursday 10 June 2021 23:03
by technoholic
My diffuser has been working flawlessly since you helped me Xenomes, until right now and it's just stopped being controllable or appearing in the system, it can't find the device it seems

2021-06-10 22:00:16.579 Error: Tuya: (Tuya) Command for DeviceID=bf2c8d53f615c4c2d0twpi but device is offline.
DEV name=Smart Aroma Diffuser state=False id=bf2c8d53f615c4c2d0twpi online=False
2021-06-10 22:01:01.014 Tuya: (Tuya) Pushing 'onHeartbeatCallback' on to queue
2021-06-10 22:01:01.077 (Tuya) Processing 'onHeartbeatCallback' message
2021-06-10 22:01:01.077 Tuya: (Tuya) Calling message handler 'onHeartbeat'.

Any ideas at all?

Tahnks

Re: Python Plugin: TUYA

Posted: Friday 11 June 2021 10:37
by manjh
Xenomes wrote: Thursday 10 June 2021 19:55
manjh wrote: Thursday 10 June 2021 17:10 Same here. The Tuya hardware line suddenly had a totally different type. I had to remove it, and re-install. Not a big deal, except that it also removed all nine LSC lamps that I had added, including all references in scenes and so on. Took me some time to get it back together. :?
So: this is not worth the risk... when it happens again, I will simply disable and re-enable the hardware line. Safe and quick.
We found a bug 😅, why didn't you restore a backup? But I find it still strange that you have to restart the plug-in, on my live and test system I can start Domoticz and the plug-in start a minute later without any problem/error.

Edit:
The bug is fixed in the beta.
Restoring is not simple, I first have to copy the latest image from my NAS, then bring down the Pi and remove the SSD, then burn the image onto the SSD and start the whole circus up again. After that restore the latest Domoticz and Node-Red data.
If it is necessary, then yes: I'll do it. But in this case simply removing and adding the plugin was OK, with a little work to add all lamps again.

As for the reason: this has happened twice, cannot see any root cause.

Yesterday evening another strange thing: when we went to bed I started my "lights off" scene. All lights went out except the Tuya lamps. Log showed "device not available". Restarting the plugin did not help.
So I switched the lamps off using the Tuya app on my phone and went to bed.
This morning, everything was back to normal... problem went away on it's own!

Re: Python Plugin: TUYA

Posted: Friday 11 June 2021 10:38
by manjh
technoholic wrote: Thursday 10 June 2021 23:03 My diffuser has been working flawlessly since you helped me Xenomes, until right now and it's just stopped being controllable or appearing in the system, it can't find the device it seems

2021-06-10 22:00:16.579 Error: Tuya: (Tuya) Command for DeviceID=bf2c8d53f615c4c2d0twpi but device is offline.
DEV name=Smart Aroma Diffuser state=False id=bf2c8d53f615c4c2d0twpi online=False
2021-06-10 22:01:01.014 Tuya: (Tuya) Pushing 'onHeartbeatCallback' on to queue
2021-06-10 22:01:01.077 (Tuya) Processing 'onHeartbeatCallback' message
2021-06-10 22:01:01.077 Tuya: (Tuya) Calling message handler 'onHeartbeat'.

Any ideas at all?

Tahnks
This was last night, around 22:00! Later that night I had similar problems switching my Tuya lamps off. Could it be a problem in the Tuya server somehow?

Re: Python Plugin: TUYA

Posted: Friday 11 June 2021 10:46
by technoholic
Yes it must have been, as it's working today again, and also the app wasn't working yesterday either so must have been a server issue

Re: Python Plugin: TUYA

Posted: Friday 11 June 2021 16:55
by Xenomes
manjh wrote: Friday 11 June 2021 10:38
technoholic wrote: Thursday 10 June 2021 23:03 My diffuser has been working flawlessly since you helped me Xenomes, until right now and it's just stopped being controllable or appearing in the system, it can't find the device it seems

2021-06-10 22:00:16.579 Error: Tuya: (Tuya) Command for DeviceID=bf2c8d53f615c4c2d0twpi but device is offline.
DEV name=Smart Aroma Diffuser state=False id=bf2c8d53f615c4c2d0twpi online=False
2021-06-10 22:01:01.014 Tuya: (Tuya) Pushing 'onHeartbeatCallback' on to queue
2021-06-10 22:01:01.077 (Tuya) Processing 'onHeartbeatCallback' message
2021-06-10 22:01:01.077 Tuya: (Tuya) Calling message handler 'onHeartbeat'.

Any ideas at all?

Tahnks
This was last night, around 22:00! Later that night I had similar problems switching my Tuya lamps off. Could it be a problem in the Tuya server somehow?
Maybe they updated the API 🤣 (sarcasm)

Re: Python Plugin: TUYA

Posted: Friday 11 June 2021 17:00
by Xenomes
manjh wrote: Friday 11 June 2021 10:37 Restoring is not simple, I first have to copy the latest image from my NAS, then bring down the Pi and remove the SSD, then burn the image onto the SSD and start the whole circus up again. After that restore the latest Domoticz and Node-Red data.
If it is necessary, then yes: I'll do it. But in this case simply removing and adding the plugin was OK, with a little work to add all lamps again.

As for the reason: this has happened twice, cannot see any root cause.

Yesterday evening another strange thing: when we went to bed I started my "lights off" scene. All lights went out except the Tuya lamps. Log showed "device not available". Restarting the plugin did not help.
So I switched the lamps off using the Tuya app on my phone and went to bed.
This morning, everything was back to normal... problem went away on it's own!
no I meant the restore a db file.
stop domoticz
rename domiticz.db to domiticz.db.bak
remove domoticz.db-shm and domoticz.db-wal
copy db from backups/hourly/.. to ./domiticz.db
start domoticz
domoticz restored 🎉🎉🎉

Re: Python Plugin: TUYA

Posted: Tuesday 15 June 2021 18:43
by Varazir
I have bought a Cleverio AF-F100 and installed this plugin.
The plugin finds it as a fan and can turn it off and on but the fan has more features.
Is there a way I can add them ?

Re: Python Plugin: TUYA

Posted: Tuesday 15 June 2021 19:08
by Xenomes
Varazir wrote: Tuesday 15 June 2021 18:43 I have bought a Cleverio AF-F100 and installed this plugin.
The plugin finds it as a fan and can turn it off and on but the fan has more features.
Is there a way I can add them ?
Maybe there are more functions to control, can you configure and run the "debug_discovery.py" in the tool directory and list the json output here.