leeyuentuen / localtuya

local handling for Tuya devices
GNU General Public License v3.0
72 stars 17 forks source link

Please consider adding support Protocol 3.4 #35

Open xia0linz1 opened 1 year ago

xia0linz1 commented 1 year ago

Rospogrigio/localtuya has released their version 5.0.0 which added support Protocol 3.4. Please consider merging the branch to support the tuya latest HW firmware.

leeyuentuen commented 1 year ago

i've release a beta version with this protocol

there is some changes for me on the response of the data:

A temperature sensor was:

 - parent_gateway: bf5c95cfe466ad6cdxxxx
     device_id: a4c138e91c10a5e6
     friendly_name: "Local tmp Sensor"
     entities:
      - platform: sensor
        friendly_name: Local tmp Humidity
        id: 101
        device_class: humidity
        scaling: 0.01
        unit_of_measurement: "%"
      - platform: sensor
        friendly_name: Local tmp Battery
        id: 102
        device_class: battery
        unit_of_measurement: "%"
      - platform: sensor
        friendly_name: Local tmp Temperature
        id: 103
        scaling: 0.01
        device_class: temperature
        unit_of_measurement: "°C"

but on this protocol 3.4, it has been changed to:

   - parent_gateway: bf5c95cfe466ad6cdxxxx
     device_id: a4c138e91c10a5e6
     friendly_name: "Local tmp Sensor"
     entities:
      - platform: sensor
        friendly_name: Local tmp Humidity
        id: 2
        device_class: humidity
        scaling: 0.1
        unit_of_measurement: "%"
      - platform: sensor
        friendly_name: Local tmp Battery
        id: 4
        device_class: battery
        unit_of_measurement: "%"
      - platform: sensor
        friendly_name: Local tmp Temperature
        id: 1
        scaling: 0.1
        device_class: temperature
        unit_of_measurement: "°C"

The yaml to add gateway with protocol 3.4 is this:

   - host: 172.16.0.xx
     device_id: bf5c95cfe466ad6cdxxxx
     local_key: fdb94bffb6844dee
     friendly_name: "gateway 2"
     protocol_version: "3.4"
     is_gateway: true
teixeluis commented 1 year ago

Hi, not sure if it's because this is still not mature enough, but was able to add the Bluetooth gateway just fine (one identified as something like "NH-YM Bluetooth mesh gateway" and "CR3L Bluetooth gateway, support 128 sub-devices"), but when adding a Lockbox L1 as a Bluetooth subdevice, it fails with the same Timeout error as reported in #29.

Anything that can be done to workaround this, for the time being?

Thanks

alexualbu commented 1 year ago

@xia0linz1, could you give 3.7.0 beta8 a spin?

xia0linz1 commented 1 year ago

@xia0linz1, could you give 3.7.0 beta8 a spin?

It was able to add the Zigbee gateway but no entities had been added, but when adding the Zigbee subdevice it failed. The system log is as follows

