Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95419

Template sensor from MQTT not working

$
0
0

@njsaunders wrote:

Hi all!

I’ve got two MQTT sensors for my BBQ ThermPro sensor which works great. The temperature is sent in degrees C, and I’d like to create two new sensors to show the value in degrees F. I’ve got the following config in configuration.yaml:

sensor:
  - platform: mqtt
    name: 'bbq_food_probe'
    device_class: "temperature"
    state_topic: 'sensors/rtl_433/Thermopro-TP12/81/temperature_1_C'
    unit_of_measurement: '°C'
    icon: mdi:thermometer
  - platform: mqtt
    name: 'bbq_chamber_probe'
    device_class: "temperature"
    state_topic: 'sensors/rtl_433/Thermopro-TP12/81/temperature_2_C'
    unit_of_measurement: '°C'
    icon: mdi:thermometer
  - platform: template
    sensors:
      bbq_food_probe_f:
        friendly_name: 'BBQ Food Temperature °F'
        entity_id: sensor.bbq_food_probe
        unit_of_measurement: '°F'
        value_template:  "{{ ((float(states('sensor.bbq_food_probe')) * 9 / 5 )  +  32) | round(1) }}"
        device_class: "temperature"
      bbq_chamber_probe_f:
        friendly_name: 'BBQ Chamber Temperature °F'
        entity_id: sensor.bbq_chamber_probe
        unit_of_measurement: '°F'
        value_template: "{{ ((float(states('sensor.bbq_chamber_probe')) * 9 / 5 )  +  32) | round(1) }}"
        device_class: "temperature"

Problems:

  1. In the states screen the values are just a replica of the source probe
  2. The “unit_of_measurement” for the new probe is degrees C, despite explicitly being defined as oF in configuration.yaml
  3. When I add the templated sensor to a dashboard, both sensors appear

Thanks for any assistance you can offer - Been playing with HA for about a week now and I’m addicted!

Thanks,

Neil

Posts: 9

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 95419

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>