@raenrfm wrote:
I’m trying to take the values from my weather station which are posting to my mosquitto broker. The temperature is in F and the pressure is in inHg. I’m trying to use a value_template to convert these to MKS units or C and kPa respectively. I have battled with this for hours and it is not making any sense to me. I am new to HA so I’m probably missing something obvious, but any help would be appreciated. Here is my sensors.yaml:
- platform: mqtt name: "SOC" state_topic: "weather/soc" unit_of_measurement: '%' - platform: mqtt name: "Indoor Temperature" state_topic: "weather/inTempC" unit_of_measurement: '°C' - platform: mqtt name: "Indoor Humidity" state_topic: "weather/inHumidity" unit_of_measurement: '%' - platform: mqtt name: "Outdoor Temperature" state_topic: "weather/outTemp" unit_of_measurement: '°F' - platform: mqtt name: "Outdoor Humidity" state_topic: "weather/outHumidity" unit_of_measurement: '%' - platform: mqtt name: "Barometric Pressure" state_topic: "weather/pressure" unit_of_measurement: 'kPa' - platform: template sensors: outdoor_temperature_c: friendly_name: "Outdoor Temperature" unit_of_measurement: '°C' value_template: "{{ (states('sensor.outdoor_temperature') | (float-32)/1.8) | round(1) }}" barometric_pressure_kpa: friendly_name: "Barometric Pressure" unit_of_measurement: 'kPa' value_template: "{{ (states('sensor.barometric_pressure') | (float+0.83)*3.38639) | round(1) }}"
Posts: 4
Participants: 2