#Access history data

1 messages · Page 1 of 1 (latest)

fierce gale
#

I'd like to access history data in Automations. I often come across this and use additional helpers which are switched at certain times.

How could I for example see if the device
device_tracker.schlussel
Was between 8:00 and 15:00:00 at some time at Work? I just want to turn on my heater early and the accuracy is not good enough for Google find my devices to keep it inside the area for the whole time.

fast dirge
fierce gale
#

Could you give me an example how I could check this in the automation?

#

Or show me a link where it's used inside an automation?

fast dirge
#

you can use it like this and store the data in the variable then do something with it after you pull it

#

i would suggest testing the action call using the action tab of the dev tools. this will show you how the output looks then you can decide how to process it

#

I haven't used it on anything personally so have no example but its probably a place to start

fierce gale
#

Woah thank you very much! I've worked with a lot of work arounds and this is exactly what I needed

#

Do you know of something like this exists also for the normal history data, for entities which have the recorder disabled?

fast dirge
fast dirge
#

The History integration tracks everything that is going on within Home Assistant and allows the user to browse through it. It depends on the recorder integration for storing the data and uses the same database setting. If any entities are excluded from being recorded, no history will be available for these entities.
Further Reading - https://www.home-assistant.io/integrations/history/

sacred meadow
#

A device_tracker entity won’t have statistics, and there isn’t a recorder.get_history action yet (but there is a PR created).

#

Normally what you’d do is create a template sensor to bring that information so it’s available in state machine. In your case, create a trigger/based template binary sensor (must be done in YAML, not in the UI) and have it turn on if the device tracker changes to work between 8:00 and 15:00, and have it turn off at midnight.

In your automation then you just check if that binary sensor is on.