-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.7.0 beta 10] BLE Gateway devices reporting state correctly, but cannot control devices #70
Comments
@zaa94 I am trying to get the same device working (https://www.amazon.de/dp/B09P3VRVVB/ref=pe_27091401_487027711_TE_SCE_dp_2) I tried it with UI config as well as with your config. In both cases I only see disabled entities: How did you get it working to sync the entities? |
Hey @caco3 ! The UI config did not work for me at all. Did you make sure that the device ID for the valve controller in the config file is the |
Yes, I think so. This is in localtuya:
- host: 192.168.1.170
device_id: bf641c545b9e1920da14vi
local_key: V+IuH~QWR`)v6A{r
friendly_name: Front Yard Gateway
protocol_version: "3.4"
is_gateway: true
- parent_gateway: bf641c545b9e1920da14vi
device_id: bf166cmaafamcows
friendly_name: Front Yard Sprinkler
protocol_version: "3.4"
entities:
- platform: switch
friendly_name: Front Yard Sprinkler Valve Switch
id: 1
- platform: sensor
friendly_name: Front Yard Sprinkler Valve Battery
id: 7
device_class: battery
unit_of_measurement: "%" And this is the discovery output of {
name: 'Wi-Fi hub',
id: 'bf641c545b9e1920da14vi',
key: 'V+IuH~QWR`)v6A{r'
},
{
name: 'Bewässerungscomputer',
id: 'bf166cmaafamcows',
key: 'U=bYOieeUKH6-O5x'
} |
@caco3 Yeah it looks like you're using the device ID for the sprinkler controller instead of the {
name: 'Front Yard Gateway',
id: '<GW_DEVICE_ID_REDACTED>',
key: '<GW_KEY_REDACTED>',
subDevices: [
{
name: 'Front Yard Valve Controller',
id: 'CONRTOLLER_DEVICE_ID_REDACTED',
cid: '<CONTROLLER_CID_REDACTED>' //USE THIS FOR THE SPRINKLER DEVICE ID IN YOUR CONFIG
}
]
} |
@zaa94 Thanks for your support. I tried now the latest The tricky part seems to be to get this |
@caco3 Just played around with the newer APIs on the Tuya IoT and I found a way to get it. You'll want to use the Query Device Details API and your |
Thank you very much! I saw the UUID but did not expect it to be the same as the cid. And I found the issue of the missing cid on the wizard output: I am able to see the valve status (dps 1): > tuya-cli get --ip 192.168.1.170 --id bf641c545b9e1920da14vi --key 'V+IuH~QWR`)v6A{r' --protocol-version 3.3 --cid f2a63e4085f363b6 --full
{
dps: {
'1': true,
'4': 0,
'7': 32,
'9': 7311,
'10': 'cancel',
'11': 599,
'12': 'manual',
'14': false,
'15': 1111
},
cid: 'f2a63e4085f363b6'
} Also I am able to switch it off: > tuya-cli set --ip 192.168.1.170 --id bf641c545b9e1920da14vi --key 'V+IuH~QWR`)v6A{r' --protocol-version 3.3 --cid f2a63e4085f363b6 --set off --dps 1
Set succeeded. But I cant switch it on: > tuya-cli set --ip 192.168.1.170 --id bf641c545b9e1920da14vi --key 'V+IuH~QWR`)v6A{r' --protocol-version 3.3 --cid f2a63e4085f363b6 --set on --dps 1
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Timeout waiting for status response from device id: bf641c545b9e1920da14vi')
at TuyaDevice.emit (events.js:303:17)
at /usr/local/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:434:12
at Timeout._onTimeout (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/p-timeout/index.js:25:13)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7) {
code: 'ERR_UNHANDLED_ERROR',
context: 'Timeout waiting for status response from device id: bf641c545b9e1920da14vi'
} Does this work for you? |
Appendix:
But I can not switch it on or off. Using the cli tool, I can switch it off, but not on. |
So I got it working now with cli, see TuyaAPI/cli#162 (comment) I guess that this is not yet handled correctly in localtuya |
Hi, I'm confused with the different IDs:
I was thinking. is there any chance that the node_id needed to register the subdevice is not the ID that is needed to place the commands? Which would be the device_id or this UUID mentioned above? thanks for any clarification! |
@Gyosa3 In the localtuya API, the |
ok thanks for the confirmation. So at least I understand the rationale up to the point of reading the DPs of subdevices via this identifier. then I hope that someone will understand why the commands are then in error. I thought that maybe the wrong identifier was passed on but if they are all the same... |
Hello, Same issue with a Zigbee generic switch device... I Can fetch its status but cannot control it. However, it was working before I've updated my gateway to latest firmware that seem to use 3.4 protocol. In the previous firmware (which I have not done a backup :/) it was working fine with 3.6 release and 3.3 protocol. Unfortunately I have not found a way to downgrade it... |
Hello, For anybody stumbling on this, there is a patch workaround to fix switch devices and restore its control abilities: You should add the lines below to the file "/config/custom_components/localtuya/pytuya/init.py", after line 1378, considering you are using the release *"3.7.0 Beta 10"**:
Here is a screenshot on how it should look like: all credits to the guys from #65 |
I have updated to https://github.com/leeyuentuen/localtuya/tree/3.7.0-beta.11 and confirmed it still working ;) Thanks! |
The problem
I have two BLE Diivoo water valve timers (Tuya category
sfkzq
) each with a WiFi gateway (Tuya categorywg2
) that I've got setup with v3.7.0b10 . I only have the switch and battery level entities configured as that's all I need for my current setup. Both the switch state and battery level state appear to be syncing correctly, but when I attempt to turn on/off the switch to either valve, nothing happens. According to the logs, it looks like once the payload is sent, it hangs, then once it receives an ACK, it stops.Environment
Configuration
configuration.yaml
orconfig_flow
DP dump
Gateway DPs
Valve Controller DPs
Provide Home Assistant taceback/logs
2023-06-22 16:11:42.840 DEBUG (MainThread) [custom_components.localtuya.common] [BACK_YARD_CONTROLLER_CID] Dispatching request request_set_dp to gateway with content {'value': True, 'dp_index': 1} 2023-06-22 16:11:42.841 DEBUG (MainThread) [custom_components.localtuya.common] [BACK_YARD_GW_ID] Received request request_set_dp from BACK_YARD_CONTROLLER_CID with content {'value': True, 'dp_index': 1} 2023-06-22 16:11:42.841 DEBUG (MainThread) [custom_components.localtuya.pytuya] [BACK_YARD_GW_ID] Sending command 7 (device type: v3.4) 2023-06-22 16:11:42.842 DEBUG (MainThread) [custom_components.localtuya.pytuya] [BACK_YARD_GW_ID] Sending payload: b'{"protocol":5,"t":1687475502,"data":{"dps":{"1":true}},"cid":"BACK_YARD_CONTROLLER_CID"}' 2023-06-22 16:11:42.842 DEBUG (MainThread) [custom_components.localtuya.pytuya] [BACK_YARD_GW_ID] final payload for cmd 13: b'3.4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00{"protocol":5,"t":1687475502,"data":{"dps":{"1":true}},"cid":"BACK_YARD_CONTROLLER_CID"}' 2023-06-22 16:11:42.844 DEBUG (MainThread) [custom_components.localtuya.pytuya] [BACK_YARD_GW_ID] Dispatching sequence number 14629 2023-06-22 16:11:42.844 DEBUG (MainThread) [custom_components.localtuya.pytuya] [BACK_YARD_GW_ID] payload b'\x00\x00U\xaa\x00\x009%\x00\x00\x00\r\x00\x00\x00\x84v\xff\x1f\xf7hX&\xaa\xad\x88;\x03\x1e\xf7\x1dD\xd5\xe4\x17q\x16\xd0\xcd\xd7\xf5pr\x01H\xd0a\x95\x9d\xfb"\xeb\x8f\xab\x97s\xd6$I!\x81Z\xcf\xa7\x079\x14\xc0b\xd0/\xc0\xbd\x1a*\xddS\xe8}Wr\xe2|\xf1"\xddm\x0ezaK6\x94J\x87\xac\x86\x85\x9e\x98\x18\xb3-\'\x80\x8e<\xc7\xa3\xf9\xac!5\xed1\xfc\x80&\xe6>M\x16n\x99\xf51\xcc;\xfc\xb3Bys\xa8\xdc\xcc\x8c\xbb\x08\xa2J\xb4\x9f\xcf\x00\x00\xaaU' - MessagePayload(cmd=13, payload=b'{"protocol":5,"t":1687475502,"data":{"dps":{"1":true}},"cid":"BACK_YARD_CONTROLLER_CID"}') 2023-06-22 16:11:42.844 DEBUG (MainThread) [custom_components.localtuya.pytuya] [BACK_YARD_GW_ID] Command 13 waiting for sequence number 14629 2023-06-22 16:11:42.855 DEBUG (MainThread) [custom_components.localtuya.pytuya] [BACK_YARD_GW_ID] Dispatching message CMD 13 TuyaMessage(seqno=14629, cmd=13, retcode=0, payload=b'', crc=b'\x074\x07\xb34\x18i%\xac\xb8\xd0\xc3\x18j\xf5\xffy\xed\x9d\xdd\xf5\xed;\xben"\xe9\t\xe7\xf4\xbd"', crc_good=True) 2023-06-22 16:11:42.855 DEBUG (MainThread) [custom_components.localtuya.pytuya] [BACK_YARD_GW_ID] Dispatching sequence number 14629 2023-06-22 16:11:42.856 DEBUG (MainThread) [custom_components.localtuya.pytuya] [BACK_YARD_GW_ID] ACK received for command 13: ignoring it
Additional information
Gateway Information
Valve Controller Information
The text was updated successfully, but these errors were encountered: