Hello, I have integrated a weather pressure sensor into home assistant using MQTT. It reports the pressure in hPa but I would like it to be inHg.
The MQTT yaml is:
- name: "Node 1 Pressure"
unique_id: "node_1_pressure"
state_topic: "msh/US/2/json/LongFast/!67ea9400"
state_class: measurement
value_template: >-
{% if value_json.from == 4038675309 and value_json.payload.barometric_pressure is defined %}
{{ (value_json.payload.barometric_pressure | float) | round(2) }}
{% else %}
{{ this.state }}
{% endif %}
device_class: "pressure"
unit_of_measurement: "hPa"
But when I switch it to convert the units you can see the graph will jump around from what I expect to 0, which it doesn’t do that if I don’t ask it to convert the values.
Graph when converted to inHg:
Graph when not converted:
It seems to be converting properly some times and not others. Just for confirmation I also used MQTTexplorer and got no random small values being reported:
I could do the conversion manually using a template sensor, but it feels like this functionality already exists in HA, but it is not working for me. Please let me know what I am doing wrong.