klali / ha-plejd

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

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

Open bnordli opened 2 years ago

bnordli commented 2 years ago

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 commented 2 years ago

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.

dodg3r commented 2 years ago

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
bnordli commented 2 years ago

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?

dodg3r commented 2 years ago

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.

bnordli commented 2 years ago

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

bnordli commented 1 year ago

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.

klali commented 1 year ago

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?

bnordli commented 1 year ago

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.