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

Are we sure that all bindings accept properly a value in Kelvin and a value in mirek as command? #17917

Closed
andrewfg opened this issue Dec 17, 2024 · 16 comments · Fixed by #17919
Assignees

Comments

@andrewfg
Copy link
Contributor

          @andrewfg : I have a doubt, are we sure that all bindings accept properly a value in Kelvin and a value in mirek as command?

Originally posted by @lolodomo in openhab/openhab-core#3891 (comment)

@lolodomo
Copy link
Contributor

lolodomo commented Dec 17, 2024

Just to b clear, I am talking about method handleCommand in thing handlers that should accept a value in Kelvin o mirek.
Basic UI sends a value like "4000 K" so it should be supported by bindings, even those working with mirek internally.

@andrewfg
Copy link
Contributor Author

andrewfg commented Dec 17, 2024

AmazonEchoControl => Not Ok

AVMFritz => Ok

Bluetooth => TBD

TBD

Dali => Ok

Deconz = Not Ok

Govee => See #17812

Hue => Ok (albeit bad code)

Lifx => Ok

NanoLeaf => Ok

TapoControl => Not Ok

TpLinkSmartHome => Not Ok

Wiz => Ok

@andrewfg
Copy link
Contributor Author

andrewfg commented Dec 17, 2024

@mueller-ma
Copy link
Member

I think Tradfri doesn't support that as well. Here's a device:
grafik
(It says "Thing type: Colortemperature Bulb (white)")

And here are all channels, brightness and color are Dimmer:

grafik

@maniac103
Copy link
Contributor

I think Tradfri doesn't support that as well.

Right, but this issue is about a different topic: it's not about absolute color temperature not being supported, it's about absolute color temperature commands potentially not being handled correctly if supported.

@andrewfg andrewfg self-assigned this Dec 17, 2024
@blue-kaleidoscope
Copy link

Is this the reason why I receive an error "type" 2 since I switched to openHAB 4.3?

I just updated to 4.3 and since then I cannot change the color temperature of my deconz bound lights.
Logs say:
2024-12-18 13:21:03.115 [WARN ] [ernal.handler.DeconzBaseThingHandler] - Sending command 4000 °C to channel deconz:colortemperaturelight:raspi4:Deckenlampe_Hobbyraum_Mitte:color_temperature failed: 400 - [{"error":{"address":"/lights/2/state","description":"body contains invalid JSON","type":2}}]

Thing:

Bridge deconz:deconz:raspi4 [ host="<ip>", httpPort="8090", apikey="<key>", port="4431" ] {
        colortemperaturelight   Deckenlampe_Hobbyraum_Mitte                             "Deckenlampe Hobbyraum Mitte"           @ "Hobbyraum"   [ id="2" ]
}

Item:

Number:Temperature          Deckenlampe_Hobbyraum_Farbtemperatur
                "Farbtemperatur Deckenlampen Hobbyraum"
                <colorpicker>
                (Deckenlampen_Hobbyraum, Lampen_Farbtemperatur)
                ["Control", "ColorTemperature"]
                {
                    stateDescription=" "[
                            min="250",
                            max="454",
                            step="1"
                        ],
                    unit="mired",
                    homekit="Lighting.ColorTemperature" [minValue=250, maxValue=454],
                    nightshift= " " [startzeit="21:00"],
                    channel ="deconz:colortemperaturelight:raspi4:Deckenlampe_Hobbyraum_Buecherregal:color_temperature" [ profile="ruby:mired_to_kelvin" ],
                    channel ="deconz:colortemperaturelight:raspi4:Deckenlampe_Hobbyraum_Mitte:color_temperature" [ profile="ruby:mired_to_kelvin" ],
                    channel ="deconz:colortemperaturelight:raspi4:Deckenlampe_Hobbyraum_Schreibtisch:color_temperature" [ profile="ruby:mired_to_kelvin" ],
                    farbtemperatur=" " [
                            tageslicht=250
                        ]
                }

According to Error handling - deCONZ REST-API error "2" means "This will be returned if the JSON in the body couldn't be parsed."

No idea what I should do with it. 😳
Any recommendations?

@andrewfg
Copy link
Contributor Author

Is this the reason why I receive an error

Yes unfortunately that is indeed the case. We were "too fast" in improving the OH functionality.

It will in particular occur when you try to command the color temperature via the new Colortemperature picker control.

There is a fix in #17919 which will certainly appear in OH 5.0 and probably hopefully back ported into OH 4.3. @lolodomo ??

In the meantime, the work around for you is to command the channel from an item of type 'Number' rather than one of type 'Number:Temperature' (or from within rules send a plain number value e.g. 4000 rather than 4000 K.

@openhab-bot
Copy link
Collaborator

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

https://community.openhab.org/t/openhab-4-3-zigbee2mqtt-color-temperature-in-mired-not-working/160911/4

@blue-kaleidoscope
Copy link

First of all thanks for the reply. In this case I went back to 4.2 as Number typed items also throw the same error both on UI and via my JRuby defined rules.

@openhab-bot
Copy link
Collaborator

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

https://community.openhab.org/t/openhab-4-3-milestone-discussion/158139/115

@holgerfriedrich
Copy link
Member

holgerfriedrich commented Dec 29, 2024

KNX binding does not accept mirek/mired as unit for color temperature commands yet.

KNX uses defined data types, which only include K and °C for temperatures. DPT 7.600 DPT_Absolute_Colour_Temperature is intended for color temperatures, to other DPTs may be used, e.g. 14.069 DPT_Value_Absolute_Temperature.
Internally, the binding uses QuantityType.toUnit(K) which returns null for MIRED. I can change this to use toInvertibleUnit at least for DPTs that are K or °C.

Is this something I should do, or is it sufficient to listen to commands with unit °C and K?

(Refs: openhab/openhab-core#4507 (comment), openhab/openhab-core#4507 (comment))

@andrewfg
Copy link
Contributor Author

the binding uses QuantityType.toUnit(K) which returns null for MIRED.
I can change this to use toInvertibleUnit at least for DPTs that are K or °C.
Is this something I should do, or is it sufficient to listen to commands with unit °C and K?

See reference code here

@holgerfriedrich
Copy link
Member

@andrewfg thanks, this is what I basically did here to make it work 👍

The question I still have is basically about the use case. What are the bindings or devices that would send a color command to KNX binding in MIRED?

@lolodomo
Copy link
Contributor

What are the bindings or devices that would send a color command to KNX binding in MIRED?

A command in a user rule for example.

@holgerfriedrich
Copy link
Member

OK, thanks. PR for KNX is submitted, #18004.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants