Template calculation

Hi, i am kind of new to templating and need som assistant.
Is it possible to make a template that calculates sensor.temperature_1 - sensor.temperature_2 and how would it look?
Thx guys!

You could use the Min/Max Sensor card

The result might look like this

image

Lovelace UI

    - type: horizontal-stack
      cards:
        - type: entities
          show_header_toggle: false
          entities:
            - entity: sensor.average_room_temp
              name: Average Temp
        - type: entities
          show_header_toggle: false
          entities:
            - entity: sensor.average_room_lux
              name: Average LUX




sensor:
  - platform: min_max
    type: mean
    name: average_room_temp
    entity_ids:
      - sensor.kitchen_temperature
      - sensor.living_room_temperature
      - sensor.bathroom_temperature
      - sensor.hall_temperature
      - sensor.landing_temperature
      - sensor.office_temperature
      - sensor.bedroom_temperature

  - platform: min_max
    type: mean
    name: average_room_lux
    entity_ids:
      - sensor.kitchen_light_level
      - sensor.living_room_light_level
      - sensor.bathroom_light_level
      - sensor.hall_light_level
      - sensor.landing_light_level
      - sensor.office_light_level
      - sensor.bedroom_light_level

customize:
sensor.average_room_temp:
  icon: mdi:thermometer-lines
sensor.average_room_lux:
  icon: mdi:brightness-6

Hope this helps :smiley:

{{ states.sensor.temperature_1.state|float - states.sensor.temperature_2.state|float }}

2 Likes

Thank you, worked like a charm!