6 New Home Assistant Input Helpers Explained!
In the recent April update of Home Assistant, a bunch of new input helpers were added that allow you to work with and transform your data in even more ways than were possible before - let's take a look at each one!
Video
Derivative
The first new input helper that was added is called the Derivative, which you’ve probably heard used in mathematics.
I’m no mathematician, that kinda stuff goes way over my head, but essentially the Derivative helper allows you to work out the rate of change of a value or sensor.
This might be useful for tracking values where you aren’t necessarily concerned with the actual current value, but rather you want to see how much it's changed over a given time period.
Some practical examples of this could be to track gas or energy consumption over an hour, maybe temperature or humidity in a room, or even how much water has flown through a sensor.
This could then allow you to run automations based on this value - one I could think of is if your tracking how much energy your solar panels are producing and you start seeing a large change in energy production, maybe that indicates it is a good time to start charging your car which kicks off an automation to do so.
Or perhaps you start seeing a rapid rise in humidity in your bathroom then start the extractor fan.
Riemann sum integral
Next up we have the Riemann sum helper - some of you may remember this from when we talked about it way back when Home Assistant Energy was first released - but as a refresher, the Riemann sum is a way of approximating the area underneath the curve on a graph.
Again, that's way over my head, but speaking about Home Assistant specifically, it’s a great way of converting power consumption from devices who measure in Watts, into a format that Home Assistant can use, like kWh.
For example, say you have a smart plug with energy monitoring, but the data it provides is measure in watts. However, energy companies, and therefor Home Assistant, expect energy values to be provided in kWh instead.
The Riemann sum integration can help you to track energy usage for that device that by transforming that Watts value, into kWh.
Min/Max
This next one is hopefully pretty self explanatory - the Min/Max helper.
This allows you to create a sensor that will track one of the following:
- Minimum
- Maximum
- Mean
- Median
- Most recently updated
The good thing with this helper, is that its not limited to one sensor - you can add a bunch of sensors in here and have it pull out the average value of all of those sensors together - useful if you want to track the average temperature throughout your house by combining all the rooms.
Threshold
Threshold is the next one on our list, and you can think of threshold like a fancy binary sensor that will turn on or off whenever a threshold is crossed.
You could, for example, have a threshold sensor for air quality - whenever air quality in a room gets to a certain value and crosses a threshold, the binary sensor turns on, and we can receive a notification to tell you to open a window.
The threshold sensor has both upper and lower limits allowing you to control the behaviour to suit your needs. It's a really nice simple way of getting a straight yes or no answer from a sensor to indicate something of importance has happened - this could also be used for other things like humidity, temperature, power, CPU utilization, error rate, and a bunch of metrics.
Times of Day
Next we have the Times of Day helper, and just like the threshold sensor, it is also a fancy binary sensor - a binary sensor that turns on if the current time is between two set values.
This is great for creating, just like the names suggests, times of days where you want things to happen.
For example, you may create times of day for morning, afternoon and evening so that you can create more tailored and custom text-to-speech messages.
You could also use it to create a morning mode between two times so that you can run a wake up routine with announcements.
It could also be useful for activating different scenes automatically depending on what time of day it is - yes you could do all of these things before, but I think this makes it easier and more obvious to beginners getting started to have a helper that does this.
Utility Meter
Our final helper is one that lots of you were asking about, the Utility Meter helper.
The Utility Meter helper allows you create a sensor that will track utility bills such as energy, gas, water or heating.
The cool thing about the utility meter is you can have it reset on a configured cycle, to follow your normal billing cycle.
You can also configure and set different tariffs for if you have a utility bill that changes price depending on time of the day.
If you configure it to reset the cycle on say for example a monthly basis, it will automatically keep the previous months value in the attributes, so you can compare month to month to see how much you are using - this one will be key for a lot of you out there who like to track energy usage!