Derivative sensor

I am missing a sensor that would take input from another sensor and display the derivative of that sensor.
I.e. for a sensor displaying distance (e.g. a car odometer sensor), it would display speed. For a sensor displaying amount of data transferred (for e.g. a modem), it would display data transfer rate. For a sensor displaying temperature, it would display temperature change. Etc.

Would that be usefule to anybody else? Is this already possible or does it already exists?

Take a look at https://home-assistant.io/components/sensor.template/ or https://home-assistant.io/components/sensor.history_stats/

I can’t see how template or history help with this, except for very slow sensors.

The use case I have (and @molobrakos, I think), is much faster. For example, I have an SNMP sensor that reads the number of bytes transmitted on an interface, but I want the bandwidth (bytes per second), measured as a sliding window over the last, say, 2 minutes.

Happy to implement anything, just need tips as to where to start.

1 Like

Release .87 now includes an Integration sensor. Could the derivative sensor be based on that component implementation? Using finite difference instead of trapezoidal rule for instance.

Hey @Denis_Torres, @molobrakos, @WazWaz, I’m working on a new derivative component based on the integral component.
Feel free to review it.
As this is my first component, and that I’m not fluet yet in python, any improvement proposal will be welcome !

PR: https://github.com/home-assistant/home-assistant/pull/26456

1 Like
1 Like