-
-
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
[miio] Add Zhimi Heater za1 #8743
Conversation
add model zhimi.heater.za1 Signed-off-by: Marcel Verpaalen <[email protected]>
Travis tests were successfulHey @marcelrv, |
Number relative_humidity "Relative Humidity" (G_heater) {channel="miio:basic:heater:relative_humidity"} | ||
Switch childlock "Child Lock" (G_heater) {channel="miio:basic:heater:childlock"} | ||
Switch HWSwitch "HW Switch" (G_heater) {channel="miio:basic:heater:HWSwitch"} | ||
Number temperature "Temperature" (G_heater) {channel="miio:basic:heater:temperature"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use units here?
Number temperature "Temperature" (G_heater) {channel="miio:basic:heater:temperature"} | |
Number:Temperature temperature "Temperature" (G_heater) {channel="miio:basic:heater:temperature"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the honest answer is... I don't know.
The documentation https://www.openhab.org/docs/developer/bindings/thing-xml.html#channels does not have much explanation,
I'm not too clear anymore on the difference between the Number:Temperature vs channel-type <category>Temperature</category>
vs new QuantityType<>(temperature, SIUnits.CELSIUS));
as I create all channels dynamically, is it enough to just change the datatype to Number:Temperature when the channel is created like: Channel newChannel = ChannelBuilder.create(channelUID, datatype). .withLabel(friendlyName).build();
And if I create it that way, does it require the quantity type in the update or not...
anyway... in my wishlist #7276 I do have the wish to somehow implement this... but is not too high on my priority list... as I don't understand it well enough, don't understand the big advantage if it is there.... and am bit afraid it breaks things...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as I create all channels dynamically, is it enough to just change the datatype to Number:Temperature when the channel is created like: Channel newChannel = ChannelBuilder.create(channelUID, datatype). .withLabel(friendlyName).build();
Yes, that is all that would be necessary. At that point you just need to use QuantityType instead of DecimalType for those relevant channels. and also make sure to use QuantityType.toUnit()
when processing the state from handleCommand
.
QuantityType allows users to use different units for their UI. For example a binding may report temperature in C but the user wants it displayed as F.
You don't need to make the transition just yet, but please plan for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, made placeholder #8756 for it.
Temperature updates are fine, but still need test how to conveniently go from a unit string to a Unit
e.g. from "Celcius" to Units.CELSIUS in a generic way
add model zhimi.heater.za1 Signed-off-by: Marcel Verpaalen <[email protected]>
add model zhimi.heater.za1 Signed-off-by: Marcel Verpaalen <[email protected]>
add model zhimi.heater.za1
Signed-off-by: Marcel Verpaalen [email protected]