Combing two sensors together using template

Tags: #<Tag:0x00007f326de8dc98>


I’ve been trying to come up with a solution for my home, I have multiple reptiles and they are all managed by home assistant. i need to combine two sensors into a single value. For example I need to take sensor.reptile.1 and `sensor.reptile.2’ add them together. then divide them by 2 so i get the average of them both. is there anybody that can help me with this. I’m sure it will be much simpler to somebody else as i never use math in templates.

value_template: "{{ ( states('sensor.reptile.1')|float + states('sensor.reptile.2')|float )/2 }}"

As an alternative to a template sensor you can use the min/max integration.

  - platform: min_max
    type: mean
      - sensor.reptile.1
      - sensor.reptile.2

I’m intrigued. Tell me more about these reptiles.

Oh! Insane i didnt know that it could generate the mean on the fly like that! Thanks!

We have… 3 Bearded Dragons, chameleon, iguana, two leopard geckos, poison dart frog, collard lizard and a praying mantis :stuck_out_tongue: HA looks like this…

1 Like

Thanks! Quite a collection and an interesting application of Home Assistant.

Its the automations that are insane haha… a simple HA restart is just a pain in the bum :'D