Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Python and python framework

Moderator: leecollings

Post Reply
User avatar
Xenomes
Posts: 385
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

I have developed a new plugin for Tuya WiFi devices, which uses the TinyTuya module. This module is more compatible with the new API compared to TuyaHA, which is no longer being developed. So far, I have only tested it with one device (LSC RGBWW).

I need feedback from the Domoticz community to support other devices. Check out my GitHub repository at https://github.com/Xenomes/Domoticz-TinyTUYA-Plugin.
If you'd like to contribute, there is a debug_discovery.py script in the tools folder that you can run with Python. Please share the resulting JSON data on the GitHub issues page so we can further develop the plugin to support more devices.

It's still in the early stages, so any and all feedback is welcome. 😉

Xenomes
Last edited by Xenomes on Friday 13 September 2024 20:27, edited 2 times in total.
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
User avatar
Xenomes
Posts: 385
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

Version Information
1.0.0 Initial upload version
1.0.1 Change heart beat to reduce API calls
1.1.0 Add Heater (Power, read and set temperature)
1.2.0 Add Thermostats, T&H devices, Covers/Blinds, multi switches and optimization code (Thanks for the testers!)
1.2.1 Fixed value scaling problem and mode detection and some other stuff
1.2.2 Add Doorbel
1.2.3 Fix for incorrect 'temp_set' selection
1.2.4 Fix Heater function
1.2.5 Add 'Window check' and 'child lock' to Heater function
1.2.6 Add Power readings to Switch, repair Dimmer devices and Light detection v2 fixed
1.2.7 Add 'battery percentage' and 'battery_state' to battery power devices
1.2.8 Fix for filament lamps
1.2.9 Fix bug in video doorbell
1.3.0 Add On/Off for Fan
1.3.1 Change temperature scaling get value from tuya defined from function
1.3.2 Add kWh logging for switch with powerreader, fix failed login detection
1.3.3 Add on/off and other functions Siren
1.3.4 Changed local network detection to prevend 'thread seems to have ended unexpectedly' and speedup hardware detection
1.3.5 Add Fan's with lights
1.3.6 Add Smart IR T&H readouts not IR Devices to complex to recreate
1.3.7 Add 3 phase Power meter
1.3.8 Changed scaling for result
1.3.9 Add Gateway and CO2 Sensor
1.4.0 Add Ledstrip with deviating config
1.4.1 Add Doorsensor, Motionsensor with light and moddifed the subscription has expired detection
1.4.2 Add Tempsensor, Compatible with T&H standard and DP mode
1.4.3 Add Heatpump
1.4.4 Fix changed lights control
1.4.5 Add Zigbee Gateway (no reporting from device), Garage door opener, Fix changed temp control
1.4.6 Update for Tinytuya 1.11.0 and higher no need for search ID
1.4.7 Sub device added for Powermesument if mA is detectect, small bug fix and update install info to work with Docker
1.4.8 Added a new config for Thermostats and bug fix restart of the plugin see 'Updating'
1.4.9 Added a new configuration for power reading
1.5.0 Bug fix for tinytuya 1.12.3
1.5.1 Added feeder
1.5.2 Changed the detection of a faulty login credentials or expired subscription
1.5.3 Some optimize, cleanup, turn down chattiness
1.5.4 Add new Curtain, heater control and custom scale for thermostat with deviant behavior
1.5.5 Add min/max for set devices
1.5.6 Fixed colour control and added Energy breaker switch
1.5.7 Add water leak sensor and presence sensors
1.5.8 Add Irrigation Control and smokesensor
1.5.9 Add new switch device
1.6.0 Add Starlight and Smart Wireless Switch M4 device
1.6.1 Add PJ2101A 1P WiFi Smart Meter device
1.6.2 Add Smart Siren and boiler device
1.6.3 Add Smart lock
1.6.4 Add Dehumidifier
1.6.5 Add Robot vacuum cleaner
1.6.6 Add WIFI Dual Meter
1.6.7 Add Air quality sensor multifunction alarm by fratton
1.6.8 Add Air purifier and unsupported circuit breaker (DIN rail switch)
1.6.9 Add Smartheatpump by doucha2
1.7.0 Add Scene remote
1.7.1 Add Switch Robot and lux meter
1.7.2 Add Smart Kettle and update Thermostat to 2024.1+
1.7.3 Add SETTI+ weather station
1.7.4 Bug fixing
1.7.5 Make compatible with Bookworm
1.7.6 Add WiFi Din Rail Switch with power metering
1.7.7 Add Airconditioner
1.7.8 Add Intelligent triple heat pump
1.7.9 Add Illumination sensor
1.8.0 Modify Intelligent triple heat pump
1.8.1 Modify Irrigation device with six areas
1.8.2 Add Micro Inverter SP Series 800 by romaint2b
1.8.3 Add LSC smart outdoor lamp with camera (Light only!)
1.8.4 Bugfix multi-switch device
1.8.5 Add Lawn Mower
1.8.6 Fix scaling issue with some values
1.8.7 Changed energy calculation by DKTigra
1.8.8 Fix for waterleak sensor
1.8.9 Fix for devices with no ip
1.9.0 Add Smart Soil Sensor
1.9.1 Add Pool temperature Sensor
1.9.2 Add WiFi Digital Meter
1.9.3 Add unsupported airconditioner
1.9.4 Add unsupported dehumidifier
1.9.5 Update for Python >3.11
1.9.6 Add unsupported roller shutter
1.9.7 Fix category tdq to switch
1.9.8 Add unsupported roller shutter
1.9.9 Add extra control powermeter
2.0.0 Add support for AV-TTW5-W/RH Ventilator
2.0.1 Add support for Caravan and Home Air Conditioner AC3501
2.0.2 Add support for 8ch Tuya Wireless Switch
2.0.3 Add a second channel cover control
2.0.4 Add Power meter with dual channel by romaint2b
2.0.5 Update for Smart Scene Switch 4 Gang support #133
2.0.6 Add Presence sensor with switch support #132
2.0.7 Fix issue #137, #138
2.0.8 Polling interval issue #141
2.0.9 Dirty fix for device detection Issue #150
2.1.0 Add Thermostat Device issue #147
2.1.1 Fix issue #153
2.1.2 Add outside lamp #156
2.1.3 Add EV-Chargers #145 #148

Known issues:
Doorbell, Door- and Motion sensor on (max. 1 minute reporting time)
Last edited by Xenomes on Tuesday 04 February 2025 21:02, edited 21 times in total.
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
hiihoo
Posts: 6
Joined: Tuesday 01 August 2017 13:54
Target OS: Linux
Domoticz version: 4.11672
Location: Finland
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by hiihoo »

Xenomes wrote: Sunday 27 November 2022 16:39
It is still in startup phase so any every feedback is welcome. ;)

Xenomes
Hi again. :-) Here is my feedback. This plugin seems working better than previous, atleast for me.
Little more to do to get tuya-iot-account, but not bad.

This (or the tuya-iot-account) don't work with (ie.) Nedis SmartLife app? Or at least it won't link with qr to it.

Anyway. So installed Tuya Smart, and one bulb there, "works", connects but this happens with domoticz..

Code: Select all

2022-11-30 14:36:40.681 tuya: Worker thread started.
2022-11-30 14:36:40.681 Status: tuya: Entering work loop.
2022-11-30 14:36:40.681 Status: tuya: Started.
2022-11-30 14:36:41.109 tuya: TinyTUYA plugin started
2022-11-30 14:36:41.109 tuya: Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE
2022-11-30 14:36:41.109 tuya: 'HardwareID':'12'
2022-11-30 14:36:41.109 tuya: 'HomeFolder':'/opt/domoticz/plugins/Domoticz-TinyTUYA-Plugin/'
2022-11-30 14:36:41.109 tuya: 'StartupFolder':'/opt/domoticz/'
2022-11-30 14:36:41.109 tuya: 'UserDataFolder':'/opt/domoticz/'
2022-11-30 14:36:41.109 tuya: 'Database':'/opt/domoticz/domoticz.db'
2022-11-30 14:36:41.109 tuya: 'Language':'en'
2022-11-30 14:36:41.109 tuya: 'Version':'1.0.0'
2022-11-30 14:36:41.109 tuya: 'Author':'Xenomes'
2022-11-30 14:36:41.109 tuya: 'Name':'tuya'
2022-11-30 14:36:41.109 tuya: 'Port':'0'
2022-11-30 14:36:41.109 tuya: 'Username':'vj34ymhhcwrky5nxe8f3'
2022-11-30 14:36:41.109 tuya: 'Password':'ca0f51e512574cfc88a7c1412007a198'
2022-11-30 14:36:41.109 tuya: 'Key':'tinytuya'
2022-11-30 14:36:41.109 tuya: 'Mode1':'eu'
2022-11-30 14:36:41.109 tuya: 'Mode2':'75771060a4cf12a122e3'
2022-11-30 14:36:41.109 tuya: 'Mode6':'-1'
2022-11-30 14:36:41.109 tuya: 'DomoticzVersion':'2022.2 (build 14784)'
2022-11-30 14:36:41.109 tuya: 'DomoticzHash':'e04d1d3e2'
2022-11-30 14:36:41.109 tuya: 'DomoticzBuildTime':'2022-11-29 08:53:03'
2022-11-30 14:36:41.109 tuya: Device count: 0
2022-11-30 14:36:41.108 Status: tuya: Initialized version 1.0.0, author 'Xenomes'
2022-11-30 14:36:42.539 tuya: Device name=Lamppu id=75771060a4cf12a122e3
2022-11-30 14:36:43.374 tuya: Create devices
2022-11-30 14:36:43.714 tuya: handleThread: Device not found! Removed? line 316
2022-11-30 14:36:43.714 tuya: Acquiring GIL for 'onStartCallback'
2022-11-30 14:36:43.713 Error: tuya: No controls found for your light device!
2022-11-30 14:36:43.714 Error: tuya: handleThread: Device not found! Removed?
2022-11-30 14:36:50.025 tuya: Pushing 'onHeartbeatCallback' on to queue
2022-11-30 14:36:50.076 tuya: Processing 'onHeartbeatCallback' message
2022-11-30 14:36:50.076 tuya: Acquiring GIL for 'onHeartbeatCallback'
2022-11-30 14:36:50.076 tuya: Calling message handler 'onHeartbeat' on 'module' type object.
2022-11-30 14:36:50.076 tuya: onHeartbeat called
2022-11-30 14:36:50.668 tuya: Device name=Lamppu id=75771060a4cf12a122e3
2022-11-30 14:36:51.538 tuya: handleThread: Device not found! Removed? line 316
2022-11-30 14:36:51.538 tuya: Acquiring GIL for 'onHeartbeatCallback'
2022-11-30 14:36:51.538 Error: tuya: handleThread: Device not found! Removed?
Seems it detects my "Lamppu" (light bulb might be closest, sorry my finnish... ) , but then it lost it somehow?

Will put json to github. .. forgot my password, i'll put debug_discovery here.. Sorry...

Funny enough.. As it implies at "name id .. Key : 'deleted'... But at tuya-app working, and status of device shows sensible data, switch / brightness / temp changes as they are changed at app..

Anyway!-) following is Nedis Wi-Fi Smart Bulb (SmartLife logo), WIFILW10CRGU10, GU10 4.9W/345lm 2700-6500K ..

Code: Select all

List of devices:
 [{'name': 'Lamppu', 'id': '75771060a4cf12a122e3', 'key': 'Deleted', 'mac': 'a4:cf:12:a1:22:e3', 'category': 'dj', 'product_name': 'Smart bulb', 'product_id': 'djjv8ioc4zyzv8tc', 'biz_type': 0, 'model': 'WIFILW10CRGU10', 'sub': False, 'icon': 'https://images.tuyaeu.com/smart/icon/ay1513237774906SMBA3/15585187678fd13b5d5cb.png'}]

Functions of device: 75771060a4cf12a122e3
 {'result': {'category': 'dj', 'functions': [{'code': 'switch_led', 'desc': 'switch led', 'name': 'switch led', 'type': 'Boolean', 'values': '{}'}, {'code': 'bright_value', 'desc': 'bright value', 'name': 'bright value', 'type': 'Integer', 'values': '{"min":25,"scale":0,"unit":"","max":255,"step":1}'}, {'code': 'temp_value', 'desc': 'temp value', 'name': 'temp value', 'type': 'Integer', 'values': '{"min":0,"scale":0,"unit":"","max":255,"step":1}\t'}]}, 'success': True, 't': 1669812740555, 'tid': 'd3e94e8770ad11edac99da3a06eee480'}

Status of device: 75771060a4cf12a122e3
 {'result': [{'code': 'switch_led', 'value': True}, {'code': 'bright_value', 'value': 143}, {'code': 'temp_value', 'value': 50}], 'success': True, 't': 1669812740762, 'tid': 'd408b66470ad11edb328265ef7a90a71'}
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by kalinkamaen »

I have installed this on my Windows version.

But I cant find Device ID. I am using Smartlife app. Is this TUYA app onlY?
Windows 10, Domoticz 14784
User avatar
Xenomes
Posts: 385
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

hiihoo wrote: Wednesday 30 November 2022 14:01 Seems it detects my "Lamppu" (light bulb might be closest, sorry my finnish... ) , but then it lost it somehow?
The 'Lamppu' bulb is that connect to the tuya-app or Nedis SmartLife app? I am Using the ''Smart Live' had no problem connecting by QR.
hiihoo wrote: Wednesday 30 November 2022 14:01 Funny enough.. As it implies at "name id .. Key : 'deleted'... But at tuya-app working, and status of device shows sensible data, switch / brightness / temp changes as they are changed at app..
In de script I delete the key from the export json (for security reason), i don't need it to analyze the json.
hiihoo wrote: Wednesday 30 November 2022 14:01 Anyway!-) following is Nedis Wi-Fi Smart Bulb (SmartLife logo), WIFILW10CRGU10, GU10 4.9W/345lm 2700-6500K ..
Is the bulb detected correctly as a Bulb with temperature and brightness control?
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
User avatar
Xenomes
Posts: 385
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

kalinkamaen wrote: Wednesday 30 November 2022 20:41 I have installed this on my Windows version.
Great a windows user, i never run Domoticz on Windows. I love your feedback.
kalinkamaen wrote: Wednesday 30 November 2022 20:41 But I cant find Device ID. I am using Smartlife app. Is this TUYA app onlY?
On the IOT account of Tuya go to Cloud => your project => Devices => Pick one of you devices, tinytuya use it to scan the others.
Edit: I add instruction to the readme.md to find DeviceID
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by kalinkamaen »

Xenomes wrote: Wednesday 30 November 2022 21:25
kalinkamaen wrote: Wednesday 30 November 2022 20:41 I have installed this on my Windows version.
Great a windows user, i never run Domoticz on Windows. I love your feedback.
kalinkamaen wrote: Wednesday 30 November 2022 20:41 But I cant find Device ID. I am using Smartlife app. Is this TUYA app onlY?
On the IOT account of Tuya go to Cloud => your project => Devices => Pick one of you devices, tinytuya use it to scan the others.
Edit: I add instruction to the readme.md to find DeviceID
Thanks for quick reply.
Thats what I tought. But as I am a smartlife user an non tuya user I du not have any devices there. No devices found.
Windows 10, Domoticz 14784
User avatar
Xenomes
Posts: 385
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

I am using 'Smart Life' user too. So you can add the app by QR to the tuya iot account.
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by kalinkamaen »

Xenomes wrote: Wednesday 30 November 2022 22:41 I am using 'Smart Life' user too. So you can add the app by QR to the tuya iot account.
I tried but it did not work.

Image
Windows 10, Domoticz 14784
User avatar
Xenomes
Posts: 385
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

Did you check if you have the correct data center?
iot.tuya.com => cloud => your project => overview=> edit => Data Centre
For Europe you can also try to use 'Central Europe data center' that is the one in my account.
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by kalinkamaen »

Xenomes wrote: Thursday 01 December 2022 6:14 Did you check if you have the correct data center?
iot.tuya.com => cloud => your project => overview=> edit => Data Centre
For Europe you can also try to use 'Central Europe data center' that is the one in my account.
Yes mine is Western Europe. But i am no able to change it due to only chang once per 30 days.
I think I nee to change to Mainland China. Sorry to be so negative here. But TUYA sucks. :lol:
Windows 10, Domoticz 14784
hiihoo
Posts: 6
Joined: Tuesday 01 August 2017 13:54
Target OS: Linux
Domoticz version: 4.11672
Location: Finland
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by hiihoo »

Xenomes wrote: Wednesday 30 November 2022 21:21
hiihoo wrote: Wednesday 30 November 2022 14:01 Seems it detects my "Lamppu" (light bulb might be closest, sorry my finnish... ) , but then it lost it somehow?
The 'Lamppu' bulb is that connect to the tuya-app or Nedis SmartLife app? I am Using the ''Smart Live' had no problem connecting by QR.
The Lamppu is connected to 'Tuya Smart' by Tuya, this shows in debug script and domoticz logs but won't show up in domoticz.

Another is connected to 'Nedis SmartLife' by Nedis, doesn't (yet) work, it won't link with tuya-iot-account with qr, says qr-expired, have to try different datacenter, might be that, I think I tried western and central europes, but have to try again.

