How do you chart what times an automation runs?

I’m trying to keep a bar chart of the times when my Got-Into-Bed automation runs. I cannot for the life of me figure out how to do this. I’ve spent three days trying to make sense of it.

The automation only runs once a day. I’m trying to keep records to see if I go to bed more than 8 hours before my alarm goes off


(Much less important: Additionally, I’m trying to make something that checks what time my android cell phone Alarm and see if I got into bed more than eight hours before it. The android alarm clock is listing random times, sometimes including alarms in the past.)

Hello,

One obvious way is to create a date/time helper (time only) in Open your Home Assistant instance and show your helper entities.
Add an action in your automation to set the helper to current time.

  - service: input_datetime.set_datetime
    target:
      entity_id: input_datetime.sleep_time
    data:
      timestamp: "{{ now().timestamp() }}"

And you’ll get an history of your go to bed time.
How to graph it is a different question. As it, it will show a continuous value, like ‘8:23pm’ throughout the day, until you set the new time.

It’s not a chart, but try the logbook card.

Thanks everybody for all of your help. The Input datetime worked to record the automation running. For convenience I made a datetime for the date, the time, and both.

That all works correctly.

But, when I try to chart the data, it’s reported as… sixteen. Which is very peculiar. I think this has something to do with the time being sometime around 16:00. We’re getting very close though, a few more decimal places and we’ll have it!

Hi,
How are you doing with this? Could you share your code? I’, trying to do something similar.
Thanks

1 Like