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
[mqtt] Binding doesn't work with Units Of Measurement #6751
Comments
One could discuss if throwing the exception (instead of rejecting the command) is a bug but supporting UoM is difficult and not supported at the moment. |
At least there should be an entry in the documentation, that Units Of Measurement are not supported by the binding. |
I am not sure, if I understand the problem correctly. Let's see: If we need to do it in |
Comment: bindings that support UoM do so because they can discover from the devices themselves that some data both represents, say, a temperature and what units it comes in. But you as the user might well know that device X data Z does represent a QuantityType, e.g. if it sends 18.0 it always means 18.0mph or whatever. Strikes me that what is needed is a channel profile that allows you to interface a binding regular number channel with an OH QuantityType Item. |
@PascalTurbo Can you check, if #6763 solves your problems? |
Homie does have UOM. However, the MQTT Homie binding handles a percentage UOM in a non intuitive way. Homie properties that are a percent only accept values between 0 and 1. Most would expect a percent value range to be 0-100. @Rossko57 in theory that is what Homie should accomplish. But it needs more work. |
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/mqtt-automatic-quantitytype-conversion-kwh-wh-does-not-work/101417/4 |
I have a Homie property defined as:
This shows up as a Dimmer channel in the UI, and is linked to a Dimmer item, and everything works just fine. I also have a similar one that is a $datatype => float, but otherwise defined the same (0:100 range, Dimmer in OpenHAB) that also works the same. Are you trying to link to a Number item instead? I did that once, and noticed that the commands were coming through as say 0.25 on the MQTT side. But I don't see anything that says Homie properties that are a percent only accept values between 0 and 1. The spec says (https://homieiot.github.io/specification/#percent) |
I think it is the openHAB side that has the problem. If you pass a number with no unit to a Number:Dimensionless type (as usually used for %) it is accepted as a valid Quantity, but expressed as a NN:1 ratio. 70% becomes 0.7 The percentType used in Dimmer Item or channel types is not the same as the Quantity Type used in Number:Dimensionless Items or channels. |
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/mqtt-binding-and-units-of-measurement/127026/3 |
When trying to add a channel to an Item with Unit of measurement, like for example Number:Temperature, MQTT Binding isn't able to process this item and throws an exception:
The text was updated successfully, but these errors were encountered: