Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Python and python framework

Moderator: leecollings

dgilbert2
Posts: 84
Joined: Wednesday 16 August 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: UK
Contact:

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

Post by dgilbert2 »

hansaplast31 wrote: Tuesday 06 December 2022 11:55 .....edit: ah i see now, the plugin doesn't appear to have code to handle this device type.
Out of curiosity, what "category" is your device as reported by debug_discovery.py?
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 »

Actually i got it to work, i found in another post that there is a 'Heater' branch. and that works.

here is my debug_discovery , i got a second device today, an IR panel heater.

[{'name': 'Maclean Panel Heater', 'id': 'bf4fa061224d828c323i15', 'key': 'Deleted', 'mac': 'a0:92:08:56:58:46', 'category': 'qn', 'product_name': 'Maclean Panel Heater', 'product_id': 'y2iok2atjmdq1qes', 'biz_type': 0, 'model': 'MCE513', 'sub': False, 'icon': 'https://images.tuyaeu.com/smart/icon/ba ... edfd30.png', 'uuid': '2d82eaa5c45b2329'}, {'name': 'Guest room heater', 'id': '38610185a4e57c130b92', 'key': 'Deleted', 'mac': 'a4:e5:7c:13:0b:92', 'category': 'qn', 'product_name': '达沃斯/GPH-DA', 'product_id': 'gdxxobacdlckd0ye', 'biz_type': 0, 'model': '达沃斯/GPH-DA', 'sub': False, 'icon': 'https://images.tuyaeu.com/smart/icon/ay ... 617fbb.png', 'uuid': '38610185a4e57c130b92'}]

Functions of device: bf4fa061224d828c323i15
{'result': {'category': 'qn', 'functions': [{'code': 'switch', 'desc': 'switch', 'name': 'switch', 'type': 'Boolean', 'values': '{}'}, {'code': 'temp_set', 'desc': 'temp set', 'name': 'temp set', 'type': 'Integer', 'values': '{"unit":"℃","min":0,"max":37,"scale":0,"step":1}'}]}, 'success': True, 't': 1670347853432, 'tid': 'bc0a8b31758b11eda09b6a4d827822b5'}

Status of device: bf4fa061224d828c323i15
{'result': [{'code': 'switch', 'value': False}, {'code': 'temp_set', 'value': 37}, {'code': 'temp_current', 'value': 19}], 'success': True, 't': 1670347853632, 'tid': 'bc2735b7758b11edaf73e6e6f70199dc'}

Functions of device: 38610185a4e57c130b92
{'result': {'category': 'qn', 'functions': [{'code': 'switch', 'desc': 'switch', 'name': 'switch', 'type': 'Boolean', 'values': '{}'}, {'code': 'temp_set', 'desc': 'temp set', 'name': 'temp set', 'type': 'Integer', 'values': '{"unit":"℃","min":5,"max":50,"scale":0,"step":1}'}, {'code': 'level', 'desc': 'level', 'name': 'level', 'type': 'Enum', 'values': '{"range":["1","2","3"]}'}, {'code': 'lock', 'desc': 'lock', 'name': 'lock', 'type': 'Boolean', 'values': '{}'}, {'code': 'light', 'desc': 'light', 'name': 'light', 'type': 'Boolean', 'values': '{}'}, {'code': 'countdown_set', 'desc': 'countdown set', 'name': 'countdown set', 'type': 'Enum', 'values': '{"range":["cancel","1h","2h","3h","4h","5h","6h"]}'}]}, 'success': True, 't': 1670347853852, 'tid': 'bc47aa12758b11eda09b6a4d827822b5'}

Status of device: 38610185a4e57c130b92
{'result': [{'code': 'switch', 'value': False}, {'code': 'temp_set', 'value': 21}, {'code': 'temp_current', 'value': 15}, {'code': 'level', 'value': '2'}, {'code': 'lock', 'value': False}, {'code': 'light', 'value': True}, {'code': 'countdown_set', 'value': 'cancel'}], 'success': True, 't': 1670347854109, 'tid': 'bc706697758b11edaf73e6e6f70199dc'}
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 »

Why do I get this error al the time?
Spoiler: show
2022-12-09 08:44:14.009 Status: TinyTuya: Stopping threads.
2022-12-09 08:44:14.009 Status: TinyTuya: Stopped.
2022-12-09 08:44:14.009 Status: TinyTuya: Started.
2022-12-09 08:44:14.009 Status: TinyTuya: Entering work loop.
2022-12-09 08:44:14.393 Status: TinyTuya: Initialized version 1.0.0, author 'Xenomes'
2022-12-09 08:44:16.680 TinyTuya: Device name=BMW dør id=700030363c610589207f
2022-12-09 08:44:17.545 TinyTuya: Create devices
2022-12-09 08:44:18.400 TinyTuya: Update devices in Domoticz
2022-12-09 08:44:18.400 TinyTuya: <class 'str'>
2022-12-09 08:44:18.400 TinyTuya: Update device value:700030363c610589207f Unit: 1 sValue: Off nValue: 0 TimedOut=1
2022-12-09 08:44:18.400 TinyTuya: Device name=garasje gateway id=bf11d6e7f8daad7f1asyim
2022-12-09 08:44:19.256 TinyTuya: Create devices
2022-12-09 08:44:19.632 TinyTuya: Update devices in Domoticz
2022-12-09 08:44:19.864 TinyTuya: StatusDeviceTuya caled switch_1 not found
2022-12-09 08:44:20.096 TinyTuya: StatusDeviceTuya caled switch_led not found
2022-12-09 08:44:20.320 TinyTuya: StatusDeviceTuya caled work_mode not found
2022-12-09 08:44:20.320 TinyTuya: Device name=2etg trapp id=bfe288f5e5ee2444b1bomr
2022-12-09 08:44:21.514 TinyTuya: Create devices
2022-12-09 08:44:21.522 TinyTuya: handleThread: Device not found! Removed? line 316
2022-12-09 08:44:21.522 Error: TinyTuya: handleThread: Device not found! Removed?
Windows 10, Domoticz 14784
User avatar
Xenomes
Posts: 379
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: Friday 09 December 2022 8:46 Why do I get this error al the time?

Code: Select all

2022-12-09 08:44:21.522 [u][b]Error: TinyTuya: handleThread: Device not found! Removed?
Because made a mistake in the script if a device in not recognized. I have fixed in the newer code but not ready to make it public.
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 »

[/quote]
Because made a mistake in the script if a device in not recognized. I have fixed in the newer code but not ready to make it public.
[/quote]

Oki, thankyou for quick reply. Will wait for update
Windows 10, Domoticz 14784
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 »

Will this plugin make me recieve info from a TUYA hardware scene switch and be able to control other hardware in domoticz?
Sorry if explaination is bad. But old plugin can not do this.
Windows 10, Domoticz 14784
garycooper
Posts: 21
Joined: Sunday 10 March 2019 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by garycooper »

Hi, I tried the plugin and I've got several problems :
1- I've got several smart power strip but I can't command each switch but only the principal one.
2- I've got 2 RJ-Dimmer switch but they don't appears on Domoticz (handleThread: Device not found! Device removed or Accept New Hardware not active?)
3 I've got a heater (dry towel) and there is only switch which is created (not temperature or consign). Then, when I activate it "on" or "off", there is no error on the logs but it don't stop or put on the dry towel.
When I'm using previous plugin, all is ok, except the dry towel (doesn't created on domoticz).
Thanks
User avatar
Xenomes
Posts: 379
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 »

garycooper wrote: Tuesday 13 December 2022 20:58 1- I've got several smart power strip but I can't command each switch but only the principal one.
There is a small bug in the current release, in the newer version it is fixed.
garycooper wrote: 2- I've got 2 RJ-Dimmer switch but they don't appears on Domoticz (handleThread: Device not found! Device removed or Accept New Hardware not active?)
We are adding devices to the plugin at the moment, can you provide the dump.json by PM? You can create it by edit and running the debug_discovery.py with python3.
garycooper wrote: 3 I've got a heater (dry towel) and there is only switch which is created (not temperature or consign). Then, when I activate it "on" or "off", there is no error on the logs but it don't stop or put on the dry towel.
We are almost there to release a newer version that support more devices.
garycooper wrote: When I'm using previous plugin, all is ok, except the dry towel (doesn't created on domoticz).
That approach didn't work with this design of the plugin.
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
aurelihein
Posts: 2
Joined: Wednesday 18 April 2018 16:53
Target OS: Linux
Domoticz version: 2022.2
Contact:

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

Post by aurelihein »

Hello,
It does not seem to work with dimmer dump :

Code: Select all

List of devices: 
[
  {
    "name": "Gradation",
    "id": "XXXXXXXXXXXXXX",
    "key": "Deleted",
    "mac": "cc:8c:bf:b4:9a:7c",
    "category": "tgq",
    "product_name": "Dimmer",
    "product_id": "XXXXXXXXXXXX",
    "biz_type": 18,
    "model": "1\u8def\u8c03\u5149\u6a21\u5757 1051\u8def\u8c03\u5149",
    "sub": false,
    "icon": "https://images.tuyaeu.com/smart/icon/ay15327721968035jwx9/158754167737006edd612.jpg",
    "uuid": "XXXXXXXXXXXXXX"
  }
]
Functions of device: XXXXXXXXXX
{
  "result": {
    "category": "tgq",
    "functions": [
      {
        "code": "switch_led_1",
        "desc": "switch led 1",
        "name": "switch led 1",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "bright_value_1",
        "desc": "bright value 1",
        "name": "bright value 1",
        "type": "Integer",
        "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "brightness_min_1",
        "desc": "brightness min 1",
        "name": "brightness min 1",
        "type": "Integer",
        "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "led_type_1",
        "desc": "led type 1",
        "name": "led type 1",
        "type": "Enum",
        "values": "{\"range\":[\"incandescent\",\"halogen\"]}"
      }
    ]
  },
  "success": true,
  "t": 1671127574813,
  "tid": "XXXXXXXXXXXX"
}
Status of device: XXXXXXXXXXXXX
{
  "result": [
    {
      "code": "switch_led_1",
      "value": false
    },
    {
      "code": "bright_value_1",
      "value": 700
    },
    {
      "code": "brightness_min_1",
      "value": 10
    },
    {
      "code": "led_type_1",
      "value": "LED"
    }
  ],
  "success": true,
  "t": 1671127575172,
  "tid": "XXXXXXXXXX"
}
User avatar
Xenomes
Posts: 379
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 »

