klali / ha-plejd

Plejd component for Home Assistant
Apache License 2.0
69 stars 16 forks source link

Light won't turn on #51

Closed Chetic closed 2 years ago

Chetic commented 3 years ago

I'm not sure what's wrong, I can't tell from the logs, but it seems the light state is not discovered. Here's what the entity looks like in HA when the physical light is actually on: image When I click the on-button it seems to time out and switches back to off. configuration.yaml:

light:
  - platform: plejd
    crypto_key: <redacted>
    devices:
      1:
        name: hallbelysning

log:

[homeassistant.loader] We found a custom integration plejd which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
[homeassistant.components.light] Setting up light.plejd
[custom_components.plejd.light] Discovered bluetooth adapter /org/bluez/hci0
[homeassistant.components.light] Setup of light platform plejd is taking over 10 seconds.
[custom_components.plejd.light] Discovered plejd /org/bluez/hci0/dev_D4_DB_C9_4E_97_4F with RSSI -76
[custom_components.plejd.light] Connecting to /org/bluez/hci0/dev_D4_DB_C9_4E_97_4F
[custom_components.plejd.light] Failed connecting to plejd service
[homeassistant.components.light] Platform plejd not ready yet: None; Retrying in background in 30 seconds
[homeassistant.components.light] Setting up light.plejd
[custom_components.plejd.light] Discovered bluetooth adapter /org/bluez/hci0
[custom_components.plejd.light] Disconnecting /org/bluez/hci0/dev_D4_DB_C9_4E_97_4F
[custom_components.plejd.light] Discovered plejd /org/bluez/hci0/dev_D4_DB_C9_4E_97_4F with RSSI -76
[custom_components.plejd.light] Connecting to /org/bluez/hci0/dev_D4_DB_C9_4E_97_4F
[custom_components.plejd.light] Successfully pinged with b5
[custom_components.plejd.light] Adding device 1 (hallbelysning)
[homeassistant.helpers.entity_registry] Registered new light.plejd entity: light.hallbelysning
[custom_components.plejd.light] All plejd setup completed
[custom_components.plejd.light] Successfully pinged with 69
[custom_components.plejd.light] No match for command 'b'001b'' (b'010110001b3d31256101')
[custom_components.plejd.light] No match for device '0b' (b'0b0110009801ffff00')
[custom_components.plejd.light] Turning on hallbelysning(01) with brigtness 00
[custom_components.plejd.light] Successfully pinged with d5
[custom_components.plejd.light] Turning on hallbelysning(01) with brigtness 00
[custom_components.plejd.light] Turning on hallbelysning(01) with brigtness 00
[custom_components.plejd.light] Successfully pinged with e4
[custom_components.plejd.light] No match for device '0b' (b'0b0110009801ffff00')
[custom_components.plejd.light] No match for command 'b'001b'' (b'010110001ba933256101')
[custom_components.plejd.light] Successfully pinged with bc
[custom_components.plejd.light] Successfully pinged with 0d
[custom_components.plejd.light] Turning on hallbelysning(01) with brigtness 00
  1. How do I know which number to use for the device in configuration.yaml? This is not mentioned in any documentation or issue.
  2. Should the crypto key be entered with quotes around it or not?
  3. How do I know if the crypto key has been accepted
klali commented 3 years ago

If you get to "All plejd setup completed" authentication worked and it's communicating succesfully with the Plejd mesh, so your cryptokey is fine, quotes or not doesn't matter.

The numbers for your devices are the output addresses you extract from the site.json, or your log will tell you about the devices present if you turn them on/off. The log is in hex and what you need to put in configuration.yaml is decimal (your device 0b mentioned in the log there needs to be 11 in the configuration).

Chetic commented 3 years ago

Oh right! Changing device number to 11 fixed it, thank you! Maybe use this issue to better handle incorrect values in configuration.yaml?

klali commented 3 years ago

Sure, or apparently documentation. Do you have any suggestions for how this should've been for it to be easier to get right?

Chetic commented 3 years ago

Documentation would've worked for me, yeah. Just a quick note below the configuration.yaml examples that explain how to get device numbers should be sufficient.