You say using 'Smart Live' is that typo as couple messages down it's 'Smart Life'.. Is that Smart Life by tuya or some other?
As tuya also talks about Smart App and Smart Life App.. (https://support.tuya.com/en/help/_detail/K9hrdz10p224e)
As in google-play, you search for Smart Life, you get pretty many Smart Life apps....
hiihoo wrote: Wednesday 30 November 2022 14:01 Funny enough.. As it implies at "name id .. Key : 'deleted'... But at tuya-app working, and status of device shows sensible data, switch / brightness / temp changes as they are changed at app..
In de script I delete the key from the export json (for security reason), i don't need it to analyze the json.
[/quote]
Ok, misunderstood.. Great option to hide it. :-) Nobody want somebody else controlling own home.
hiihoo wrote: Wednesday 30 November 2022 14:01 Anyway!-) following is Nedis Wi-Fi Smart Bulb (SmartLife logo), WIFILW10CRGU10, GU10 4.9W/345lm 2700-6500K ..
Is the bulb detected correctly as a Bulb with temperature and brightness control?
[/quote]

Yes, it is correct.
HatsekieD
Posts: 3
Joined: Friday 26 January 2018 10:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by HatsekieD »

When I enable the TinyTUYA-plugin with my credentials and a device ID found in my TUYA-account, the following error keeps appearing every few seconds in the Domoticz log:

Code: Select all

TUYA: handleThread: string indices must be integers
Any ideas what might cause this error? I already pulled the latest version from github and updated the TinyTUYA pip to the latest version.
User avatar
Xenomes
Posts: 385
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

that is strange, can you enable debug. the same line will show but there will be a line number.
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
HatsekieD
Posts: 3
Joined: Friday 26 January 2018 10:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by HatsekieD »

Xenomes wrote: Thursday 01 December 2022 22:08 that is strange, can you enable debug. the same line will show but there will be a line number.
The line number is 266. That is a debug line, but if I comment out that line the same error appears on line 267. Looks like

Code: Select all

dev['id']
might be the culprit.

Maybe the root of the problem is that my only TUYA-device (a pet feeder) might not yet be supported by the plugin... :-)
User avatar
Xenomes
Posts: 385
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

OK, then I need to put in a check if there are usable devices found to run the script with.
Can you also create a dump.json with debug_discovery.py from the tools directory? (edit/run with python)
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
HatsekieD
Posts: 3
Joined: Friday 26 January 2018 10:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by HatsekieD »

Xenomes wrote: Thursday 01 December 2022 23:03 OK, then I need to put in a check if there are usable devices found to run the script with.
Can you also create a dump.json with debug_discovery.py from the tools directory? (edit/run with python)
I sent you a PM for the further handling of this issue, no need to pollute this forum thread :-)
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by kalinkamaen »

kalinkamaen wrote: Thursday 01 December 2022 8:27
Xenomes wrote: Thursday 01 December 2022 6:14 Did you check if you have the correct data center?
iot.tuya.com => cloud => your project => overview=> edit => Data Centre
For Europe you can also try to use 'Central Europe data center' that is the one in my account.
Yes mine is Western Europe. But i am no able to change it due to only chang once per 30 days.
I think I nee to change to Mainland China. Sorry to be so negative here. But TUYA sucks. :lol:
Changed data center to central Europe. Problem fixed
Windows 10, Domoticz 14784
User avatar
Xenomes
Posts: 385
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

kalinkamaen wrote: Monday 05 December 2022 19:21 Changed data center to central Europe. Problem fixed
Fantastic! Thanks for reporting back.
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
hansaplast31
Posts: 31
Joined: Sunday 03 January 2016 0:32
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by hansaplast31 »

Hy Xenomes,

After using the 'Old' tuya domoticz plugin not finding any devices, I switched to the newer one with tinytuya integration. finally it finds my device, a wifi heater. unfortunately the control is only an on/off button and that doesn't do much. this heater is also the device id I specified in the hardware plugin settings in domoticz.

the debug_discovery.py in tools shows this:
Status of device: 38610185a4e57c130b92
{'result': [{'code': 'switch', 'value': False}, {'code': 'temp_set', 'value': 21}, {'code': 'temp_current', 'value': 18}, {'code': 'level', 'value': '2'}, {'code': 'lock', 'value': False}, {'code': 'light', 'value': True}, {'code': 'countdown_set', 'value': 'cancel'}], 'success': True, 't': 1670323853283, 'tid': 'dad5710a755311edb07c7eb35c0e5cc5'}

via iot.tuya.com i can control the device.


edit: ah i see now, the plugin doesn't appear to have code to handle this device type.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest