ha-plejd icon indicating copy to clipboard operation
ha-plejd copied to clipboard

Convert code to full integration with support for input and events from Plejd

Open bnordli opened this issue 3 years ago • 8 comments

  • The light platform is kept mostly as-is, with slightly better detection of dimmable non-dimmable lights
  • A switch platform is added, functioning exactly the same as a non-dimmable light (just a different HA UI)
  • A binary_sensor platform is added for wireless buttons (WPH-01)
  • A sensor platform is added for rotary buttons (WRT-01, VRI-02)
  • Events are added for button presses and scene activations
  • A HA service is added to trigger Plejd scenes

As part of the rewrite, the Plejd communication is isolated to the PlejdService and PlejdBus classes, and the code is rewritten to adhere to HA code standards.

Also note that the yaml configuration has changed significantly and must be rewritten if an existing installation is updated.

bnordli avatar Oct 02 '21 17:10 bnordli

After testing this weekend: I could not get the physical button inputs on the pucks to send sensible BLE messages (and even getting a Plejd ID assigned), so I had to remove binary_sensor support for those.

bnordli avatar Nov 01 '21 08:11 bnordli

Hi. I have a REL-02 with firmware 1.0.5 that shows up as an on/off light but my other REL-02 with firmware 1.1.4 shows as a dimmer.

2021-11-24 16:03:05 DEBUG (MainThread) [custom_components.plejd.light] Turning on Taklampa garage2 (11) with brightness 00
2021-11-24 16:03:06 DEBUG (MainThread) [custom_components.plejd.plejd_service] Received message 0b0110009801000000
2021-11-24 16:03:06 DEBUG (MainThread) [custom_components.plejd.light] Taklampa garage2 (11) turned on
2021-11-24 16:03:39 DEBUG (MainThread) [custom_components.plejd.light] Turning on Fönster v.rum (22) with brightness 00
2021-11-24 16:03:40 DEBUG (MainThread) [custom_components.plejd.plejd_service] Received message 160110009801ffff00
2021-11-24 16:03:40 DEBUG (MainThread) [custom_components.plejd.light] Fönster v.rum (22) turned on with brightness ffff

dodg3r avatar Nov 24 '21 15:11 dodg3r

Any output will be shown as dimmable if it at any time has reported a brightness value.

Can you go to http://ha-url/developer-tools/state and set the faulty light to color_mode: onoff and see if it stays that way or reverts to being dimmable?

bnordli avatar Nov 24 '21 16:11 bnordli

Any output will be shown as dimmable if it at any time has reported a brightness value.

Can you go to http://ha-url/developer-tools/state and set the faulty light to color_mode: onoff and see if it stays that way or reverts to being dimmable?

It reverts to dimmable after ha restart.

dodg3r avatar Nov 24 '21 17:11 dodg3r

The above issue is now fixed, by making a light dimmable only if it any time its brightness values has changed.

bnordli avatar Dec 13 '21 20:12 bnordli

This PR is now updated with the recent changes that has been merged into master. The write_data service has been tested locally. The endpoints configuration is picked up, but I haven't tried to force a specific connection.

Please consider accepting this PR or make a statement that you don't want to take it, since almost any other PR will have merge issues with this one.

bnordli avatar Apr 09 '23 19:04 bnordli

Hi :)

I haven't spent real time on this in some time, when/if I spend time on plejd again I will probably try to contribute to https://github.com/thomasloven/hass_plejd/ rather than continue this integration.

My only issue with this is that it adds a significant amount of code and changes to something I'm not likely to continue supporting for very long. Do you have opinions here?

klali avatar Apr 14 '23 08:04 klali

Thanks for your input, I certainly do understand!

I also have contributed to hass_plejd and will probably migrate to that once it becomes a little more mature, so I don't really mind if you don't plan to keep supporting this project.

I just wanted to contribute back with something that has been working for me the last 18 months :)

I'll leave the PR open for others to discover the possibilities within, and let you decide if you want to merge it.

bnordli avatar Apr 14 '23 21:04 bnordli