Add a 'last' mode and attribute to min_max sensor#11037
Conversation
Now supports types: min, max, mean, last 'last' is the most recently received value from all tracked entities.
|
Hi @markferry, It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
|
I don't think this should be part of the |
|
To an extent, @tinloaf, I'm with you, though one could argue But a much more ambitious change would instead expand how homogeneous groups work, providing something like OpenHABs AND, OR, AVG, SUM groups, etc. |
|
|
Add a 'last' mode and attribute to min_max sensor
Inspired by this question "Combining multiple sensor values into one with most recent wins strategy", provide a mode of min_max sensor to report only the most recent value received from a list of sensors. (Follows the nomenclature of Grafana for 'last' value of a sensor).
This solves the issue of multiple sensors providing intermittent and unsolicited readings of the same metric - multiple battery-powered temperature sensors within a room for example.
It does not identify which of the monitored sensors provided the most recent update.
The current workaround is a template sensor or virtual device (input_number or similar) with an automation to update the value when any of the monitored sensors triggers.
Pull request in home-assistant.github.io with documentation: home-assistant/home-assistant.io#4167
Example entry for
configuration.yaml(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code does not interact with devices:
toxrun successfully. Your PR cannot be merged unless tests pass