Hi everyone. 🙂
after the discussions on Git issues, Git discussion, the forum and here about the new power dashboard and the problem with house-battery entities providing their values inverted compared to what HA expects,
I remembered about something I used in a couple of other smart home solutions before I switched to HA:
A helper like proxy device, that allows calculations like a template sensor, but doing the same thing for history.
So it doesn't save it's own history, but fetches the history for the devices used in the template and does the same calculation for each value it receives.
This wouldn't only allow to do things like inverting an value. You can also do scaling, translations, calucalate differences or sums of other sensors on the fly.
Benefits:
- No additional history saved that bloats the database
- You can use it on your existing entities and therefore don't loose your existing history
- It's calculated on the backend, so your maybe weak end-devices don't get additional load
- You would be able to use these like any other entity in every (also already existing ones) dashboard card, without the need to implement special code for transforming values over and over again
My question as someone who only wrote custom cards so far, to the community with more experience:
Would it be possible to implement something like this as an custom integration, or is this something that can only be done in Core?
I'm afraid integrations aren't involved in fetching history at all, so proxy can't be created that way. Is this correct?
The only other way I see would be a combination with a custom Recorder integration acting as the proxy, which might also not be possible at all.
Otherwise this has to become a feature request I'm afraid, which might decrease the chances to see this implemented rather soon ...