Can we use simple math in an automation?

I have multiple temperature and humidity sensor at home that I would like to use to better control my hvac.

For instance, I would like to be able to average all the humidity sensors and if below 40% start the humidifier or start the dehumidifier if above 60%. I might even want to use some weighting to give more importance to a sensor versus another one. Same for temperature.

I’m sure it’s doable but I haven’t figured it out yet.


What you’re looking for is called templating…

In it’s most basic form you can use it to create a sensor (or other entities) that are comprised of views of other items.

Like your math.

You could create a template sensor called sensor.my_awesomesensor that is your two sensors multiplied by each other, for instance.

Follow the doc and you’ll see options are really limitless the. Play around witbyour own templates in the Template Editor under Developer Tools.

I would use a helper sensor group to get the average and just use that in the automation.

1 Like

Awesome, thanks for the tip, will look into it!