-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[govee] Fix brightness vs. color synchronization #17812
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: AndrewFG <[email protected]>
@felixschndr you can download the jar for test purposes below. Uninstall the standard binding, then unzip the file below and drop it in your /addons folder. |
Signed-off-by: AndrewFG <[email protected]>
Can we add the |
This comment was marked as outdated.
This comment was marked as outdated.
I also noticed something about color temp: The color temp abs works fine, I defined a min and max in the sitemap so I can only send values that are supported by the lamp. |
Two things..
|
PS you also mentioned that you have a lamp which is not (yet) supported .. can you provide more info about it .. and I will see if I can fix that too.. |
This comment was marked as outdated.
This comment was marked as outdated.
Is the H60A1 the one on 192.168.4.237 ?? You say it works fine. But you also say it reports an error.. |
Yeah, it would be.. |
Yes it is.
You mean the |
I will add your H60A1 to the properties file. This simply allows to display a clear text label in the thing properties. However this DOES not solve the "thing Handler .. couldn't be found" error. If you say that 1) it works, and 2) it shows the error message, then this probably means that you have two duplicate things defined on the same IP address, and one is working, and the other is giving the error. Or something like that. |
Signed-off-by: AndrewFG <[email protected]>
That's not it. I double checked the MainUI and the config files. I only got this one Govee Edit: Weird… After removing the comment (adding the thing again) the message does not come up again. After restarting the binding the message appears again |
Can you please create a |
One thing that could be useful: A string channel which states whether the lamp is in color temp mode or in color color mode. I think that could become pretty useful in some rules. Would it be possible to implement that? Thank you very much for your work!! |
I noticed that the color temp must be a
This is with the
Can we change this such that a |
Could you provide a trace log around that sequence of events? |
I would like to focus on fixing the bug(s) first, before we consider extending the features. |
Not really. If you look at the CIE color space you will see that color temperatures are points which lie on the Planckian locus within the color space. And when you command a Govee lamp to a particular CT it causes the lamp to select an RGB value (i.e. color XY value) for that point. Therefore when you send a new CT, both the CT channel, and ALSO the Color HSB channel will be updated to match. Or to say it in other words, there is no such thing as Color resp. Color Temperature mode. EDIT: however the color temperature channels will be UNDEF if the color point is NOT on the Planckian locus. So that would perhaps be the indicator that you are looking for. |
Signed-off-by: AndrewFG <[email protected]>
The Jar in the post above has now been updated to the latest commit. |
Apropos the "handler couldn't be found" .. when a lamp sends an update, the code takes one of two possible forks -- namely if the handler can be found it processes the update, and if it can't be found it outputs the error message. However you are saying that it does both, which is a kind of Schroedinger cat condition... |
Sadly I cannot recommend them. I saw that deal as well and bought them. The ceiling lamps I bought (the H60A1 I am testing with at the moment) are great: For 42€ you get a lamp that is really bright, can do RGB+CTT, shines to the bottom and top and looks good.
Can only recommend them!! For the small govee bulbs the story is a bit different... After the success with the ceiling lights I was happy to invest more. However they are pretty dim and dont support the LAN API.
Yes, thank you @andrewfg !
Good to know ;-)
@stefan-hoehn Yes, it IS supported. Tested it, shows LAN-API in the app, works with OpenHAB. After buying the first one and being so happy I bought 3 more (4 in total now). The light is really nice, can get nice and cozy warm. Also the brightness is incredibly (only use it at like 40-50% during the day) but can get pretty dim too.
New version works! Thank you very much! :) |
Ouch, that's ugly. Your solution seems appropriate in that case. |
@andrewfg Can you tell me why the binding needs the MAC address of the lamp in addition to the IP/hostname? |
Honestly I don't know. The thing xml description mentions the existence of such a property. But I think it is functionally not used. However it could be displayed (for information) on the Main UI page for the thing. Along with the model description etc. |
It is very lightweight in terms of CPU load in the device. It can simply fire-and-forget without any overload of building and maintaining a full TCP socket connection. |
It is used as the unique identifier for the binding:
Why are you asking? |
I wasn't wondering why they used UDP, but why they don't send a response for each request (over UDP). Anyways, we can't change that either way. |
I was wondering why it is necessary to define it. Many binding only use one of the two (mostly IP/hostname). It is one more step for the user to find out the MAC and copy it to the config. |
One thing regarding hostname vs IP: I define all my things with hostnames, however the logs always state the IP which I then have to look up. Can we change the logs such that it always states the host as it is defined in the
|
Short answer is no. Not if the handler is not yet found. But I will make some changes.. |
Signed-off-by: AndrewFG <[email protected]>
Signed-off-by: AndrewFG <[email protected]>
This is for @maniac103 as a connoisseur if gnarly thread synchronization code: I feel deeply uncomfortable calling |
Signed-off-by: AndrewFG <[email protected]>
Signed-off-by: AndrewFG <[email protected]>
I totally agree it's a good idea to move the communication to a scheduler thread. The solution seems slightly over engineered to me though ;-) Wouldn't it be sufficient to collect a list of runnables, and scheduling a single scheduler task which then executes them sequentially, sleeping in between their execution? I realize that means making a thread sleep again (which your solution carefully avoids), but since it's a scheduler thread now and the delay is 300ms at most (4 calls with 100ms in-between) that seems OK. One could likely also shrink the delay to say 50 or 30ms and then it becomes a total non issue. Advantage of doing so would be avoiding any potential threading issues between the various tasks and the final 'collection' of those. |
Another option I just found: CompletableFuture ... that one (with the methods runAsync/thenRunAsync) looks like it has exactly the semantics we need here :-) |
Just my 2cents: while I am blown away by all the effort you put into that , I am kind of afraid if it still works reliably after such a major change (maybe even better though as well). Anyways, I did a lot of tests in the past after @maniac103 and Kai finalized the binding and made sure it works reliably. I think we should then do quite some testing with a number of devices at the same time in the network. |
I can't get my head around CompleteableFuture so I am going with the option mentioned above. |
I understand your concerns. But I am, of course, sure it will work better. :) |
Signed-off-by: AndrewFG <[email protected]>
@maniac103 I just committed a second much simpler attempt at thread synchronization. @stefan-hoehn / @felixschndr the revised Jar for testing is in the post at the top. |
Signed-off-by: AndrewFG <[email protected]>
Signed-off-by: AndrewFG <[email protected]>
@felixschndr more observations on your question about detecting if the thing is "in color temperature mode"..
|
@stefan-hoehn today I received my H615A Black Friday purchase, and have been testing it this afternoon. I found that the auto discovery does not work (separate issue opened). However when I configured the thing manually, it all seems to work fine. |
I have a "H6159" which is, AFAIK, pretty similar and worked on auto-discovery reliably. Can you verify if it behaves the same with the milestone version? |
Yes it failed on the milestone release. |
@stefan-hoehn a few notes on my testing regime => is there anything that you want to add to this?
|
Resolves #17807
Also includes the following..
Signed-off-by: AndrewFG [email protected]