Logger: custom_components.localtuya.config_flow
Source: custom_components/localtuya/config_flow.py:276
Integration: LocalTuya integration ([documentation](https://github.com/leeyuentuen/localtuya/), [issues](https://github.com/leeyuentuen/localtuya/issues))
First occurred: 22:10:40 (1 occurrences)
Last logged: 22:10:40

Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/localtuya/config_flow.py", line 457, in async_step_basic_sub_device_info
    self.dps_strings = await validate_input(self.hass, user_input)
  File "/config/custom_components/localtuya/config_flow.py", line 276, in validate_input
    if data.get(CONF_PARENT_GATEWAY):
AttributeError: 'str' object has no attribute 'get'
Logger: homeassistant
Source: custom_components/localtuya/pytuya/__init__.py:378
Integration: LocalTuya integration ([documentation](https://github.com/leeyuentuen/localtuya/), [issues](https://github.com/leeyuentuen/localtuya/issues))
First occurred: 22:05:32 (25 occurrences)
Last logged: 22:11:32

Error doing job: Fatal error: protocol.data_received() call failed.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 876, in _read_ready__data_received
    self._protocol.data_received(data)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 752, in data_received
    self.dispatcher.add_data(data)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 544, in add_data
    msg = unpack_message(
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 378, in unpack_message
    raise DecodeError("Not enough data to unpack header")
custom_components.localtuya.pytuya.DecodeError: Not enough data to unpack header
alexualbu commented 1 year ago

@xia0linz1 - could you please pass on the full debug log?

xia0linz1 commented 1 year ago

@xia0linz1 - could you please pass on the full debug log?

Here is the debug log when I trying to add the Zigbee gateway.

It‘s weird that the debug log shows my Zigbee gateway is using protocol version 3.3 ! 2023-04-24 15:14:27.528 DEBUG (MainThread) [custom_components.localtuya.discovery] Discovered device: {'ip': '192.168.1.67', 'gwId': 'GATEWAY_DEVICE_ID_HERE', 'active': 2, 'ablilty': 0, 'encrypt': True, 'productKey': 'keym557nqw3p8p7m', 'version': '3.3', 'lan_cap': 500, 'lan_seq': 29}

I think i should rollback my localtuya to version 3.6 or rospogrigio/localtuya to figure out which version the GateWay actually use. Or maybe there is a better way to figure it out?

alexualbu commented 1 year ago

@xia0linz1 , yes indeed, it looks like the gw is version 3.3 - that seems obvious from the logs as well as it cannot negotiate the 3.4 session key. have you tried protocol 3.3 in either 3.6.6 or 3.7.0 beta ?

xia0linz1 commented 1 year ago

@xia0linz1 , yes indeed, it looks like the gw is version 3.3 - that seems obvious from the logs as well as it cannot negotiate the 3.4 session key. have you tried protocol 3.3 in either 3.6.6 or 3.7.0 beta ?

I update my GW and make sure it's 3.4 now. And I also find out that all the strange error is caused by using sub-device ID but node-id as CID, sorry. For now, the 3.4 gateway and 3.4 Wi-Fi device works fine in 3.7.10 beta. The sub-device can be added correctly but not function correctly. I think it's because the "Thermostat Valve"(as climate) is not supported.

alexualbu commented 1 year ago

Great news @xia0linz1! You're probably right about the TRVs - first of all they don't really have an on/off state and the climate component kind of relies on that. I ended up setting up various dps as entities and not using the target temperature at all - mine (and probably your too) have the option to set the valve as open or closed and I set up automations to do that based on temperature sensors and input-numbers as target temperature.

xia0linz1 commented 1 year ago

Great news @xia0linz1! You're probably right about the TRVs - first of all they don't really have an on/off state and the climate component kind of relies on that. I ended up setting up various dps as entities and not using the target temperature at all - mine (and probably your too) have the option to set the valve as open or closed and I set up automations to do that based on temperature sensors and input-numbers as target temperature.

Great idea! Maybe I should add the TRV as a switch to control its target temperature, and let the Node-Red to do the rest. I'll try it soon. Thanks for the help!

goodsale commented 1 year ago

Hi, for a beginner....is the following code to put in configuration.yaml correct?

I would like to try this integration with a Moes 3.4 protocol zigbee hub with a series of switches (15) always Moes

how do you find the "ID" of connected devices?

Thank you!

   - host: 172.16.0.xx
     device_id: bf5c95cfe466ad6cdxxxx
     local_key: fdb94bffb6844dee
     friendly_name: "gateway 1"
     protocol_version: "3.4"
     is_gateway: true
     entities:
      - platform: switch
        friendly_name: switch1
        id: 1
........
........
........
zeduperes commented 1 year ago
alexualbu commented 1 year ago

@zeduperes , you can try out 3.7.0 beta 10 which works with 3.4 devices. @goodsale, i suggest you use the UI for setting up the devices. First you setup the gateway, then the sub-devices. For the sub-devices you get the cid/node_id which you use as device_id from the tuya developer console: image

goodsale commented 1 year ago

@alexualbu

Thanks so much for the support Inserted the HUB and recalled the integration to add a sub-device it seems to work.

After inserting the sub device correctly detected via the "node_id" parameters are requested including an "ID"

After configuration though none of the switches seem to work.

Some simple switches remain either always on or always off and do not drive the devices.

Dimmers are detected with brightness control but don't work, same thing for sensors.

I do not understand why.

Perhaps the integration is not yet ready for this management?

alexualbu commented 1 year ago

@goodsale, I'd need a bit more information to understand what the issue is - can you describe the steps you take, what happens and add the debug logs?

goodsale commented 1 year ago

@alexualbu

1) from Hacs after downloading localtuya beta 3.70 beta 10 integration and restarting, I add local tuya integration and add my HUB Zigbee lan Moes with device ID, local-key and host (ip of my Hub). I define the entity as "hub"

2) repeat the operation and add the first sub device a simple Moes switch (on/off) here I use the node_id key retrieved from IOT TUYA of the device.

it seems to work because the data points are found as show in the mask below.

I tried to create the configuration with all 3 IDs (1,9,27) shown but the created switch is not responding...

My hub zigbee is a wired lan hub (no Wifi).

maschera HA

alexualbu commented 1 year ago

@goodsale , thanks - can you please also provide the debug logs? when you say the switch is not responding, do you mean you can't turn it off or on? if you change the state from Smart Life does it update?

goodsale commented 1 year ago

@alexualbu

Yes! now the entity created with localtuya updates status! but don't turn on or off (don't start command), I use tuya official integration in Homeassiatant that work fine.

Following the instructions, I also tried managing the integration via configuration.yaml but the result is the same. The entities are created but the switch is not driven.

zblan4 zblan1 zblan2 zblan3


localtuya:    
  - host: 192.168.x.yyy
    device_id: bfc2902a861234567890
    local_key: xxxxxxxxxxxxxxxxxxx
    friendly_name: LanZigbee
    protocol_version: "3.4"
    is_gateway: true 

  # Devices under a gateway

  - parent_gateway: bfc2902a861234567890 # same as device ID of the hub
    device_id: yyyyyyyyyyyyy  # The cid of sub-device from Tuya iot
    friendly_name: switch_hub_lan
    entities:
      - platform: switch
        friendly_name: lancucina
        id: 1 # is this 1 or 9 or 27 or ....????
goodsale commented 1 year ago

@alexualbu

This is my log.

Here you can see a correct state update of the entity occurred with an external turn on /turn off and command sent by HA that do not work

2023-05-20 08:56:00.800 DEBUG (MainThread) [custom_components.localtuya] Device hubzigbeeIDxxxxxxxxxxx found with IP 192.168.X.XXX
2023-05-20 08:56:05.800 DEBUG (MainThread) [custom_components.localtuya] Device hubzigbeeIDxxxxxxxxxxx found with IP 192.168.X.XXX
2023-05-20 08:56:06.290 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching message CMD 8 TuyaMessage(seqno=12457, cmd=8, retcode=0, payload=b'W\xa4\x81\xf9\xe4:z\xd1\xbeu\x83\xf2HSV\xd6\xd4s\xd2\x1eh\x0e\xa8h/\xa5N\xaf\xa9\xa2R\xc1\xc5C\xbb\xba\x03w\xe4\xbd$M\xe9\x12w\x87?\x1b\xc2\x04\xe0\xa3\xf9a\xf5\xb1\xd9\xe1j\xb6\xfdU\xdb\xc5B\x8a\xee\xb7\x98\xe0\xbe\x8d\xd0I\xacA\xc7\xab\x1e\xea\xc14m\xbf\r@\x06\x16E\xe7M\xec\x10K\xe5Z', crc=b'\xe4\xe9\xf668n\x1e#k\xf2;=R\xd9\xbd\xf1/;4\xe5\xc9L+n$\xa2\rw\xc3\xcc\xde\r', crc_good=True)
2023-05-20 08:56:06.290 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Got status update
2023-05-20 08:56:06.291 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Deciphered data = '{"protocol":4,"t":1684565768,"data":{"dps":{"1":true},"cid":"nodeIDsubdevice"}}'
2023-05-20 08:56:06.291 DEBUG (MainThread) [custom_components.localtuya.common] [hub...xxx] Dispatching event event_status_updated to sub-device nodeIDsubdevice with data {'1': True, '9': 0, '27': 'off'}
2023-05-20 08:56:06.293 DEBUG (SyncWorker_4) [custom_components.localtuya.common] [dc8...cec] Received event event_status_updated from gateway with data {'1': True, '9': 0, '27': 'off'}
2023-05-20 08:56:09.153 DEBUG (MainThread) [custom_components.localtuya.common] [dc8...cec] Dispatching request request_set_dp to gateway with content {'value': False, 'dp_index': 1}
2023-05-20 08:56:09.154 DEBUG (MainThread) [custom_components.localtuya.common] [hub...xxx] Received request request_set_dp from nodeIDsubdevice with content {'value': False, 'dp_index': 1}
2023-05-20 08:56:09.155 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Sending command 7 (device type: v3.4)
2023-05-20 08:56:09.155 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Sending payload: b'{"protocol":5,"t":1684565769,"data":{"dps":{"1":false}},"cid":"nodeIDsubdevice"}'
2023-05-20 08:56:09.156 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] final payload for cmd 13: b'3.4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00{"protocol":5,"t":1684565769,"data":{"dps":{"1":false}},"cid":"nodeIDsubdevice"}'
2023-05-20 08:56:09.160 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching sequence number 12458
2023-05-20 08:56:09.160 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] payload b'\x00\x00U\xaa\x00\x000\xaa\x00\x00\x00\r\x00\x00\x00\x94\x95O\xfa\xd4\xaeh\x1b\xcdZ\xc8l\x0c\x19\x13M\xa8\xe7\x9eB\x19D\xc2\xca\xff\x87K\xcd\x84\xc4\x90KE\x80\x08\x80\xd0\xa5\xbeh\x051f(s\xf4\xc3\xc7\x9dji\x03\xa6Fx\xe4\x0c\x16\xee\xf9\x00\xb7b\xca\xa33i\xc3\xe6\x0f\xb1\xf7\x97\xf8\xcf\x07\x00zo\x12}\x90^o8\xdb\xb7\xe8\x86\n~cbe\xb5\x07ww\xfbV\x05\x10\xb1 \xd6\x8b\xe1tk\x94\x80{\xd4P=N\xd6\x1d\xc1\x0c+\x97\x82\xdc\xa9?1\x91\xa8\xa7b\xf0\xbc\x04\xab\xceg\x13\x101\xe6\xa5\xda,\xa0\x00\x00\xaaU' - MessagePayload(cmd=13, payload=b'{"protocol":5,"t":1684565769,"data":{"dps":{"1":false}},"cid":"nodeIDsubdevice"}')
2023-05-20 08:56:09.161 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Command 13 waiting for sequence number 12458
2023-05-20 08:56:09.168 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching message CMD 13 TuyaMessage(seqno=12458, cmd=13, retcode=0, payload=b'', crc=b'\x00\xeayd*;{S5\xae\xf0/\xf94O\xd2\x17\xa0\xedl\xf6\xd0t\xc6\xdb\x02X\xc9\x93L}\x97', crc_good=True)
2023-05-20 08:56:09.169 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching sequence number 12458
2023-05-20 08:56:09.169 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] ACK received for command 13: ignoring it
2023-05-20 08:56:09.814 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Sending command 9 (device type: v3.4)
2023-05-20 08:56:09.814 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Sending payload: b'{"gwId":"hubzigbeeIDxxxxxxxxxxx","devId":"hubzigbeeIDxxxxxxxxxxx"}'
2023-05-20 08:56:09.814 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] final payload for cmd 9: b'{"gwId":"hubzigbeeIDxxxxxxxxxxx","devId":"hubzigbeeIDxxxxxxxxxxx"}'
2023-05-20 08:56:09.815 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching sequence number -100
2023-05-20 08:56:09.816 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] payload b"\x00\x00U\xaa\x00\x000\xab\x00\x00\x00\t\x00\x00\x00t\xf8\x8b\x07]\xc2\x8f\x14;\x11\xd6\xc5\xea_WH2\xb6\x8a\xd6\xdc\xf6\x9f\x81\x81 =\xc6g*5\xb4\xcd\xabk\x93\x94\xe2\xa6\xee\x92\xfaN\xadw\xfb\xbaL\xab\xae\xeb\x88\x9e\x81\xca\x89x\x82\xc0;\x92\x04\xe3\r\x0e\xa3\x01\xca\xb9\x9a\xc3\x9e2\x018\x9b?\xa4\xa3\xe0\x0f\xfb_'0\xe2\xf7\xcd\r\xf6\xce\xe9\xc0\xa5P\xbf\x8aoV\x805\xa5(y2\xa3\r\x91\xde\x0f\x9f\xb92\x00\x00\xaaU" - MessagePayload(cmd=9, payload=b'{"gwId":"hubzigbeeIDxxxxxxxxxxx","devId":"hubzigbeeIDxxxxxxxxxxx"}')
2023-05-20 08:56:09.819 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Command 9 waiting for sequence number -100
2023-05-20 08:56:09.821 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching message CMD 9 TuyaMessage(seqno=12459, cmd=9, retcode=0, payload=b'', crc=b'\xbbT,\x9b\xc2\x0b\xdd\xb1\x8e\xe9\xf6\xabF.\xc6fb\x8e\x9a\x98\x99\xae\xba\xf2S\xbd\xfa\xad+\xb6\xcfu', crc_good=True)
2023-05-20 08:56:09.822 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Got heartbeat response
2023-05-20 08:56:09.823 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] ACK received for command 9: ignoring it
2023-05-20 08:56:10.813 DEBUG (MainThread) [custom_components.localtuya] Device hubzigbeeIDxxxxxxxxxxx found with IP 192.168.X.XXX
2023-05-20 08:56:14.617 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching message CMD 8 TuyaMessage(seqno=12460, cmd=8, retcode=0, payload=b"+\x0f\x1eTp\xf0|\xa7\x83\x8a\xd4q\x02_u\xad\xd4s\xd2\x1eh\x0e\xa8h/\xa5N\xaf\xa9\xa2R\xc1\xc5\x1b'$\xd1\x98\x7f\xab~\x13\x85:G\x07riji\x03\xa6Fx\xe4\x0c\x16\xee\xf9\x00\xb7b\xca\xa3i:#>O\x94\xba\xe8rT\xb7\x91r\xa63\xd8\nl\xddg\xef\x1f\x11\x97\x92\xbc\xe7*cZ!\xe7w\xfbV\x05\x10\xb1 \xd6\x8b\xe1tk\x94\x80{\xd4", crc=b'\xa0\xd6\x99&\x94\xe9R\x04\xbc\xf9\x19a\x9c\xc97klz\xed?\xab\xdbK\x1d\x91L>U\xdd\x1e\xa4\x8c', crc_good=True)
2023-05-20 08:56:14.618 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Got status update
2023-05-20 08:56:14.620 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Deciphered data = '{"protocol":4,"t":1684565776,"data":{"dps":{"1":false},"cid":"nodeIDsubdevice"}}'
2023-05-20 08:56:14.621 DEBUG (MainThread) [custom_components.localtuya.common] [hub...xxx] Dispatching event event_status_updated to sub-device nodeIDsubdevice with data {'1': False, '9': 0, '27': 'off'}
2023-05-20 08:56:14.622 DEBUG (SyncWorker_3) [custom_components.localtuya.common] [dc8...cec] Received event event_status_updated from gateway with data {'1': False, '9': 0, '27': 'off'}
2023-05-20 08:56:15.686 DEBUG (MainThread) [custom_components.localtuya.common] [dc8...cec] Dispatching request request_set_dp to gateway with content {'value': True, 'dp_index': 1}
2023-05-20 08:56:15.686 DEBUG (MainThread) [custom_components.localtuya.common] [hub...xxx] Received request request_set_dp from nodeIDsubdevice with content {'value': True, 'dp_index': 1}
2023-05-20 08:56:15.686 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Sending command 7 (device type: v3.4)
2023-05-20 08:56:15.686 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Sending payload: b'{"protocol":5,"t":1684565775,"data":{"dps":{"1":true}},"cid":"nodeIDsubdevice"}'
2023-05-20 08:56:15.686 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] final payload for cmd 13: b'3.4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00{"protocol":5,"t":1684565775,"data":{"dps":{"1":true}},"cid":"nodeIDsubdevice"}'
2023-05-20 08:56:15.687 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching sequence number 12461
2023-05-20 08:56:15.688 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] payload b'\x00\x00U\xaa\x00\x000\xad\x00\x00\x00\r\x00\x00\x00\x84\x95O\xfa\xd4\xaeh\x1b\xcdZ\xc8l\x0c\x19\x13M\xa8\xe7\x9eB\x19D\xc2\xca\xff\x87K\xcd\x84\xc4\x90KE?B\xd0\xaaL\x07\x1a\xe1\x98T\xf0Nn\x01\xfb\xca\xc2\x04\xe0\xa3\xf9a\xf5\xb1\xd9\xe1j\xb6\xfdU\xdb\xc5\xf2\x83\x15\xf3\x15Q\x0c\x19qC\xb8\xe1\xa3U\xe7\xa5\xcd\x17\x86Z\x87\xc8\xd1in\x17\x1f\x8e\xf4\x93\x90\xef\t\xdf\xa2\xe0\x1eI]dR\xe4EFo|\r\xe9o\xe2\x11\x13\xa3\x11\rO\x94\xa9\x08\xc5\xe5P\x80\x8f\x00\x00\xaaU' - MessagePayload(cmd=13, payload=b'{"protocol":5,"t":1684565775,"data":{"dps":{"1":true}},"cid":"nodeIDsubdevice"}')
2023-05-20 08:56:15.688 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Command 13 waiting for sequence number 12461
2023-05-20 08:56:15.695 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching message CMD 13 TuyaMessage(seqno=12461, cmd=13, retcode=0, payload=b'', crc=b'\xfc\t\xa7\x18\xf9\x94\x99\x1e\xea\xe3d\x96\xdc\x95\xf9\xeb\xacIll+\xfe\x862\xd9\x1e:\xe6\xf8\xb6\xadu', crc_good=True)
2023-05-20 08:56:15.695 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching sequence number 12461
2023-05-20 08:56:15.696 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] ACK received for command 13: ignoring it
2023-05-20 08:56:15.810 DEBUG (MainThread) [custom_components.localtuya] Device hubzigbeeIDxxxxxxxxxxx found with IP 192.168.X.XXX
2023-05-20 08:56:19.834 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Sending command 9 (device type: v3.4)
2023-05-20 08:56:19.834 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Sending payload: b'{"gwId":"hubzigbeeIDxxxxxxxxxxx","devId":"hubzigbeeIDxxxxxxxxxxx"}'
2023-05-20 08:56:19.835 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] final payload for cmd 9: b'{"gwId":"hubzigbeeIDxxxxxxxxxxx","devId":"hubzigbeeIDxxxxxxxxxxx"}'
2023-05-20 08:56:19.836 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching sequence number -100
2023-05-20 08:56:19.836 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] payload b'\x00\x00U\xaa\x00\x000\xae\x00\x00\x00\t\x00\x00\x00t\xf8\x8b\x07]\xc2\x8f\x14;\x11\xd6\xc5\xea_WH2\xb6\x8a\xd6\xdc\xf6\x9f\x81\x81 =\xc6g*5\xb4\xcd\xabk\x93\x94\xe2\xa6\xee\x92\xfaN\xadw\xfb\xbaL\xab\xae\xeb\x88\x9e\x81\xca\x89x\x82\xc0;\x92\x04\xe3\r\x0e\xa3\x01\xca\xb9\x9a\xc3\x9e2\x018\x9b?\xa4\xa3\xe0\x0f\xcdw\x82\xb3d\xccHc\xe4\xd6\xda2\xbey\xd5-P\x0b\x82T/#Zc*\x97\xdb\x82q\xb5\xd8\x12\x00\x00\xaaU' - MessagePayload(cmd=9, payload=b'{"gwId":"hubzigbeeIDxxxxxxxxxxx","devId":"hubzigbeeIDxxxxxxxxxxx"}')
2023-05-20 08:56:19.836 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Command 9 waiting for sequence number -100
2023-05-20 08:56:19.842 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching message CMD 9 TuyaMessage(seqno=12462, cmd=9, retcode=0, payload=b'', crc=b'\xdf\xf1;\x80\x06D\xc2\xfe\x1d\x0e\xb9\x15\x81\xeb\xe7\xd5[E.\x96K\x13\xe6\xfe(\xeb\xb1D\xd6RT\xcf', crc_good=True)
2023-05-20 08:56:19.842 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Got heartbeat response
2023-05-20 08:56:19.842 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] ACK received for command 9: ignoring it
2023-05-20 08:56:20.809 DEBUG (MainThread) [custom_components.localtuya] Device hubzigbeeIDxxxxxxxxxxx found with IP 192.168.X.XXX
2023-05-20 08:56:25.820 DEBUG (MainThread) [custom_components.localtuya] Device hubzigbeeIDxxxxxxxxxxx found with IP 192.168.X.XXX
2023-05-20 08:56:29.847 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Sending command 9 (device type: v3.4)
2023-05-20 08:56:29.847 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Sending payload: b'{"gwId":"hubzigbeeIDxxxxxxxxxxx","devId":"hubzigbeeIDxxxxxxxxxxx"}'
2023-05-20 08:56:29.847 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] final payload for cmd 9: b'{"gwId":"hubzigbeeIDxxxxxxxxxxx","devId":"hubzigbeeIDxxxxxxxxxxx"}'
2023-05-20 08:56:29.848 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching sequence number -100
2023-05-20 08:56:29.848 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] payload b'\x00\x00U\xaa\x00\x000\xaf\x00\x00\x00\t\x00\x00\x00t\xf8\x8b\x07]\xc2\x8f\x14;\x11\xd6\xc5\xea_WH2\xb6\x8a\xd6\xdc\xf6\x9f\x81\x81 =\xc6g*5\xb4\xcd\xabk\x93\x94\xe2\xa6\xee\x92\xfaN\xadw\xfb\xbaL\xab\xae\xeb\x88\x9e\x81\xca\x89x\x82\xc0;\x92\x04\xe3\r\x0e\xa3\x01\xca\xb9\x9a\xc3\x9e2\x018\x9b?\xa4\xa3\xe0\x0fY\xd3t\xe7\x96\x91jF\x1dE\x80\xefw\xaf\x11\x0c\xb0\xb3\xf5\xae \xbaa\xe7\xcft\x8f\xea\xb1\x87\xb3\x96\x00\x00\xaaU' - MessagePayload(cmd=9, payload=b'{"gwId":"hubzigbeeIDxxxxxxxxxxx","devId":"hubzigbeeIDxxxxxxxxxxx"}')
2023-05-20 08:56:29.848 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Command 9 waiting for sequence number -100
2023-05-20 08:56:29.864 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching message CMD 9 TuyaMessage(seqno=12463, cmd=9, retcode=0, payload=b'', crc=b'\xd6\xc9y\xe6\xb2\x11\xf3N\xe3\xf9\x11\\\xd0N/>j\xdb\x12\xf6dYt\x17\x91\x1d50\xd5\xde\x97\x01', crc_good=True)
2023-05-20 08:56:29.865 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Got heartbeat response
2023-05-20 08:56:29.866 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] ACK received for command 9: ignoring it
2023-05-20 08:56:30.820 DEBUG (MainThread) [custom_components.localtuya] Device hubzigbeeIDxxxxxxxxxxx found with IP 192.168.X.XXX
2023-05-20 08:56:35.819 DEBUG (MainThread) [custom_components.localtuya] Device hubzigbeeIDxxxxxxxxxxx found with IP 192.168.X.XXX
2023-05-20 08:56:39.869 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Sending command 9 (device type: v3.4)
2023-05-20 08:56:39.870 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Sending payload: b'{"gwId":"hubzigbeeIDxxxxxxxxxxx","devId":"hubzigbeeIDxxxxxxxxxxx"}'
2023-05-20 08:56:39.871 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] final payload for cmd 9: b'{"gwId":"hubzigbeeIDxxxxxxxxxxx","devId":"hubzigbeeIDxxxxxxxxxxx"}'
2023-05-20 08:56:39.873 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching sequence number -100
2023-05-20 08:56:39.873 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] payload b"\x00\x00U\xaa\x00\x000\xb0\x00\x00\x00\t\x00\x00\x00t\xf8\x8b\x07]\xc2\x8f\x14;\x11\xd6\xc5\xea_WH2\xb6\x8a\xd6\xdc\xf6\x9f\x81\x81 =\xc6g*5\xb4\xcd\xabk\x93\x94\xe2\xa6\xee\x92\xfaN\xadw\xfb\xbaL\xab\xae\xeb\x88\x9e\x81\xca\x89x\x82\xc0;\x92\x04\xe3\r\x0e\xa3\x01\xca\xb9\x9a\xc3\x9e2\x018\x9b?\xa4\xa3\xe0\x0f+\xb3'\xaa\x93*\x15\x06F\xdf\xdd\x7f\x14\x95\xae-p\xc7\xcb\xb5\xaek\xe8\x91@?\xc2\x19\xc4\xd8\xb9\x97\x00\x00\xaaU" - MessagePayload(cmd=9, payload=b'{"gwId":"hubzigbeeIDxxxxxxxxxxx","devId":"hubzigbeeIDxxxxxxxxxxx"}')
2023-05-20 08:56:39.874 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Command 9 waiting for sequence number -100
2023-05-20 08:56:39.880 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Dispatching message CMD 9 TuyaMessage(seqno=12464, cmd=9, retcode=0, payload=b'', crc=b'\x1c\x19\xeb\xd8\x83"F\xb0\xb3\x9d\x900c\xd9\x9d\xb6\xb4\xb3x\x87\xbb\xac\xcc\xb7\n\n\xc3_)\xc5#n', crc_good=True)
2023-05-20 08:56:39.880 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] Got heartbeat response
2023-05-20 08:56:39.882 DEBUG (MainThread) [custom_components.localtuya.pytuya] [hub...xxx] ACK received for command 9: ignoring it
2023-05-20 08:56:40.819 DEBUG (MainThread) [custom_components.localtuya] Device hubzigbeeIDxxxxxxxxxxx found with IP 192.168.X.XXX
2023-05-20 08:56:45.828 DEBUG (MainThread) [custom_components.localtuya] Device hubzigbeeIDxxxxxxxxxxx found with IP 192.168.X.XXX
alexualbu commented 1 year ago

thanks, @goodsale - it seems there is an issue controlling sub-devices. I only have a wifi 3.4 devices so i can't really troubleshoot. @leeyuentuen, do you have subdevices that can be controlled under your 3.4 GW ?

goodsale commented 1 year ago

@leeyuentuen @alexualbu

I am very interested in this project for controlling TUYA devices locally. If you want to test some beta version you can ask and I will

Thank you!