Thanks for the dump of the dimmer, it the first data set of a dimmer i will check it out. I let you know!
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
aurelihein
Posts: 2
Joined: Wednesday 18 April 2018 16:53
Target OS: Linux
Domoticz version: 2022.2
Contact:

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

Post by aurelihein »

Hello again,
You have a pending Pull Request in github that adds support to dimmer
Best regards,
Aurelien BOUIN
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: Sunday 11 December 2022 21:15 Will this plugin make me recieve info from a TUYA hardware scene switch and be able to control other hardware in domoticz?
Sorry if explaination is bad. But old plugin can not do this.
Answear to my own stupid question. :)
I have bought a Conbee II stick and can now control my tuya scene switch in domoticz.
Windows 10, Domoticz 14784
User avatar
Xenomes
Posts: 379
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 »

aurelihein wrote: Thursday 15 December 2022 20:41 Hello,
It does not seem to work with dimmer dump :
...
I should work with the current version.
Last edited by Xenomes on Thursday 22 December 2022 15:10, edited 1 time 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: 379
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 »

aurelihein wrote: Thursday 15 December 2022 22:05 Hello again,
You have a pending Pull Request in github that adds support to dimmer
Best regards,
Aurelien BOUIN
Thanks for the code, I used and improved it!
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: 379
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 »

aurelihein wrote: Thursday 15 December 2022 20:41 Hello,
It does not seem to work with dimmer dump :
...
In the develop 1.2.6 the dimmer is fixed.
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
Robertorava
Posts: 2
Joined: Wednesday 28 December 2022 22:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Robertorava »

hi, I read the readme but when I add a device I get this error in the log

Error: Smart Plug 3 tv: File "/home/roberto/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin/plugin.", line 73, in <module>
Error: Smart Plug 3 tv: import tinytuya
Error: Smart Plug 3 tv: ModuleNotFoundError: No module named 'tinytuya'

tinytuya wizzard and scan works fine, can you help me what I missed about the import module section?
User avatar
Xenomes
Posts: 379
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 »


Robertorava wrote:Error: Smart Plug 3 tv: ModuleNotFoundError: No module named 'tinytuya'
Tinytuya is missing try to install with sudo.

Verstuurd vanaf mijn SM-A536B met Tapatalk

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
Robertorava
Posts: 2
Joined: Wednesday 28 December 2022 22:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Robertorava »

Xenomes wrote: Wednesday 28 December 2022 23:02
Robertorava wrote:Error: Smart Plug 3 tv: ModuleNotFoundError: No module named 'tinytuya'
Tinytuya is missing try to install with sudo.

Verstuurd vanaf mijn SM-A536B met Tapatalk
yes, that did the trick
I used a raspberry for the tinytuya part and then used that information for the SmartPlug-Plugin i installed in a synology docker domoticz.
i'm really happy with it! thank you verry much
Perhaps you could remove in the readme under 'installation' the part "pip3 show pytuya #show pytuya path
ln -s ~[pytuya path]/pytuya pytuya"?

Just a thought but would it possible to make an option to import the data history from a device from the tuya cloud so you don't start from scratch with the monitoring?
User avatar
Xenomes
Posts: 379
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 »

Robertorava wrote: Thursday 29 December 2022 19:55 Perhaps you could remove in the readme under 'installation' the part "pip3 show pytuya #show pytuya path
ln -s ~[pytuya path]/pytuya pytuya"?
Where do you see that?
Robertorava wrote: Thursday 29 December 2022 19:55 Just a thought but would it possible to make an option to import the data history from a device from the tuya cloud so you don't start from scratch with the monitoring?
You can replace your old device with the new create one, like the normal procedure. See https://domoticz.com/wiki/Managing_Devi ... ace_device
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
Varazir
Posts: 360
Joined: Friday 20 February 2015 22:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

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

Post by Varazir »

Hello , thanks great support adding new functions.

I was using a older(EOL) plugin and I keep getting this in the log. I understand why but how to I "remove" the old device?
I tried to just delete it from the device list but it didn't help.

Code: Select all

2023-01-27 14:03:55.985 Error: TinyTUYA: (TinyTUYA) Unit creation failed, Hardware/DeviceID/Unit combination (13/43035720e098061d58bc/1) already exists in Domoticz.
Raspberry PI 2 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 0 guests