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

[govee] binding crashes silently if receiving "wrong" values #17041

Closed
Bloodboy1986 opened this issue Jul 11, 2024 · 5 comments · Fixed by #17048
Closed

[govee] binding crashes silently if receiving "wrong" values #17041

Bloodboy1986 opened this issue Jul 11, 2024 · 5 comments · Fixed by #17048
Labels
bug An unexpected problem or unintended behavior of an add-on external bug A problem or unintended behavior of an external library

Comments

@Bloodboy1986
Copy link

Bloodboy1986 commented Jul 11, 2024

Expected Behavior

Locally control my govee lamps and receive the current status.
Even if the return values of a lamp are "wrong", the binding should not crash and control should still be possible.

Current Behavior

When receiving the current status of my H60A1 lamp, the binding crashes quietly and no new values can be received. Not even for other lamps!

Possible Solution

Ignore "wrong" values, but still allow the control.

Steps to Reproduce (for Bugs)

The following values cause the govee binding to crash silently without any log entrys:

{"msg": {"cmd": "devStatus", "data": {"onOff": 0, "brightness": 100, "color": {"r": 1, "g": 10, "b": 0}, "colorTemInKelvin": 9070}}}
If “colorTemInKelvin” >= 9070, the value of “onOff” does not matter.

{"msg": {"cmd": "devStatus", "data": {"onOff": 1, "brightness": 101, "color": {"r": 1, "g": 10, "b": 0}, "colorTemInKelvin": 9096}}}
If “onOff” = 1 and “brightness” >= 101.

Context

It is known that the H60A1 lamp returns "wrong" values via the local api. Govee has promised a solution/update for August...

https://community.openhab.org/t/govee-dreamcoulour-led-strips/84435/64

Your Environment

openHAB v4.1.3
ubunut 22.04.4 LTS

@Bloodboy1986 Bloodboy1986 added the bug An unexpected problem or unintended behavior of an add-on label Jul 11, 2024
@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/govee-dreamcoulour-led-strips/84435/67

@lsiepel
Copy link
Contributor

lsiepel commented Jul 12, 2024

This is in essential an external bug. The supplier promised a fix in the near future. The fix will probably be available before the next stable release. I doubt someone will pick this up and create a very temporary fix.

@lsiepel lsiepel added the external bug A problem or unintended behavior of an external library label Jul 12, 2024
@Bloodboy1986
Copy link
Author

That's right, but the binding shouldn't crash completely and stop working for other lamps either, should it?

At least a proper error handling without crash, but with log entry should be implemented...

@lsiepel
Copy link
Contributor

lsiepel commented Jul 13, 2024

The Thing remains online but unresponsive, just like the others? Can you provide a debug log ?

@Bloodboy1986
Copy link
Author

Maybe I didn't express myself precisely enough, since most of it has already been described in the thread...

Exactly, the binding "crashes" without there being a log entry, not even in the logging level DEBUG! The binding crashes in such a way that none of the defined things work anymore, not only the one with the "wrong" values...

2024-07-13 14:19:54.864 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'govee:govee-light:test' changed from UNKNOWN to ONLINE
2024-07-13 14:19:57.896 [TRACE] [.govee.internal.CommunicationManager] - Response from 192.168.222.246 = {"msg": {"cmd": "devStatus", "data": {"onOff": 1, "brightness": 250, "color": {"r": 1, "g": 10, "b": 0}, "colorTemInKelvin": 90701}}}
2024-07-13 14:19:57.898 [DEBUG] [.govee.internal.CommunicationManager] - processing status updates for thing Govee Light test 
2024-07-13 14:19:57.898 [TRACE] [.binding.govee.internal.GoveeHandler] - Receiving Device State
2024-07-13 14:19:57.898 [TRACE] [.binding.govee.internal.GoveeHandler] - newOnOff = 1
2024-07-13 14:19:57.898 [TRACE] [.binding.govee.internal.GoveeHandler] - newBrightness = 250
2024-07-13 14:19:57.898 [TRACE] [.binding.govee.internal.GoveeHandler] - newColor = Color[r=1, g=10, b=0]
2024-07-13 14:19:57.898 [TRACE] [.binding.govee.internal.GoveeHandler] - newColorTempInKelvin = 90701
2024-07-13 14:19:57.898 [TRACE] [.binding.govee.internal.GoveeHandler] - HSB old: 0,0,0 vs adaptedColor: 114,100,0
2024-07-13 14:19:57.898 [TRACE] [.binding.govee.internal.GoveeHandler] - UPDATING HSB old: 0,0,0 != 114,100,0
2024-07-13 14:19:57.899 [TRACE] [.binding.govee.internal.GoveeHandler] - Color-Temperature Status: old: 2000 K 1267% vs new: 90701 K
2024-07-13 14:19:57.899 [TRACE] [.binding.govee.internal.GoveeHandler] - Color-Temperature Status: old: 2000 K 1267% vs new: 90701 K
2024-07-13 14:19:59.863 [DEBUG] [.binding.govee.internal.GoveeHandler] - trigger Refresh Status of device Govee Light test
2024-07-13 14:20:04.864 [DEBUG] [.binding.govee.internal.GoveeHandler] - trigger Refresh Status of device Govee Light test
2024-07-13 14:20:09.865 [DEBUG] [.binding.govee.internal.GoveeHandler] - trigger Refresh Status of device Govee Light test

I have seen your pr and I think it should work like this :)
But shouldn't the try/catch also be extended to the brightness? Because here too the binding crashes at a value > 100...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on external bug A problem or unintended behavior of an external library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants