Hi community,
I am really new to influxdb and homeassistant - so sorry if it is an easy question.
In influxdb I do not have any problem to analyze sensor data, if I receive it every minute or second. I can ask for state changes, duration and so on. Unfortunately HA only writes to influxdb if a state change occurs.
So I have a state
- STATE1 (with timestamp)
- IDLE (with timestamp)
- STATE2 (with timestamp)
- IDLE (with timestamp)
I want to have a graph where I can see, how long do I have state one (perhaps just a “1” in color blue,) and then how long do I have IDLE (value “0”) and then STATE 2(value “1” in red) and so on.
Is that possible??
Thanks a lot!
Holger
You can use history stats to (help) create a sensor that measures a certain state for a defined period, but you would have to have a sensor per value. e.g. show the time sensorABC was in state ‘on’ since midnight
Ok, but I want to have the current state every minute in my influx db - doesn’t matter, if it was changed our not…
As far as I understood influx db this is the expected way for querying states - like if you want to visualize how long entity was in state a, in idle, again in a, idle, state b and so on…
I took your question as for a graph in HA hence…
For the influx solution (I admit to not know this very well as a tool) I think you need to ‘touch’ the entity in HA with an automation each minute, e.g. update a attribute with itself…never tried this.
If that works, there is probably some expert that knows how to bundle this for a group/class of entities
There may be side effects as well, e.g. to statistics but …again not sure.