leeyuentuen / localtuya

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

Bluetooth water timer: #64

Open mikeinblue opened 1 year ago

mikeinblue commented 1 year ago

"category": "sfkzq", "model": "SOP10", "name": "水阀控制器", imglink: https://images.tuyacn.com/ecommerce/16119137706294d7a3b33.jpg?x-oss-process=image/format,webp

The problem

When I added this watering timer ,it shows Unavailable. I have set the pd correctly. Maybe caused "Data point detection failed. Type in a number to add a data point, or 0 to finish or cancel."

When I added A wifi plug, it works pefectly.

Environment

Configuration configuration.yaml or config_flow

localtuya:
  # Zigbee or Bluetooth gateway
  - host: 192.168.22.208
    device_id: xxxxxxxxxxxx
    local_key: xxxxxxxxxx
    friendly_name: Tuya Gateway
    protocol_version: "3.4"
    is_gateway: true # This tells it is to be treated as a gateway and skip adding entities

  # Devices under a gateway
  # Other than differences on the device itself (ie. no host and local_key), the rest is the same
  #   as a WiFi device
  - parent_gateway: xxxxxxxxxxxxxx # This tells it is a sub-device dependent on a parent gateway
    device_id: xxxxxxxxxxx # The cid of sub-device
    friendly_name: water timer
    entities:
      - platform: switch
        friendly_name: water timer Entity 1
        id: 1

DP dump

{ "result": { "category": "sfkzq", "functions": [ { "code": "switch", "dp_id": 1, "type": "Boolean", "values": "{}" }, { "code": "time_use", "dp_id": 9, "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":2592000,\"scale\":0,\"step\":1}" }, { "code": "weather_delay", "dp_id": 10, "type": "Enum", "values": "{\"range\":[\"cancel\",\"24h\",\"48h\",\"72h\"]}" }, { "code": "countdown", "dp_id": 11, "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}" }, { "code": "smart_weather", "dp_id": 13, "type": "Enum", "values": "{\"range\":[\"sunny\",\"cloudy\",\"rainy\"]}" } ], "status": [ { "code": "switch", "dp_id": 1, "type": "Boolean", "values": "{}" }, { "code": "battery_percentage", "dp_id": 7, "type": "Integer", "values": "{\"unit\":\"%\",\"min\":0,\"max\":100,\"scale\":0,\"step\":1}" }, { "code": "time_use", "dp_id": 9, "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":2592000,\"scale\":0,\"step\":1}" }, { "code": "weather_delay", "dp_id": 10, "type": "Enum", "values": "{\"range\":[\"cancel\",\"24h\",\"48h\",\"72h\"]}" }, { "code": "countdown", "dp_id": 11, "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}" }, { "code": "work_state", "dp_id": 12, "type": "Enum", "values": "{\"range\":[\"auto\",\"manual\",\"idle\"]}" }, { "code": "smart_weather", "dp_id": 13, "type": "Enum", "values": "{\"range\":[\"sunny\",\"cloudy\",\"rainy\"]}" }, { "code": "use_time_one", "dp_id": 15, "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}" } ] }, "success": true, "t": 1683860130158, "tid": "748ba074f07011ed8819c6e890e871c6" }

Provide Home Assistant taceback/logs

2023-05-12 08:08:57.522 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending command 9 (device type: v3.4) 2023-05-12 08:08:57.522 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending payload: b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}' 2023-05-12 08:08:57.522 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] final payload for cmd 9: b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}' 2023-05-12 08:08:57.522 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number -100 2023-05-12 08:08:57.522 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] payload b"\x00\x00U\xaa\x00\x00\xda\x06\x00\x00\x00\t\x00\x00\x00tS\xca\xfcv>\xc2\x92\x02\x86U\xe5\x8c[\x7f\xdc\xbd\x02\x99\xf6u\x85K\x8c}\xe4\x0f\xb7\xd4\xcc.Ib\x7f]\xe6\x14\xa68\xe7'\xe7\x08w\x1fb\xc0\x11\xc9bu\x7f\xf2\x1b\x9e\x8463\xfdx\xd1\xfb\xa7\xf3\xf9\x07'\xacw;\x010\xb4)\xb7\xb7#\x18\xa5\xed1\xcdb\xda\xd1\xa6\xb3\x8cm\x87G/N\x84\xf2\x99z\x97\x03\x0b\x8c\x08aj\xb0\xed\x02T\x19O}PG\x00\x00\xaaU" - MessagePayload(cmd=9, payload=b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}') 2023-05-12 08:08:57.522 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Command 9 waiting for sequence number -100 2023-05-12 08:08:57.558 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 9 TuyaMessage(seqno=55814, cmd=9, retcode=0, payload=b'', crc=b'\xb5\xa8\xf1\xb8\xaaM-I\xb5t\xf3\xcd\xe8(\xf6\x15\xe3\xbb\x01\xac\x03\xf8\x1d\x10\xb1h\xeb\x90Jy\x93\xb7', crc_good=True) 2023-05-12 08:08:57.558 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Got heartbeat response 2023-05-12 08:08:57.558 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] ACK received for command 9: ignoring it

Additional information

alexualbu commented 1 year ago

@mikeinblue, my suggestion would be to set-up the devices via the UI. Nevertheless, the selected log is too limited to infer anything. Can you try and provide the entire log from the moment the water timer is set-up? Right now, assuming 6c7..zsx is the devid for the GW we can only deduce that the GW set-up is working and the integration is communicating fine with it.

mikeinblue commented 1 year ago

hi,@alexualbu, I tried switch on the switch,and find the log below as you suggested: 2023-05-15 19:54:54.223 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Got status update 2023-05-15 19:54:54.223 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Deciphered data = '{"protocol":4,"t":1684151692,"data":{"dps":{"15":9},"cid":"180821a9c6616407"}}' 2023-05-15 19:54:54.223 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Dispatching event event_status_updated to sub-device 180821a9c6616407 with data {'17': 'AA==', '12': 'idle', '1': False, '11': 0, '9': 2933, '15': 9} 2023-05-15 19:54:59.108 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending command 9 (device type: v3.4) 2023-05-15 19:54:59.108 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending payload: b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}' 2023-05-15 19:54:59.109 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] final payload for cmd 9: b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}' 2023-05-15 19:54:59.109 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number -100 2023-05-15 19:54:59.109 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] payload b'\x00\x00U\xaa\x00\x00\x15\x99\x00\x00\x00\t\x00\x00\x00t}~\x98D/\x1d\x07\xae\xf2\x8b\xa2\xad\xe4\x18;\xe3\x8d\xd7[\r<O\xbf\xa2Z\xc6\x10kt\xa3]r\xd3\xfc!\xa1a\x1eB\xab\x83\x0b\xf81\xd8q^\xf7\\x9e\x13\xad\x9a\xc6&\x11\xe0\xabjb\xb5\xb1\x102\x18\n\x90tDA\xb7\xab\x81\x1a\x8b\xd9\x8cp%\xe9Vu\xe3\xfee\xf4$\xbb\xd0\xe4bgB\xe8\xd0\xfc\xd3\xcc\xbc\xd2\x88\xb4"qB\xf6\xf8\xc0\x83T3a\x00\x00\xaaU' - MessagePayload(cmd=9, payload=b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}') 2023-05-15 19:54:59.109 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Command 9 waiting for sequence number -100 2023-05-15 19:54:59.153 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 9 TuyaMessage(seqno=5529, cmd=9, retcode=0, payload=b'', crc=b'b\x84\xd3\xf2\xd5\xfcSG2]\x85\xfbk?\xa1\xde\xaao+\x08<\x8b\r\x19v3\x84\x14l\xa7\xbf\xd5', crc_good=True) 2023-05-15 19:54:59.153 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Got heartbeat response 2023-05-15 19:54:59.153 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] ACK received for command 9: ignoring it. 2023-05-15 19:55:00.399 DEBUG (MainThread) [custom_components.localtuya] Device 6c7984edb1087dd187ozsx found with IP 192.168.22.208

Device 6c7984edb1087dd187ozsx is the bluetooth GW. See anything useful? If you wanna any info just let me know

And I had another try,the log is below: 2023-05-15 20:06:10.579 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 8 TuyaMessage(seqno=5600, cmd=8, retcode=0, payload=b'\x1f% \x89@\x03&\x8f\xea\xdd\xbf\x81\xfd\xca^[\xcc\xe9\xc5\x18\xbc\xc1\x16\xca\r[\xac\xf7\xbfq\xa9\xa5\x16\x04u\xe0\xa4\xe5\xac\x14\x0b\xf1F<\xa2\xbe\x04\x8e\n!\xccH\xb2\x10A\x8e\x032?\xaa\x82\xa4\xe4\xd9v\xd7\x8f(s\xd9\x1c\xa1\xa2W.1\x07\x04\x1d J\xb3\xe6\xd3i\xfa\xc6\xb7\x04\x1a\xd6\xfb0\xdd2=Zvw\xf5\xc8\xab\x851\xec\x1e\x93q\xea}d$\xf6\x11B\x9a\xc2g\xeb\xc2V\x19\xff\x1fHO[\xb4', crc=b'\xde\x08\xe8\x8d\xa2S8s5\x06\x18\xba\\xf1n(o\xbc.\xb6\xff\\x1e\xa6\x07\x9b*\xdb\x91w,\xf3', crc_good=True) 2023-05-15 20:06:10.579 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Got status update 2023-05-15 20:06:10.579 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Deciphered data = '{"protocol":4,"t":1684152370,"data":{"dps":{"12":"idle","1":false,"9":2944,"11":0},"cid":"180821a9c6616407"}}' 2023-05-15 20:06:10.579 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Dispatching event event_status_updated to sub-device 180821a9c6616407 with data {'17': 'AA==', '12': 'idle', '1': False, '11': 0, '9': 2944, '15': 9, '16': 'AAAAfwRqBG0AAQABAA=='} 2023-05-15 20:06:11.075 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 8 TuyaMessage(seqno=5601, cmd=8, retcode=0, payload=b'\x9b\xbb8q)\xf1\xc6\xa6\xdf\xfb\x8c{\xcd`\x90\x93\xcc\xe9\xc5\x18\xbc\xc1\x16\xca\r[\xac\xf7\xbfq\xa9\xa5\x16\x04u\xe0\xa4\xe5\xac\x14\x0b\xf1F<\xa2\xbe\x04\x8e\x06\xe02\xc7\xff}j\xc7K\xab)\xd9S\xe4\te\x0f)\pGA\xeb\xe9\xf2\x96DzD\xc6\x0e:\x8e\xa8D\xd1\x9cilV?\xacw\xac\x94\xd2W\xab', crc=b'\xb6o\xe0\x9ez\x7f\xcb\x9431\xac\xde\x1a\xf9N\x19\x907\x02GU=\x83\n\x85\x1b $\xc1\x02\\x7f', crc_good=True) 2023-05-15 20:06:11.075 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Got status update 2023-05-15 20:06:11.075 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Deciphered data = '{"protocol":4,"t":1684152370,"data":{"dps":{"15":11},"cid":"180821a9c6616407"}}' 2023-05-15 20:06:11.075 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Dispatching event event_status_updated to sub-device 180821a9c6616407 with data {'17': 'AA==', '12': 'idle', '1': False, '11': 0, '9': 2944, '15': 11, '16': 'AAAAfwRqBG0AAQABAA=='} 2023-05-15 20:06:12.617 DEBUG (MainThread) [custom_components.localtuya] Device 6c7984edb1087dd187ozsx found with IP 192.168.22.208 2023-05-15 20:06:13.511 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending command 9 (device type: v3.4) 2023-05-15 20:06:13.511 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending payload: b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}' 2023-05-15 20:06:13.511 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] final payload for cmd 9: b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}' 2023-05-15 20:06:13.512 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number -100 2023-05-15 20:06:13.512 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] payload b'\x00\x00U\xaa\x00\x00\x15\xe2\x00\x00\x00\t\x00\x00\x00t}~\x98D/\x1d\x07\xae\xf2\x8b\xa2\xad\xe4\x18;\xe3\x8d\xd7[\r<O\xbf\xa2Z\xc6\x10kt\xa3]r\xd3\xfc!\xa1a\x1eB\xab\x83\x0b\xf81\xd8q^\xf7\\x9e\x13\xad\x9a\xc6&\x11\xe0\xabjb\xb5\xb1\x102\x18\n\x90tDA\xb7\xab\x81\x1a\x8b\xd9\x8cp%\xe9Z\xac\nb\xbbWh\xf7C$U\xee\x10Z\rJU\xaf\x97\x04L\x8d^\xe4\x99\x9d{\x0fUcbj\x00\x00\xaaU' - MessagePayload(cmd=9, payload=b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}') 2023-05-15 20:06:13.512 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Command 9 waiting for sequence number -100 2023-05-15 20:06:13.653 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 9 TuyaMessage(seqno=5602, cmd=9, retcode=0, payload=b'', crc=b'\xdd\xb5s\x8d\x12\xd1e\xf6\x9dq\xe2\x92\xbcl\x82\xf0\xb6\xee\x1f\x150\x18f\xeel&f\xb2\xd7\x8a\xa2\xfc', crc_good=True) 2023-05-15 20:06:13.653 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Got heartbeat response 2023-05-15 20:06:13.653 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] ACK received for command 9: ignoring it 2023-05-15 20:06:17.636 DEBUG (MainThread) [custom_components.localtuya] Device 6c7984edb1087dd187ozsx found with IP 192.168.22.208

alexualbu commented 1 year ago

@mikeinblue, is this the plug or the water timer ? node_id / cid 180821a9c6616407 ?

mikeinblue commented 1 year ago

Sorry. How can I check the node id/cid? But there is only one valve under the GW. It is a valve with timer and switch funtion.Here is the product link. https://expo.tuya.com/product/79000https://expo.tuya.com/product/790004

mikeinblue commented 1 year ago

I tried to link the info with "Device Specification Attribute" sub-device 180821a9c6616407 with data {'17': 'AA==', '12': 'idle', '1': False, '11': 0, '9': 2933, '15': 9} "dp_id": 17="unknow", "dp_id": 12= { "code": "work_state", "dp_id": 12, "type": "Enum", "values": "{\"range\":[\"auto\",\"manual\",\"idle\"]}" }, "dp_id": 1={ "code": "switch", "dp_id": 1, "type": "Boolean", "values": "{}" }, "dp_id": 11= { "code": "countdown", "dp_id": 11, "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}" }, "dp_id": 9={ "code": "time_use", "dp_id": 9, "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":2592000,\"scale\":0,\"step\":1}" }, "dp_id": 15={ "code": "use_time_one", "dp_id": 15, "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}" }

alexualbu commented 1 year ago

In the config you have added the cid or in the ui. However it's masked. So It wasn't clear if that was the sub-device.

device_id: xxxxxxxxxxx # The cid of sub-device

So if the sub-device is 180821a9c6616407 in that case the logs you copied show no issues, HA receives a status so it should show-up just fine. In absence of any information, screenshots, or logs... it's not clear what the issue is.

2023-05-15 20:06:11.075 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Got status update 2023-05-15 20:06:11.075 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Deciphered data = '{"protocol":4,"t":1684152370,"data":{"dps":{"15":11},"cid":"180821a9c6616407"}}' 2023-05-15 20:06:11.075 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Dispatching event event_status_updated to sub-device 180821a9c6616407 with data {'17': 'AA==', '12': 'idle', '1': False, '11': 0, '9': 2944, '15': 11, '16': 'AAAAfwRqBG0AAQABAA=='}

mikeinblue commented 1 year ago

Thx,bro,I put "180821a9c6616407" in the "device_id",it worked.

mikeinblue commented 1 year ago

Sorry to reopen .But I found I can't controll the swith through homeassistant. It just shows the status of the switch. When I switched on via app,it changed to "on", and it changed to "off " when I switched off via app,but I can't switch it by touch it.

mikeinblue commented 1 year ago

_Here is my operation,switch on ,and set "count down"("dp=11") = 300. (FYI:"deviceid"=6c590cd0d6bb635288s1nk,"cid":"180821a9c6616407") logs: 2023-05-16 07:34:03.462 DEBUG (MainThread) [custom_components.localtuya.common] [180...407] Dispatching request request_set_dp to gateway with content {'value': True, 'dp_index': 1} 2023-05-16 07:34:03.462 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Received request request_set_dp from 180821a9c6616407 with content {'value': True, 'dp_index': 1} 2023-05-16 07:34:03.462 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending command 7 (device type: v3.4) 2023-05-16 07:34:03.462 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending payload: b'{"protocol":5,"t":1684193643,"data":{"dps":{"1":true}},"cid":"180821a9c6616407"}' 2023-05-16 07:34:03.462 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] final payload for cmd 13: b'3.4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00{"protocol":5,"t":1684193643,"data":{"dps":{"1":true}},"cid":"180821a9c6616407"}' 2023-05-16 07:34:03.463 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number 21869 2023-05-16 07:34:03.463 DEBUG (MainThread) [customcomponents.localtuya.pytuya] [6c7...zsx] payload b'\x00\x00U\xaa\x00\x00Um\x00\x00\x00\r\x00\x00\x00\x84f\x18\xabr\xbbZ\xf6\x1ed\xc7\xec\xd7\xfc\xb4|\x13\xf5J+\x18\xf1R\xb9\xf0nd\xa3\x00a\x9b\xaa\x02G\xbf\x07+\x88\x7fj\x89\x1em\xe6*3\xccE\x1e\xcd)\x9d]\x85\x18\xf5\x1e]\xe7\x92\x0c\xc4\x01\xc4\xa3<\xd4\xf6\x0bT\xf0r\xf4M\x7f\x16Q\xc9\x12/\x17h\xa8#K\x8e\\xdeB\x93\xc6\xc64^?\xa4\xaf\xbeI\x19,\x88\xb37~\x96Nq\xd5(H\xbb\x15E\x89!\xde7\x9c\xc7\xd2\xf7]\x9c\xfdzf\x00\x00\xaaU' - MessagePayload(cmd=13, payload=b'{"protocol":5,"t":1684193643,"data":{"dps":{"1":true}},"cid":"180821a9c6616407"}') 2023-05-16 07:34:03.463 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Command 13 waiting for sequence number 21869 2023-05-16 07:34:03.463 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Received request request_set_dp from 180821a9c6616407 with content {'value': True, 'dp_index': 1} 2023-05-16 07:34:03.463 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending command 7 (device type: v3.4) 2023-05-16 07:34:03.463 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending payload: b'{"protocol":5,"t":1684193643,"data":{"dps":{"1":true}},"cid":"180821a9c6616407"}' 2023-05-16 07:34:03.463 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] final payload for cmd 13: b'3.4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00{"protocol":5,"t":1684193643,"data":{"dps":{"1":true}},"cid":"180821a9c6616407"}' 2023-05-16 07:34:03.464 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number 35248 2023-05-16 07:34:03.464 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] payload b'\x00\x00U\xaa\x00\x00\x89\xb0\x00\x00\x00\r\x00\x00\x00\x84\x0cT Q\xcf\xe5\xfb\x17\xbbLZcG\xa8\xfa\x1d!\xc3\xc04\xd5\xeeaxwb\xdb\xf1\x02s\xd1"\xd2\x9b\t\x17\x0f\xc6L\xd7gZ$\xeb\xa9\xba\x04!\xe1Q\xc4N\xefmG\xe7T\x9b\xfc\xef2\x96\xa3ac\x8a}<9\xa1\xdc\x15#d\xe36<\xe9\xf0\xb4\x86?\xb4\xdf\x1f\xab\x08\xf0(\x1a\xc0\xabd\xc3v\x1b\xc7Z\xfbQk^2\xc3g}x\xf3<\x88\xe1U\x888\xb4\x82\xfa\xb9\x98E\xbe\xf4rS\xb5\xd5\xbd\xfc\x00\x00\xaaU' - MessagePayload(cmd=13, payload=b'{"protocol":5,"t":1684193643,"data":{"dps":{"1":true}},"cid":"180821a9c6616407"}') 2023-05-16 07:34:03.464 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Command 13 waiting for sequence number 35248 2023-05-16 07:34:03.513 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 13 TuyaMessage(seqno=21869, cmd=13, retcode=0, payload=b'', crc=b'\x9e\x19)\x9e\x98b5\xf3\xeb\xeeE\x88^\x1e\xceT\x8dj\xf7\xafR\xb0r\xc2\xce|\x97\x8d42\xd6\x18', crc_good=True) 2023-05-16 07:34:03.513 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number 21869 2023-05-16 07:34:03.513 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] ACK received for command 13: ignoring it 2023-05-16 07:34:03.525 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 13 TuyaMessage(seqno=35248, cmd=13, retcode=0, payload=b'', crc=b'4\xa9|\x17b\xf1\xc7"w\x9f\xef\x91\x08;\x9f\x04\xec\xec\x89s$\'g\x00\xf4Y\xbez\xd2\xa1l\xc6', crc_good=True) 2023-05-16 07:34:03.525 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number 35248 2023-05-16 07:34:03.525 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] ACK received for command 13: ignoring it 2023-05-16 07:34:04.294 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending command 9 (device type: v3.4) 2023-05-16 07:34:04.294 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending payload: b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}' 2023-05-16 07:34:04.294 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] final payload for cmd 9: b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}' 2023-05-16 07:34:04.294 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number -100 2023-05-16 07:34:04.294 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] payload b'\x00\x00U\xaa\x00\x00Un\x00\x00\x00\t\x00\x00\x00th\xae\x87\x8fU\xa3\xae\x1e\xac\xc9\xa7\xbe\xf7\xcd\x1919\xc6\x17\x93\x1c2A\x00c\x86\x96\xacCm\x83\xadP\xd3\xfd\x86z\x19\xa7\xa2jhs\x96\xde\x14_\x8c\xae_\xce<[\xe0\xca\xc6J\x13\xdb&QF\xf1\xcb0j\xd4\xe2\xa8\x1d\xe6N|o\xbciW\x16f\xde\xf1\xb2\xb4T\x95S\xddTyz\xffV\xe0\xb2\x82\x15\xc9\xcc>|\x12\x84eS\x14\nN\xdb[\xcc\xe9\xc2\x00\x00\xaaU' - MessagePayload(cmd=9, payload=b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}') 2023-05-16 07:34:04.294 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Command 9 waiting for sequence number -100 2023-05-16 07:34:04.327 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 9 TuyaMessage(seqno=21870, cmd=9, retcode=0, payload=b'', crc=b'q\xec\xbb\xa4{ig\xcfj\xd4\x11\xd9Y~\xfb\xab)\xd2\xc7\x10vP\xa7\xb6\xb9\xd03\xe9\x13\x87A', crc_good=True) 2023-05-16 07:34:04.327 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Got heartbeat response 2023-05-16 07:34:04.327 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] ACK received for command 9: ignoring it 2023-05-16 07:34:04.775 DEBUG (MainThread) [custom_components.localtuya.common] [180...407] Dispatching request request_set_dp to gateway with content {'value': 299.0, 'dp_index': 11} 2023-05-16 07:34:04.775 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Received request request_set_dp from 180821a9c6616407 with content {'value': 299.0, 'dp_index': 11} 2023-05-16 07:34:04.775 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending command 7 (device type: v3.4) 2023-05-16 07:34:04.775 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending payload: b'{"protocol":5,"t":1684193644,"data":{"dps":{"11":299.0}},"cid":"180821a9c6616407"}' 2023-05-16 07:34:04.775 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] final payload for cmd 13: b'3.4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00{"protocol":5,"t":1684193644,"data":{"dps":{"11":299.0}},"cid":"180821a9c6616407"}' 2023-05-16 07:34:04.775 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number 21871 2023-05-16 07:34:04.775 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] payload b'\x00\x00U\xaa\x00\x00Uo\x00\x00\x00\r\x00\x00\x00\x94f\x18\xabr\xbbZ\xf6\x1ed\xc7\xec\xd7\xfc\xb4|\x13\xf5J+\x18\xf1R\xb9\xf0nd\xa3\x00a\x9b\xaa\x02\xac\x01\xa9\x8b2@\x80\xc7\x8c.\xe2\xaa\xdca\xac\x9b\x9a\,\x1b\xefol\x9f\xc2tvY\xd6\xfa\xdb\x06\x12\xa8z~\xcc\xe3}\xfaq\xa1+\x08\x89\x1d\x13N\xce\n\xb5<\xe8\x128\xa5\x9c\xee\xa0i\xd7!\xeeA\xe4\xac\xe2\xf4\x0b\r\x84\xde%N\x87\x92fn%S\xde\xa3p\x97r\x90\x058\xb9\xe9\xfa\xa3\xa2\xf7\xfa\x14t\x80g\xc4\xe2`\x05\xc2\rg\xd9\x92~\x94\x86\xfa\x00\x00\xaaU' - MessagePayload(cmd=13, payload=b'{"protocol":5,"t":1684193644,"data":{"dps":{"11":299.0}},"cid":"180821a9c6616407"}') 2023-05-16 07:34:04.776 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Command 13 waiting for sequence number 21871 2023-05-16 07:34:04.776 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Received request request_set_dp from 180821a9c6616407 with content {'value': 299.0, 'dp_index': 11} 2023-05-16 07:34:04.776 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending command 7 (device type: v3.4) 2023-05-16 07:34:04.776 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending payload: b'{"protocol":5,"t":1684193644,"data":{"dps":{"11":299.0}},"cid":"180821a9c6616407"}' 2023-05-16 07:34:04.776 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] final payload for cmd 13: b'3.4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00{"protocol":5,"t":1684193644,"data":{"dps":{"11":299.0}},"cid":"180821a9c6616407"}' 2023-05-16 07:34:04.777 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number 35249 2023-05-16 07:34:04.777 DEBUG (MainThread) [customcomponents.localtuya.pytuya] [6c7...zsx] payload b'\x00\x00U\xaa\x00\x00\x89\xb1\x00\x00\x00\r\x00\x00\x00\x94\x0cT Q\xcf\xe5\xfb\x17\xbbLZcG\xa8\xfa\x1d!\xc3\xc04\xd5\xeeaxwb\xdb\xf1\x02s\xd1"\x8ej\xc1\x17\xd4J\x1a<\x8c.\xc9\tj\xc3~D\xb4\xd4\xb7\xca\xa6\xdf\xa8o7f6\xc0K\x80\xbc}\xaf\x05\xdc\xfef\xc4\xa2Q\x8aH\xdd\xb01\xa3\xa9\xa3|\xd5\xdb\x8c\xbd\xce\x85r\x1c\x81pP\x133\x86\xde$w2I3&\xd9!\r]\r\xb1\xc4^k\xbbU\xbe2\xc7\x90\xf1\xa5\x98\x16f\x81\x83\xac\tK;(\x04\xf9\x92\x89j\x12\xbf\xbd\xb5\xbfk\x1e\xe1\x00\x00\xaaU' - MessagePayload(cmd=13, payload=b'{"protocol":5,"t":1684193644,"data":{"dps":{"11":299.0}},"cid":"180821a9c6616407"}') 2023-05-16 07:34:04.777 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Command 13 waiting for sequence number 35249 2023-05-16 07:34:04.827 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 13 TuyaMessage(seqno=21871, cmd=13, retcode=0, payload=b'', crc=b'\x13P\xc7m\xe4\x7fu=\xbc\xe7\xc8\x08\x9am\x82\t{\xeb\x9b\x0b,\x0e\xb7\xe3:\x8bz5\x1bd"', crc_good=True) 2023-05-16 07:34:04.827 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number 21871 2023-05-16 07:34:04.827 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 13 TuyaMessage(seqno=35249, cmd=13, retcode=0, payload=b'', crc=b'\xd5\n\xf9\x1e\xe2\x90\x98\xe8[\x0e\x8c\x7f\x9aO\x95&Q\xbb_S\x05%\x80Mn!\x89|\xc2m\x95!', crc_good=True) 2023-05-16 07:34:04.827 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number 35249 2023-05-16 07:34:04.828 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] ACK received for command 13: ignoring it 2023-05-16 07:34:04.828 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] ACK received for command 13: ignoring it 2023-05-16 07:34:11.660 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending command 9 (device type: v3.4) 2023-05-16 07:34:11.660 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending payload: b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}' 2023-05-16 07:34:11.660 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] final payload for cmd 9: b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}' 2023-05-16 07:34:11.660 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number -100 2023-05-16 07:34:11.660 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] payload b"\x00\x00U\xaa\x00\x00\x89\xb2\x00\x00\x00\t\x00\x00\x00t\x93\x9c<\x8dc?-\xfd\xa8Q)\xd2'\x00a\xd3g\x15];[\x19\xfb\x01\x99\x8f\x06\x7f\x98\xb1ws\xd9=\x92\x89\xdcsG\xf2\xf6 \xe4i\x10\x16,}\xde\x06\xfba\x9c=\x89oX\xd3\xc3\xef\xa3\x1flU\x033\x88Y\xcf\xe2\xe7\xbfF\xce\xd8\x14Zz\x80\x15\x11\x11\\xaeA\xee5K}D\x8f\xe9\xb78\x93\xea=\xecN\xf3\xc3\x87\x83h\xa4\x07\x05\x19\x15\xe4\xf0^\x00\x00\xaaU" - MessagePayload(cmd=9, payload=b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}') 2023-05-16 07:34:11.660 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Command 9 waiting for sequence number -100 2023-05-16 07:34:11.697 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 9 TuyaMessage(seqno=35250, cmd=9, retcode=0, payload=b'', crc=b'\xe8w\x11\x90\x1a\xf6q\xa2X0\x83g\x84\xb3\xaa\xa8\x9e\xb4\x80g\xe8\xaf\xde\x9dC\xbe\xf9\x9bn\xabT', crc_good=True) 2023-05-16 07:34:11.697 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Got heartbeat response 2023-05-16 07:34:11.698 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] ACK received for command 9: ignoring it 2023-05-16 07:34:12.411 DEBUG (MainThread) [custom_components.localtuya] Device 6c7984edb1087dd187ozsx found with IP 192.168.22.208 2023-05-16 07:34:14.328 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending command 9 (device type: v3.4) 2023-05-16 07:34:14.329 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending payload: b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}' 2023-05-16 07:34:14.329 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] final payload for cmd 9: b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}' 2023-05-16 07:34:14.329 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number -100 2023-05-16 07:34:14.329 DEBUG (MainThread) [customcomponents.localtuya.pytuya] [6c7...zsx] payload b'\x00\x00U\xaa\x00\x00Up\x00\x00\x00\t\x00\x00\x00th\xae\x87\x8fU\xa3\xae\x1e\xac\xc9\xa7\xbe\xf7\xcd\x1919\xc6\x17\x93\x1c2A\x00c\x86\x96\xacCm\x83\xadP\xd3\xfd\x86z\x19\xa7\xa2jhs\x96\xde\x14\x8c\xae_\xce<[\xe0\xca\xc6J\x13\xdb&QF\xf1\xcb0j\xd4\xe2\xa8\x1d\xe6N|o\xbciW\x16f\xdeK\xe1\xac\x08\xd9F\x19mQ\x12\x9cJ<\x94\x93\xa5\xd7\xeaa\xdd\x05>%lr\x95\xe7\xc2\xda\xf8\x1b\xc9\x00\x00\xaaU' - MessagePayload(cmd=9, payload=b'{"gwId":"6c7984edb1087dd187ozsx","devId":"6c7984edb1087dd187ozsx"}') 2023-05-16 07:34:14.329 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Command 9 waiting for sequence number -100 2023-05-16 07:34:14.990 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 9 TuyaMessage(seqno=21872, cmd=9, retcode=0, payload=b'', crc=b'57 r3\xdd\x1d\xe5\x8d4\x025\xb2\x07\xf5\x1eI\x8e\rZ\xd94\x19\xbe\xffy\xebp#\xba\xb9%', crc_good=True) 2023-05-16 07:34:14.990 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Got heartbeat response 2023-05-16 07:34:14.991 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] ACK received for command 9: ignoring it

mikeinblue commented 1 year ago

I tried this,and it worked.I am confused,on TuYa's Control Device I sent commands throngh "device_id",but in this intergration,I sent commands throngh "cid",would it caused the switch doesn't work? image

alexualbu commented 1 year ago

@mikeinblue , when you say "app" do you mean "Smart Life" and when you say "touch" do you mean "Home assistant"? The one thing I see in this image is that it doesn't just send the switch code, but also a countdown value in the same command. (Also the tuya console probably always uses the device id via api, while localtuya sends commands via the gateway local interface and that's why it needs to specify the sub device id - cid) Could you try https://github.com/TuyaAPI/cli to test this outside of home assistant?

mikeinblue commented 1 year ago

when you say "app" do you mean "Smart Life" and when you say "touch" do you mean "Home assistant"?

Yes,exactly.

The one thing I see in this image is that it doesn't just send the switch code, but also a countdown value in the same command.

Yes,this valve should switch on with a time countdown,or it will do nothing.I don't know how to do the command in localTuya.

mikeinblue commented 1 year ago

Could you try https://github.com/TuyaAPI/cli to test this outside of home assistant? I tired like this: C:\Users\mike>tuya-cli get --id 6c590cd0d6bb635288s1nk --key 4bb6097007f416e1 Error: find() timed out. Is the device powered on and the ID or IP correct? at C:\Users\mike\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\tuyapi\index.js:1062:13 at Timeout._onTimeout (C:\Users\mike\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\p-timeout\index.js:25:13) at listOnTimeout (node:internal/timers:569:17) at process.processTimers (node:internal/timers:512:7) C:\Users\mike>tuya-cli set --id 6c590cd0d6bb635288s1nk --key 4bb6097007f416e1 --dps 1 --set true Error: find() timed out. Is the device powered on and the ID or IP correct? at C:\Users\mike\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\tuyapi\index.js:1062:13 at Timeout._onTimeout (C:\Users\mike\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\p-timeout\index.js:25:13) at listOnTimeout (node:internal/timers:569:17) at process.processTimers (node:internal/timers:512:7)

alexualbu commented 1 year ago

@mikeinblue, follow the guide in the documentation to try and set the switch first just with dp 1 and then try setting dp 11 first to see if it just work with the switch, then if it works by setting the timer first and after the switch (it will be something like tuya-cli set --id --local_ley --cic --ip --dps 1 --set true)

mikeinblue commented 1 year ago

**> tuya-cli set --id --local_ley --cic --ip --dps 1 --set true)

I tried it as you said,but my valve didi noting,cli displayed succeeded.**

_C:\Users\mike>tuya-cli set --id 6c7984edb1087dd187ozsx --key 4bb6097007f416e1 --cid 180821a9c6616407 --dps 1 --set true) Set succeeded.

C:\Users\mike>tuya-cli set --id 6c7984edb1087dd187ozsx --key 4bb6097007f416e1 --cid 180821a9c6616407 --dps 1 --set true --dps 11 --set 300) Set succeeded.

C:\Users\mike>_

alexualbu commented 1 year ago

@mikeinblue , can you try now with 2 sets (first command with dp 11 and then dp 1) ?

mikeinblue commented 1 year ago

@mikeinblue , can you try now with 2 sets (first command with dp 11 and then dp 1) ?

logs: C:\Users\mike>tuya-cli set --id 6c7984edb1087dd187ozsx --key 4bb6097007f416e1 --cid 180821a9c6616407 --dps 11 --set 300) Set succeeded.

C:\Users\mike>tuya-cli set --id 6c7984edb1087dd187ozsx --key 4bb6097007f416e1 --cid 180821a9c6616407 --dps 1 --set true) Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Timeout waiting for status response from device id: 6c7984edb1087dd187ozsx') at new NodeError (node:internal/errors:399:5) at TuyaDevice.emit (node:events:502:17) at C:\Users\mike\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\tuyapi\index.js:434:12 at Timeout._onTimeout (C:\Users\mike\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\p-timeout\index.js:25:13) at listOnTimeout (node:internal/timers:569:17) at process.processTimers (node:internal/timers:512:7) { code: 'ERR_UNHANDLED_ERROR', context: 'Timeout waiting for status response from device id: 6c7984edb1087dd187ozsx' }

Still the valve didi nothing af76912a2b5fd16fd210fa7c56a6c5b

mikeinblue commented 1 year ago

My tap to run has to be like this or it won't launch the valve to watering flower. 67ec88ca50eebb15ff2013c657c62b2

alexualbu commented 1 year ago

@mikeinblue , you could try that sequence again - it's weird the dp 1 set failed, but it seem tuyacli is also not able to sent 2 dps at once so we can't confirm 100%. In any event, I assume both dp11 and 1 need to be set for the device to actually start in which case I don't believe we now have such an entity in Localtuya that would be able to accomplish it.

mikeinblue commented 1 year ago

Thank you for your time on this issue.Maybe the only way to automate it is through cloud .

alexualbu commented 1 year ago

@mikeinblue , given that the automation does 2 actions - set switch on, set timer value - i would expect it works if you do the same. so you could try some more combinations in tuya cli with the 2 set commands, first 1 then 11, first 11 then 1, vary the timing in between and it might work.

mikeinblue commented 1 year ago

I can switched off the device use cli or api webside,but can't switch off with localtuya.I don't know what's wrong with it.

alexualbu commented 1 year ago

so you can switch off the device with tuyaapi-cli? after it's switched on - do you see the on status in home-assistant? can you provide the localtuya debug logs when you try to turn it off from HA?

mikeinblue commented 1 year ago

after it's switched on - do you see the on status in home-assistant?

Yes,the status changed very soon after swited on,but I can't controll with HA.

the logs:

2023-05-16 17:52:53.234 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Got status update 2023-05-16 17:52:53.234 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Deciphered data = '{"protocol":4,"t":1684230772,"data":{"dps":{"12":"manual","1":true,"11":301},"cid":"180821a9c6616407"}}' 2023-05-16 17:52:53.234 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Dispatching event event_status_updated to sub-device 180821a9c6616407 with data {'1': True, '4': 0, '7': 100, '9': 3833, '10': 'cancel', '11': 301, '12': 'manual', '14': False, '15': 9, '16': 'AAAAfwRqBG8AAQABAA==', '17': 'AA=='} 2023-05-16 17:52:53.234 DEBUG (SyncWorker_17) [custom_components.localtuya.common] [180...407] Received event event_status_updated from gateway with data {'1': True, '4': 0, '7': 100, '9': 3833, '10': 'cancel', '11': 301, '12': 'manual', '14': False, '15': 9, '16': 'AAAAfwRqBG8AAQABAA==', '17': 'AA=='} 2023-05-16 17:52:53.344 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 8 TuyaMessage(seqno=49335, cmd=8, retcode=0, payload=b'\xaa|PpHx\x90\x92U\x9c\x1bL\xc5\\x18d\x89\x8bT\xe7\xd2\xa7\xf5 VJ\x9c8\x18]\xd0\xc6J\xec\xb9\x15\x1d#\x80\xea\xe2\x91\xa1\x10%\x7f\x03M/n\x03\xber\x9f7\x05*3\xc3\xec\xcf\xb6\xa4\x009\xa20\xa9\x19osLU\xca\x1f\1\xc1\x85\xf3\xc1\xd2K\xf1\x87 \xa5]\x16\xd1\xa2Y\xb5M\x99\xa4', crc=b'p\xd7\xdbN\xc4\x08\x14\x8b\x7f\x80\xd8\xaeL\xdd nR\x8fE\xcb\x1a[\xcc\xfa\x84\xa4P\xbeAAX\x93', crc_good=True) 2023-05-16 17:52:53.344 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Got status update 2023-05-16 17:52:53.344 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Deciphered data = '{"protocol":4,"t":1684230772,"data":{"dps":{"11":179},"cid":"180821a9c6616407"}}' 2023-05-16 17:52:53.344 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Dispatching event event_status_updated to sub-device 180821a9c6616407 with data {'1': True, '4': 0, '7': 100, '9': 3833, '10': 'cancel', '11': 179, '12': 'manual', '14': False, '15': 9, '16': 'AAAAfwRqBG8AAQABAA==', '17': 'AA=='} 2023-05-16 17:52:53.345 DEBUG (SyncWorker_2) [custom_components.localtuya.common] [180...407] Received event event_status_updated from gateway with data {'1': True, '4': 0, '7': 100, '9': 3833, '10': 'cancel', '11': 179, '12': 'manual', '14': False, '15': 9, '16': 'AAAAfwRqBG8AAQABAA==', '17': 'AA=='} 2023-05-16 17:52:54.448 DEBUG (MainThread) [custom_components.localtuya.common] [180...407] Dispatching request request_set_dp to gateway with content {'value': False, 'dp_index': 1} 2023-05-16 17:52:54.448 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Received request request_set_dp from 180821a9c6616407 with content {'value': False, 'dp_index': 1} 2023-05-16 17:52:54.448 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Received request request_set_dp from 180821a9c6616407 with content {'value': False, 'dp_index': 1} 2023-05-16 17:52:54.448 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending command 7 (device type: v3.4) 2023-05-16 17:52:54.449 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending payload: b'{"protocol":5,"t":1684230774,"data":{"dps":{"1":false}},"cid":"180821a9c6616407"}' 2023-05-16 17:52:54.449 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] final payload for cmd 13: b'3.4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00{"protocol":5,"t":1684230774,"data":{"dps":{"1":false}},"cid":"180821a9c6616407"}' 2023-05-16 17:52:54.449 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number 49336 2023-05-16 17:52:54.449 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] payload b"\x00\x00U\xaa\x00\x00\xc0\xb8\x00\x00\x00\r\x00\x00\x00\x94\xb1v\x1b\xd1Z:$\xba\x99\xa2\xe97\xf5R\x9c\xd5\xf95\x90\xf3ww\x1a>\x1e\xec\xcbe3?\x13\x96}\x93\xe2\x1f;'\x07K\x9b\xf1q\x18\xa9-l)}\x18E/\x88\xb4\xe0\xb7\xc2\xcc4Km\xc7\x10\xb7\xe2\xa9\xef#\xf4V\x05\xda\x969,\xb8\xb4\x86\x18\x8d0\x17\xd9\xb4#L\x86\xcb\\x07R\xef\xe3\xbe\xb5\xf9nWf\xf7\xf2\xe6F\x8d\x8c6\xf3\r\xbeg\x89\xfa3\xb4\xa8\xfb\xc9BP\x02\xdd\x85f\xa5\x9f\x8b!\xc8\xb4\xfbuvip\xc2\x91\<n\x0f\xf6\x17l\xd5\x00\x00\xaaU" - MessagePayload(cmd=13, payload=b'{"protocol":5,"t":1684230774,"data":{"dps":{"1":false}},"cid":"180821a9c6616407"}') 2023-05-16 17:52:54.449 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Command 13 waiting for sequence number 49336 2023-05-16 17:52:54.573 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 13 TuyaMessage(seqno=49336, cmd=13, retcode=0, payload=b'', crc=b'P\x14\x94x\x1e\x8b\x16\x7f-\xd2\xe4\xe4H\t\x9fP\x15cw\x1a\xda\x07\xdf)\x92\xb9T\x89\x89\x11;', crc_good=True) 2023-05-16 17:52:54.573 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number 49336 2023-05-16 17:52:54.573 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] ACK received for command 13: ignoring it 2023-05-16 17:52:55.333 WARNING (MainThread) [homeassistant.components.light] Updating xiaomi_miot light took longer than the scheduled update interval 0:00:01 2023-05-16 17:52:55.810 DEBUG (MainThread) [custom_components.localtuya.common] [180...407] Dispatching request request_set_dp to gateway with content {'value': True, 'dp_index': 1} 2023-05-16 17:52:55.810 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Received request request_set_dp from 180821a9c6616407 with content {'value': True, 'dp_index': 1} 2023-05-16 17:52:55.810 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Received request request_set_dp from 180821a9c6616407 with content {'value': True, 'dp_index': 1} 2023-05-16 17:52:55.810 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending command 7 (device type: v3.4) 2023-05-16 17:52:55.810 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending payload: b'{"protocol":5,"t":1684230775,"data":{"dps":{"1":true}},"cid":"180821a9c6616407"}' 2023-05-16 17:52:55.810 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] final payload for cmd 13: b'3.4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00{"protocol":5,"t":1684230775,"data":{"dps":{"1":true}},"cid":"180821a9c6616407"}' 2023-05-16 17:52:55.810 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number 49337 2023-05-16 17:52:55.810 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] payload b'\x00\x00U\xaa\x00\x00\xc0\xb9\x00\x00\x00\r\x00\x00\x00\x84\xb1v\x1b\xd1Z:$\xba\x99\xa2\xe97\xf5R\x9c\xd5\xf95\x90\xf3ww\x1a>\x1e\xec\xcbe3?\x13\x960LV\xb1\xc8Y\x8f\xa6\xac\x86\xf4\xe8\xec\x16#\x86\xf9\xdaA\x17\x12\xe5\xdf\xc4\x06GU\xc0\xbe\xa7M\x19i\xf4;\xc0oK\xd6W\xc3\xa96\xc9C\x1e"&\x16\xac\xe1\\t\xa0\xcdE\x9e\xb1F\x9c\xe9\xfe}\xc5\x0c\x05/\xc2\x82\x80Ar\xc2\xa9U\x94\xb6\xc07\xcclK\'|\xc0\xee[\xa5^\xfb\xbc\xc5\xe2\x83\xad\xcb\x00\x00\xaaU' - MessagePayload(cmd=13, payload=b'{"protocol":5,"t":1684230775,"data":{"dps":{"1":true}},"cid":"180821a9c6616407"}') 2023-05-16 17:52:55.811 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Command 13 waiting for sequence number 49337 2023-05-16 17:52:55.892 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 13 TuyaMessage(seqno=49337, cmd=13, retcode=0, payload=b'', crc=b'\x9b\xc2\xe2\x0c;\xaf\xb0\xcd\x96\x15\xa4\xeemt\xc9\x13\x93\xacv\x7f\x90a\xa8D\xa4[3\xf1\x00\x86\x10', crc_good=True) 2023-05-16 17:52:55.893 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number 49337 2023-05-16 17:52:55.893 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] ACK received for command 13: ignoring it 2023-05-16 17:52:56.333 WARNING (MainThread) [homeassistant.components.light] Updating xiaomi_miot light took longer than the scheduled update interval 0:00:01 2023-05-16 17:52:56.394 DEBUG (MainThread) [custom_components.localtuya.common] [180...407] Dispatching request request_set_dp to gateway with content {'value': False, 'dp_index': 1} 2023-05-16 17:52:56.394 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Received request request_set_dp from 180821a9c6616407 with content {'value': False, 'dp_index': 1} 2023-05-16 17:52:56.394 DEBUG (MainThread) [custom_components.localtuya.common] [6c7...zsx] Received request request_set_dp from 180821a9c6616407 with content {'value': False, 'dp_index': 1} 2023-05-16 17:52:56.394 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending command 7 (device type: v3.4) 2023-05-16 17:52:56.394 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Sending payload: b'{"protocol":5,"t":1684230776,"data":{"dps":{"1":false}},"cid":"180821a9c6616407"}' 2023-05-16 17:52:56.394 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] final payload for cmd 13: b'3.4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00{"protocol":5,"t":1684230776,"data":{"dps":{"1":false}},"cid":"180821a9c6616407"}' 2023-05-16 17:52:56.394 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number 49338 2023-05-16 17:52:56.394 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] payload b"\x00\x00U\xaa\x00\x00\xc0\xba\x00\x00\x00\r\x00\x00\x00\x94\xb1v\x1b\xd1Z:$\xba\x99\xa2\xe97\xf5R\x9c\xd5\xf95\x90\xf3ww\x1a>\x1e\xec\xcbe3?\x13\x96\xdc\xef\xe3\xed\x04\x83)\x91\xa3\xe8\xd0\xb9\xa1\xe5\x1dW}\x18E/\x88\xb4\xe0\xb7\xc2\xcc4Km\xc7\x10\xb7\xe2\xa9\xef#\xf4V\x05\xda\x969,\xb8\xb4\x86\x18\x8d0\x17\xd9\xb4#L\x86\xcb\\x07R\xef\xe3\xbe\xb5\xf9nWf\xf7\xf2\xe6F\x8d\x8c6\xf3\r\xbeg\x89\xfa\xe9l\x14dj-1\xe4'$F\xbd\xb0\xc9\xf08J\x93\x7f\xf5u\xb09\x03\xfa\xc5u^\xab\x94\xa6\xf2\x00\x00\xaaU" - MessagePayload(cmd=13, payload=b'{"protocol":5,"t":1684230776,"data":{"dps":{"1":false}},"cid":"180821a9c6616407"}') 2023-05-16 17:52:56.394 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Command 13 waiting for sequence number 49338 2023-05-16 17:52:56.404 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching message CMD 13 TuyaMessage(seqno=49338, cmd=13, retcode=0, payload=b'', crc=b'\xd4=Z\xac0\xe4\x05j\xc5\xb8\xe5\xcc$\xef\xc3\xc7\x9c\xab\x88<\xbd\x81\x03i\xe92!Z\xfe\xb5\xd8\x19', crc_good=True) 2023-05-16 17:52:56.404 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] Dispatching sequence number 49338 2023-05-16 17:52:56.404 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c7...zsx] ACK received for command 13: ignoring it 2023-05-16 17:52:58.031 DEBUG (MainThread) [custom_components.localtuya] Device 6c7984edb1087dd187ozsx found with IP 192.168.22.208

alexualbu commented 1 year ago

thanks, @mikeinblue , it seems there might be some issue with controlling sub - devices - https://github.com/leeyuentuen/localtuya/issues/35#issuecomment-1555779530

mikeinblue commented 1 year ago

@alexualbu ,you are welcome.

caco3 commented 1 year ago

Is there news on this issue?

I have a https://www.amazon.de/dp/B09P3VRVVB/ref=pe_27091401_487027711_TE_SCE_dp_2 which I can't get working. I always is shown as "not available".

Gyosa3 commented 1 year ago

Hi, same issue here, I have purchased this product with a wifi>bluetooth gateway: https://www.amazon.de/-/en/Irrigation-Intelligent-Waterproof-Greenhouse-Agriculture/dp/B0BQ35QY5Z/

I've just installed integration 3.7.0 beta 10. The integration works with a smart bulb as a simple test device.

The integration finds and creates a gateway device. The dongle seems to work with protocol 3.4 so I set it up accordingly. The subdevice created manually in the config flow shows protocol 3.3 with no option to specify it anywhere else. The entities created for the sub-device are all unavailable. There is no log entry that I can find without debug mode.

Same test with an older Zigbee gateway: https://www.kabelshop.nl/Nedis-ZigBee-gateway-Nedis-SmartLife-Wifi-USB-WIFIZB10WT-i22004-t1438072.html

The integration finds and creates a gateway device. The dongle seems to work with protocol 3.3 so I set it up accordingly. I create a subdevice which is a 4-way switch. None of the 4 entities created is available. No error log either before or after reboot.

All devices work correctly in tuya app.

EDIT: OK! thanks to the other issue mentioned just above I managed to make all subdevices work by using the node_id instead of the device_id in the configuration dialog called "deviceID".

So now I am in the same situation that the dual water timer is well registered in HA, all DPs are updated correctly but they cannot trigger the device from HA.

I have tried to manually switch on both water outputs, and one was just triggering the switch entity, while the other was also setting a countdown timer of 10 minutes. So not sure which function actually triggers the timer.

The endpoints I have found for my device are: 11 - battery level 101 - normal timer > not found by LocalTuya but showing a coded value in Tuya portal 103 - countdown 2 104 - switch 2 105 - switch 1 106 - countdown 1 110 - use time 2 (duration of watering last time it was on) 111 - use time 1

Copyrighter commented 9 months ago

Hi, same issue here, I have purchased this product with a wifi>bluetooth gateway: https://www.amazon.de/-/en/Irrigation-Intelligent-Waterproof-Greenhouse-Agriculture/dp/B0BQ35QY5Z/

I've just installed integration 3.7.0 beta 10. The integration works with a smart bulb as a simple test device.

The integration finds and creates a gateway device. The dongle seems to work with protocol 3.4 so I set it up accordingly. The subdevice created manually in the config flow shows protocol 3.3 with no option to specify it anywhere else. The entities created for the sub-device are all unavailable. There is no log entry that I can find without debug mode.

Same test with an older Zigbee gateway: https://www.kabelshop.nl/Nedis-ZigBee-gateway-Nedis-SmartLife-Wifi-USB-WIFIZB10WT-i22004-t1438072.html

The integration finds and creates a gateway device. The dongle seems to work with protocol 3.3 so I set it up accordingly. I create a subdevice which is a 4-way switch. None of the 4 entities created is available. No error log either before or after reboot.

All devices work correctly in tuya app.

EDIT: OK! thanks to the other issue mentioned just above I managed to make all subdevices work by using the node_id instead of the device_id in the configuration dialog called "deviceID".

So now I am in the same situation that the dual water timer is well registered in HA, all DPs are updated correctly but they cannot trigger the device from HA.

I have tried to manually switch on both water outputs, and one was just triggering the switch entity, while the other was also setting a countdown timer of 10 minutes. So not sure which function actually triggers the timer.

The endpoints I have found for my device are: 11 - battery level 101 - normal timer > not found by LocalTuya but showing a coded value in Tuya portal 103 - countdown 2 104 - switch 2 105 - switch 1 106 - countdown 1 110 - use time 2 (duration of watering last time it was on) 111 - use time 1

  • extra DPs that are not visible in Tuya portal: 112 - status water line 2 113 - status water line 1 114 - rain and snow delay line 2 117 - rain and snow delay line 1

Hi, Where did You found "node_id" of the device? Thank You.