-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Is there any way to set the level of precision for temp/humidity sensors? #708
Comments
Implemented, see documentation on how to use it. |
Thank you! Would it also make sense to have a global config equivalent to the device specific config in the main section of the configuration.yaml for when you always want parameters measured with a particular level of precision (including all future sensors)? |
I also noticed that even with precision set to 1 if the value returned by the sensor happens to be a whole number it returns an int rather than a float (ie missing the .0) |
I've installed 1.0.0 yesterday and made changes to the configuration.yaml to set the precision to 1 decimal instead of the default of 2. Restarted zigbee2mqtt but still receiving data with 2 decimals. I have set temperature and humidity values to have 1 decimal for 2 devices. |
@justmvg checkout the dev branch |
|
Thank you. I managed to make it work with the dev branch. |
Thank you so much for implementing device type specific defaults! https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed |
The problem of |
Does it matter when the intended output is a JSON string? Internally it can be numerical, but when being reported as part of a MQTT JSON string it could be considered seperate. |
I don't know, can home assistant still handle it? Does it automatically do the numeric conversion? |
My understanding of MQTT was that value types were inferred from the presentation of the JSON string. But I am about as far from an expert in the field as is possible. |
Yes that's true, but this JSON string can contain textual and numerical values. |
I guess trying it and seeing what happens is the only ay to be sure. But as far as I understand it's all a string until context turns it into whatever type it needs to be. |
Hey guys, I'm running the latest version of zigbee2mqtt and after adding the following, I'm still seeing the messages get sent with default precision settings. device_options: The - represents space Can't get it to format right in code format. This is put right after the serial: section and before the devices: section. What am I doing wrong? |
@mateuszdrab are you using the dev branch? |
I'm on master, makes sense. I can try that later, I need to open an issue for another matter as well. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The link is not working any more :( EDIT: Never mind, i'm stupid, found it.. |
Where should I put this: device_options: If I put this to HA configuration.yaml, I get error "Component error: device_options - Integration device_options not found." Also tried HA Configuration - > Customization -> Entitty: Humidity sensor -> add other attribute -> name: humidity_precision value: 1 -> Reboot |
Put it in devices.yaml or configuration.yaml (add-on) not HA. |
Hello, device_options: temperature_precision: 1 - the option works and it can be seen in the interface lovelace or z2m web ui When i check config in web ui -> Settings -> Raw : "device_options": { no "retain: true" and "humidity_precision: 1". Why? |
I normally use one decimal point of precision for my temp/humidity sensors and I searched but could not find any way to do this with zigbee2mqtt.
I know I could manually do it in a Home Assistant template but this would prevent the use of MQTT auto-discovery.
Thanks in advance.
P.S. Oh and I set pressure to zero decimal points of precision (ie whole numbers).
The text was updated successfully, but these errors were encountered: