Skip to content
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

[Bug]: Beacon RBCGW light via gateway recognized but not able to integrate #423

Open
1 of 3 tasks
mrgionsi opened this issue Dec 14, 2024 · 15 comments
Open
1 of 3 tasks
Labels
bug Something isn't working

Comments

@mrgionsi
Copy link

LocalTuya Version

2024.12.1

Home Assistant Version

2024.11.3

Environment

  • Does the device work using the Home Assistant Tuya Cloud component?
  • Is this device connected to another local integration, including Home Assistant and any other tools?
  • The devices are within the same HA subnet, and they get discovered automatically when I add them

What happened?

A bug happened!

Steps to reproduce.

  1. Add new device
  2. select sub device
  3. fill all the options + Sub devices (all options are correct and auto filled in)
  4. Output error:
    Connection to device succeeded but no datapoints could be found. Please try set-up again. If problem persists, create a new issue (including debug logs).

I see DPS are empty in the logs, even setting them manually doesn't work.
I can paste them here from tuya dev if needed.

Relevant log output

2024-12-14 22:33:27.390 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] 3.4 or 3.5 device: negotiating a new session key
2024-12-14 22:33:27.390 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] final payload for cmd 3: b'0123456789abcdef'
2024-12-14 22:33:27.391 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Command 3 waiting for seq. number -102
2024-12-14 22:33:27.396 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching message CMD 4 TuyaMessage(seqno=51394, cmd=4, retcode=0, payload=b'\x85\xc3\xf1gV\xec\xafK|\x93\xe5\x06\x0c\xef4\xe5=\x8d\xa1\x03\n\xb7?\x16\x85\xc5\xa28,\xde\x9d\xba\x03@\xca\x8bQ\xbf3\xa1(\x17\x0e(\xca"\xb0I\\d\xff\xff\xa9\x8c~\xf23\x84\x87\xea\x14-.\xa5', crc=b'>\xbbE\x86$R\x1b\xef\xb3\xf3FA\xe4/\xa3\xc05>\xfd\xd1\xd0^\xa7\xcdI\xe1\x1a\x8a\xd7\x8c\x90\x0c', crc_good=True, prefix=21930, iv=None)
2024-12-14 22:33:27.396 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Got key negotiation response
2024-12-14 22:33:27.397 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] decrypted session key negotiation step 2: payload=b"b625264dadd4372a\x85\xef\xac\xce\xe8RX\xf5\x96'\xedE\xc4\x8eeU\xb9\xbagzz\xda\x17Fi.\xb1'G\xc4\x93\xce"
2024-12-14 22:33:27.397 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] final payload for cmd 5: b'\x99\xc8l\x0e\x9c\x96\xd7\x08l\xab\x1e\xa5\x84\x089\xa5\x85U\xcfd\x06@3\xcdF\xe5Q\xfb\xd1n\xf3t'
2024-12-14 22:33:27.450 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Session key negotiate success! session key: b'<\xc6\xc9\xa9e\xd0O\xddv\x7f*p\xdf`D\xb0'
2024-12-14 22:33:27.450 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending command 10 (device type: v3.4) DPS: None
2024-12-14 22:33:27.451 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending payload: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.451 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] final payload for cmd 16: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.504 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Command 16 waiting for seq. number 51395
2024-12-14 22:33:27.512 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching message CMD 16 TuyaMessage(seqno=51395, cmd=16, retcode=1, payload=b'\x93\xff\x92\x88\x8a\xd9I\xdb\xb03\x96*\x1az\x03\xb6\x84\x92\xcd\x1c"\xb5\xbf\xf0&\xd1@?\xc2\x00\xe4j', crc=b'\x05l$:\xd6\n\x16HftEd\xd1\xf5RE\x14\xca\xe6\xc1o\xe8M\x97\xd6\x0e-\x1b\x97$\xb0r', crc_good=True, prefix=21930, iv=None)
2024-12-14 22:33:27.512 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching sequence number 51395
2024-12-14 22:33:27.513 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending command 10 (device type: v3.4) DPS: None
2024-12-14 22:33:27.513 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending payload: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.513 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] final payload for cmd 16: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.556 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Command 16 waiting for seq. number 51396
2024-12-14 22:33:27.595 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching message CMD 16 TuyaMessage(seqno=51396, cmd=16, retcode=1, payload=b'\x93\xff\x92\x88\x8a\xd9I\xdb\xb03\x96*\x1az\x03\xb6\x84\x92\xcd\x1c"\xb5\xbf\xf0&\xd1@?\xc2\x00\xe4j', crc=b'W\xf8\xef=\xd3\x89P\xb5C\x01\xa6\xee"\xa2q\x86\xdc3l\xbe\x88/\x9c\xea]\x16\x94{Ml\x0c\x8c', crc_good=True, prefix=21930, iv=None)
2024-12-14 22:33:27.596 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching sequence number 51396
2024-12-14 22:33:27.596 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending command 10 (device type: v3.4) DPS: None
2024-12-14 22:33:27.597 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending payload: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.597 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] final payload for cmd 16: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.608 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Command 16 waiting for seq. number 51397
2024-12-14 22:33:27.614 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching message CMD 16 TuyaMessage(seqno=51397, cmd=16, retcode=1, payload=b'\x93\xff\x92\x88\x8a\xd9I\xdb\xb03\x96*\x1az\x03\xb6\x84\x92\xcd\x1c"\xb5\xbf\xf0&\xd1@?\xc2\x00\xe4j', crc=b'\tX@\x10\xc3\x0b\xf6??\xb0W\xe4\xea:(np\xfe\xc1\x86\xf5@\x9aixR\x1b\xae>\xa7\xa6\x98', crc_good=True, prefix=21930, iv=None)
2024-12-14 22:33:27.614 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching sequence number 51397
2024-12-14 22:33:27.615 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending command 10 (device type: v3.4) DPS: None
2024-12-14 22:33:27.615 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending payload: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.615 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] final payload for cmd 16: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.658 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Command 16 waiting for seq. number 51398
2024-12-14 22:33:27.698 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching message CMD 16 TuyaMessage(seqno=51398, cmd=16, retcode=1, payload=b'\x93\xff\x92\x88\x8a\xd9I\xdb\xb03\x96*\x1az\x03\xb6\x84\x92\xcd\x1c"\xb5\xbf\xf0&\xd1@?\xc2\x00\xe4j', crc=b'>p\xd8\x8b#\x87\x7f1*\xbd\xbb\xfb\x1e\x19~\xec\xabW\xf8\xc7\x8c\x82l\x8c8M\x18\xc6\x1a\x8c\xb4J', crc_good=True, prefix=21930, iv=None)
2024-12-14 22:33:27.698 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching sequence number 51398
2024-12-14 22:33:27.698 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending command 10 (device type: v3.4) DPS: None
2024-12-14 22:33:27.699 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending payload: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.699 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] final payload for cmd 16: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.710 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Command 16 waiting for seq. number 51399
2024-12-14 22:33:27.717 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching message CMD 16 TuyaMessage(seqno=51399, cmd=16, retcode=1, payload=b'\x93\xff\x92\x88\x8a\xd9I\xdb\xb03\x96*\x1az\x03\xb6\x84\x92\xcd\x1c"\xb5\xbf\xf0&\xd1@?\xc2\x00\xe4j', crc=b'\xcb\xbc\xe1\x1d\xa65\xb1+v\\\xa4\xe7\xb1\xfffn/Q?\xb3\x9b\xe2gN-"T\x05\x1d}\xf8U', crc_good=True, prefix=21930, iv=None)
2024-12-14 22:33:27.717 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching sequence number 51399
2024-12-14 22:33:27.718 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending command 10 (device type: v3.4) DPS: None
2024-12-14 22:33:27.718 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending payload: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.718 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] final payload for cmd 16: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.761 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Command 16 waiting for seq. number 51400
2024-12-14 22:33:27.801 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching message CMD 16 TuyaMessage(seqno=51400, cmd=16, retcode=1, payload=b'\x93\xff\x92\x88\x8a\xd9I\xdb\xb03\x96*\x1az\x03\xb6\x84\x92\xcd\x1c"\xb5\xbf\xf0&\xd1@?\xc2\x00\xe4j', crc=b'\x16\xd2)"/M6a\xf4\xb2\xe2\xed\x8a\xafs7\xed\x85\xca\xdb\x14\xd4\xef\xff\xa0\xed\x81)!\x0c\xea\x9b', crc_good=True, prefix=21930, iv=None)
2024-12-14 22:33:27.801 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching sequence number 51400
2024-12-14 22:33:27.801 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending command 10 (device type: v3.4) DPS: None
2024-12-14 22:33:27.802 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending payload: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.802 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] final payload for cmd 16: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.813 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Command 16 waiting for seq. number 51401
2024-12-14 22:33:27.819 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching message CMD 16 TuyaMessage(seqno=51401, cmd=16, retcode=1, payload=b'\x93\xff\x92\x88\x8a\xd9I\xdb\xb03\x96*\x1az\x03\xb6\x84\x92\xcd\x1c"\xb5\xbf\xf0&\xd1@?\xc2\x00\xe4j', crc=b'y\xce\x9c\x9aD\xfc\xa7\xa0\xf1\xd6\x87\x996\xcf\xa7\t\x97A{~>\xefY\xd3/\x81Q\x15\xe8\x10\xe8\xf0', crc_good=True, prefix=21930, iv=None)
2024-12-14 22:33:27.819 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching sequence number 51401
2024-12-14 22:33:27.819 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending command 10 (device type: v3.4) DPS: None
2024-12-14 22:33:27.820 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Sending payload: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.820 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] final payload for cmd 16: b'{"t":"1734215607","cid":"dc235044977e"}'
2024-12-14 22:33:27.873 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Command 16 waiting for seq. number 51402
2024-12-14 22:33:27.904 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching message CMD 16 TuyaMessage(seqno=51402, cmd=16, retcode=1, payload=b'\x93\xff\x92\x88\x8a\xd9I\xdb\xb03\x96*\x1az\x03\xb6\x84\x92\xcd\x1c"\xb5\xbf\xf0&\xd1@?\xc2\x00\xe4j', crc=b'\xe9\x13\x0bu\x1cG\x0eQ\x8bN\xf9H\xeefL\x1c\xa4\x07\x96\xcd\x01\xce,Su\xc2\x84L\x16\xb1#\x85', crc_good=True, prefix=21930, iv=None)
2024-12-14 22:33:27.905 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Dispatching sequence number 51402
2024-12-14 22:33:27.905 DEBUG (MainThread) [custom_components.localtuya.config_flow] [bf7...kca - Luce 1] Detected DPS: {}
2024-12-14 22:33:27.905 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Closing connection
2024-12-14 22:33:27.906 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Cleaning up session.
2024-12-14 22:33:27.910 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Connection lost: None
2024-12-14 22:33:27.910 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [bf7...kca] Cleaning up session.


### Diagnostics information.

_No response_
@mrgionsi mrgionsi added the bug Something isn't working label Dec 14, 2024
@xZetsubou
Copy link
Owner

is this BLE light? try add 0 in manual DPS

@mrgionsi
Copy link
Author

mrgionsi commented Dec 15, 2024

is this BLE light? try add 0 in manual DPS

Are these one https://it.aliexpress.com/item/1005006535865050.html

    "product_name": "Beacon RGBCW",
    "product_id": "ctmqpnjk",

From Tuya developer platform, the Query Properties the devices:
{ "result": { "properties": [ { "code": "switch_led", "custom_name": "", "dp_id": 1, "time": 1734188597249, "type": "bool", "value": true }, { "code": "work_mode", "custom_name": "", "dp_id": 2, "time": 1734186812123, "type": "enum", "value": "white" }, { "code": "bright_value", "custom_name": "", "dp_id": 3, "time": 1734186812123, "type": "value", "value": 10 }, { "code": "temp_value", "custom_name": "", "dp_id": 4, "time": 1734186812123, "type": "value", "value": 0 }, { "code": "countdown", "custom_name": "", "dp_id": 7, "time": 1734186812123, "type": "value", "value": 0 }, { "code": "colour_data_raw", "custom_name": "", "dp_id": 11, "time": 1734186812123, "type": "raw" }, { "code": "scene_data_raw", "custom_name": "", "dp_id": 12, "time": 1734186812123, "type": "raw" }, { "code": "music_data_raw", "custom_name": "", "dp_id": 13, "time": 1734186812123, "type": "raw" }, { "code": "local_timer", "custom_name": "", "dp_id": 17, "time": 1734186812123, "type": "raw" }, { "code": "timer_sync", "custom_name": "", "dp_id": 18, "time": 1734186812123, "type": "raw" }, { "code": "do_not_disturb", "custom_name": "", "dp_id": 34, "time": 1734186812123, "type": "bool", "value": false } ] }, "success": true, "t": 1734219889163, "tid": "680a1b03ba7511efae3a529172fa76b1" }

@xZetsubou
Copy link
Owner

Try add "0" in manual DPS field on device connection config step.

@mrgionsi
Copy link
Author

Hi @xZetsubou , thanks a lot for your comments.

Adding 0 to manual DPS automatically get all DPS.
image

After configuration completed, the status is always set to Unknown:
image

Do you know how can I get status set correctly?
Also, I would like to integrate colour mode with colour picker as light support it. How shall I fill the options?
With below configuration the colour picker is not working as expected. i.e. not setting the colour.. i tried with 3 as well for Color option
image

@xZetsubou
Copy link
Owner

xZetsubou commented Dec 15, 2024

Does the device works If you control from HA e.g. turn on/off or so.

If it does then status can't be pulled because this how some Bluetooth devices works they are "write_only" and can't read there status however there's a chance If you toggled the light manually while HA connected status will be updated.

As for color change supported set to first options where it starts with colour instead of manual

image

@Lurker00
Copy link

@mrgionsi Tuya BLE bulbs are write-only: it is not possible to read their states. Event Smart Life (or whatever app you use) does not reflect the true current state.

I'm testing a new version of MR, to replace #309, with better support of such bulbs, including scene selection. I hope @xZetsubou will approve it 😄

@mrgionsi
Copy link
Author

mrgionsi commented Dec 15, 2024

