where “120”, “14” etc - a value of a change.
i.e. the log must have all changes of the monitored entity (may be only for a defined period).
Since Logbook does not support numerical entities, a possible way is creating a template sensor which keeps obvious STRINGS like “delta: 123” instead of “123”.
Then I may use a Logbook card for this sensor, this will be like:
But if the monitored entity have 2 or more SAME consecutive changes - only the 1st change is stored.
A possible workaround is to add a timestamp to a state which makes it too cumbersome.
But probably I am reinventing a wheel?
May be there are better ways to create such a log?
If you don’t care about showing the data in the dashboard (but I believe you can do that too although I’ve never done it) you can create a text file and have HA write the data to that file.
Here is an example I have that will keep a record of the states of some weather entities I want to know what the possible different states could be so I can use them in my automations.
First set up the notify integration for the file that you want to write to:
notify:
- platform: file
name: ENV Weather Condition Data Record
filename: weather_condition_data.txt
timestamp: true
then create the automation to write the data to the file:
Very interesting problem, I’m going to give it more though, but one hack comes to mind:
You can perturb the current change by adding a small but insignificant value to it (depending on how you’ll be using it).
For example, add a very tiny random value to it. This will make at least consecutive values unique (but odds are that there might still be a numeric collision, but small, depending on the choice of randomness). For the most part, this tiny value would be unnoticeable, except when viewing raw value, but in many cases you’d be able to round the value to get rid of it.
(My idea comes from certain algorithms in machine learning where you do this kind of thing to avoid an algorithm getting stuck.)
Interesting way, never tried files I/O operations in HA.
Will need to find out how to show a content in UI.
I wonder is it possible to create a Google sheet & then show it in UI?
A similar idea came to my mind.
Assume we have this state:
state: > -
...
delta: {{ VALUE }}
I may probably use different letters - Latin “a” & Cyrillic “a” for consecutive SAME values.
Also, if states are composed as “+ 123” - then we can probably also use different unicode symbols which are displayed similarly. The 1st thought is about a whitespace (I could be wrong): I think there are different codes for it.
Also (just a guess, could be wrong) - if states are like “123.456” (i.e. with a delimeter) - may be there are also different chars for it?