Habit tracking with history?

Hi All

I am looking for suggestions on how to record daily habits in HA. What I want to do is track daily events such as medication, exercise etc with historical records. For viewing the historical records I am thinking a weekly view of what days the task was complete.

One option I considered was Google Calendar. I have setup G.C as a sensor for HA (works really well), but can’t see any way to add to the calendar. The other issue with using Google Calendar is the problem with displaying history. Afaik the only way to do it is by making the calendar public and embedding an iframe… which doesn’t work for me privacy wise.

Any suggestions on how I could possibly do this are appreciated.


I use influxdb for long term state storage, and grafana to display the data.

1 Like

How do you send your updates to influxdb?

It is done through the influxdb component I linked to.

1 Like

Bump. Wondering how other people track habits.

Habitica is good but not inegrating

1 Like

Awesome. I found some integration is possible with home assistant.

It’s integrating RPG stats but not the tasks, I thought you look for task integration like task list which syncs with online service, this I haven’t seen yet

Good point. Thanks for the info @g0g0

With a little programming, you could create a python script that you execute through a command shell in HA. It looks like google calendar api is fairly straightforward and well documented. The script could take a date / time and event name as inputs and put them into your calendar.


# Refer to the Python quickstart on how to setup the environment:
# https://developers.google.com/calendar/quickstart/python
# Change the scope to 'https://www.googleapis.com/auth/calendar' and delete any
# stored credentials.

event = {
  'summary': 'Google I/O 2015',
  'location': '800 Howard St., San Francisco, CA 94103',
  'description': 'A chance to hear more about Google\'s developer products.',
  'start': {
    'dateTime': '2015-05-28T09:00:00-07:00',
    'timeZone': 'America/Los_Angeles',
  'end': {
    'dateTime': '2015-05-28T17:00:00-07:00',
    'timeZone': 'America/Los_Angeles',
  'recurrence': [
  'attendees': [
    {'email': '[email protected]'},
    {'email': '[email protected]'},
  'reminders': {
    'useDefault': False,
    'overrides': [
      {'method': 'email', 'minutes': 24 * 60},
      {'method': 'popup', 'minutes': 10},

event = service.events().insert(calendarId='primary', body=event).execute()
print 'Event created: %s' % (event.get('htmlLink'))
1 Like

That’s an awesome idea! It would integrate nicely with what I have. Thanks @RobDYI

For anyone else looking at this, the authentication with the Google API can be a bit hairy. It uses OAuth which requires user input and provides an access token and refresh token, and you have to periodically trade the refresh token for a new access token. You also have to make an “app” in the google console (which we are used to doing by now), and here’s the kicker, while in development mode, the refresh tokens expire after like 15 pr 50 refreshes or something, meaning your app will have to prompt you to reauth periodically.