How to Track Chores in Home Assistant with Grocy and NFC Tags


Today I’m going to solve a problem I’ve been having… staying on top of the household chores.

 

First primitive solution was a simple google calendar with fixed dates to do tasks, did simply didn’t work for us. We would either do things before, or more likely forget about them and they will not get done.

Because I already have home assistant an automation platform running I found Grocy.

 

Grocy is an grocery and household task master, you can do things like recipes, track groceries, batteries and do tasks and chores.

 

I‘m using an NFC Tag to track when I did tasks, set a next expected time in Grocy and visualise it all in the UI in Home Assistant to track the execution of the chores. 

Follow this video for a complete step by step tutorial:

 

 

Code

 

Before we create the code, remember to create an api key from Grocy. Store that api key in the secret.yaml file mine is called grocy_api. Then you reference it as !secret grocy_api

Create a Sensor

- platform: rest
  name: Bathroom Cleaning
  resource: http://192.168.1.159:9192/api/chores/1
  method: GET
  value_template: '{{ (((as_timestamp(value_json.next_estimated_execution_time))-as_timestamp(now())) | int /60/1440) | round(0) }}'
  json_attributes:
    - last_tracked
    - estimated_execution_time
  headers:
    Accept: application/json
    Content-Type: application/json
    GROCY-API-KEY: !secret grocy_api
  unit_of_measurement: 'Days'
  
  
- platform: rest
  name: Ensuite Cleaning
  resource: http://192.168.1.159:9192/api/chores/2
  method: GET
  value_template: '{{ (((as_timestamp(value_json.next_estimated_execution_time))-as_timestamp(now())) | int /60/1440) | round(0) }}'
  json_attributes:
    - last_tracked
    - estimated_execution_time
  headers:
    Accept: application/json
    Content-Type: application/json
    GROCY-API-KEY: !secret grocy_api
  unit_of_measurement: 'Days'

 

Command Shell

shell_command:
  grocy_track_chore: "curl -X POST http://192.168.1.159:9192/api/chores/{{chore_id}}/execute -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'GROCY-API-KEY: {{grocy_key}}' -H 'cache-control: no-cache' -d '{ \"tracked_time\": {{tracked_time}},  \"done_by\": 0 }'" 

Track a Chore

Replace the tag_id with your NFC tag.
Use the chore ID linked to the chore that you want to track.

  alias: Track Bathroom Cleaning
  trigger:
   - platform: tag
     tag_id: 712f273f-2937-4a7b-91a8-f6b04b71a654
  action:
   - service: shell_command.grocy_track_chore
     data:
       grocy_key: !secret grocy_api
       chore_id: 1

Gio

Gio loves rabbits, smart home tech, WWII, travelling to Thailand & my favourite pizza is margherita with parma ham!

Recent Posts