zachowj / hass-node-red

Companion Component for node-red-contrib-home-assistant-websocket to help integrate Node-RED with Home Assistant Core
MIT License
470 stars 185 forks source link

Unit of Measurement Not Sticking #165

Closed tango2590 closed 1 year ago

tango2590 commented 1 year ago

I have a value coming into the sensor node that's in mL. Millileters is my end goal. When I create a sensor device and select Volume and mL in the entity config, it converts the state from mL to fl oz, but the "unit of measurement" is set as "fl oz." regardless of what I choose on the node. If I change the unit to fl oz in the entity config, it lets the payload (already in mL) pass through, but the unit of measurement still says "fl oz" in the dev screen. It seems that fl oz is the default unit of measurement regardless. I even tried creating a new entity, thinking maybe the initial unit got stuck, but no luck. Even manually adding the unit of measurement doesn't override the "fl oz".

zachowj commented 1 year ago

The unit of measurement you set in NR is the native_unit_of_measurement. If you want to change the measurement type on the front end you do that under the entity settings in HA.

tango2590 commented 1 year ago

Ah didn't realize that! I assumed setting the unit of measurement in the entity settings in NR would override any previously set settings. That totally fixed it. Thanks!