Thanks a lot both for your support. Colour change is happening, even I think is not reflecting the real colour. I will confirm you in the next days.
For on/off (rather than status) the state is not changing when pressing the button.

@mrgionsi
Copy link
Author

Hello,

Temp values and bright values work fine. If i try to use color mode doesn't work. During integration, color option left empty so I don't know what to select. Tried all combination but nothing..

I see from tuya there is a DP call colour_data_raw ID=11 but even adding in local tuya and using it doesn't work.
Any idea or suggestion?

@Lurker00
Copy link

@mrgionsi MR #425 adds "Write-only" option made for such bulbs. Then scenes and colors work, providing DP 11 (Color) and DP 12 (Scene) were chosen in the configuration. Also, there are Default, Color, Scene, Music in the Effects list, to switch the bulb to pre-selected values. You can also use them in automations.

I'm still thinking how to improve it even more, but the current state is better than nothing.

@mrgionsi
Copy link
Author

mrgionsi commented Dec 16, 2024

Thanks @Lurker00 , I will have a look. The point is that DP 11 and 12 are not discovered automatically, so I have to set them manually but even selecting it for color, the colour picker doesn't change the light colour.
image

I don't even see scene, could you please advice on this?
image

@mrgionsi
Copy link
Author

@mrgionsi MR #425 adds "Write-only" option made for such bulbs. Then scenes and colors work, providing DP 11 (Color) and DP 12 (Scene) were chosen in the configuration. Also, there are Default, Color, Scene, Music in the Effects list, to switch the bulb to pre-selected values. You can also use them in automations.

I'm still thinking how to improve it even more, but the current state is better than nothing.

Sorry, missed that issue was still open. Do we need to integrate in the next release, right?

@Lurker00
Copy link

Do we need to integrate in the next release, right?

Having skills, you may try to update your local version right now. Then, it's up to @xZetsubou to accept or not.

@mrgionsi
Copy link
Author

Hi @Lurker00 , are you referring to this ? https://github.com/Lurker00/hass-localtuya/tree/light-fixes-and-ble-support?

Because I added this repo as integration but I can't see any changes on this.

For information purpose only, which is the value for colour_data_raw which this light is expecting? I would like to test it into tuya_dev platform as well.

@Lurker00
Copy link

https://github.com/Lurker00/hass-localtuya/tree/light-fixes-and-ble-support?

Yes.

which is the value for colour_data_raw which this light is expecting?

BASE64-encoded 4 bytes of HSL: high and low byte of Hue (0-360), Saturation (0-100), Lightness (0-100). For instance:
"AHRSZA==" (00745264)
"APhNZA==" (00F84D64)

@mrgionsi
Copy link
Author

Hello,

sharing update:

Thanks @Lurker00 your fork works perfectly with BLE devices!! Even on/off works fine.

@xZetsubou Will it be integrated to your integration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants