Skip to content
Contents

Recipes

Home Assistant

Show the chores of your crew in Home Assistant and log tasks from automations with the Nipto API.

Two building blocks cover most setups: a RESTful sensor to read Nipto, and a RESTful Command to log a task. Both go in configuration.yaml.

Store the token

Put your token in secrets.yaml so it never shows in your configuration:

secrets.yaml
nipto_token: YOUR_TOKEN

Find the ids

Members, tasks and reminders are named by their uid. Run this query once, with curl or the explorer at nipto.app/graphql, and note the ones you need:

{ users { uid name } tasks { uid name value } reminders { uid tasks { name } } }

Read the week

One REST call feeds several sensors. This one counts the activities of the week, the eggs of one member and the last thing done:

configuration.yaml
rest:
  - resource: https://nipto.app/graphql
    method: POST
    scan_interval: 300
    headers:
      Authorization: !secret nipto_token
      Content-Type: application/json
    payload: >-
      {"query":"{ activities { user { uid name } task { name value } date }
      weeks(limit: 1, sort: DESC) { scores { user { name } score level } } }"}
    sensor:
      - name: Nipto activities this week
        unique_id: nipto_activities_week
        value_template: "{{ value_json.data.activities | count }}"
      - name: Nipto eggs Camille
        unique_id: nipto_eggs_camille
        unit_of_measurement: eggs
        value_template: >-
          {{ value_json.data.activities
             | selectattr('user.uid', 'eq', 'CAMILLE_UID')
             | map(attribute='task.value') | sum }}
      - name: Nipto last activity
        unique_id: nipto_last_activity
        value_template: >-
          {% set last = value_json.data.activities | sort(attribute='date') | last %}
          {{ last.user.name ~ ' · ' ~ last.task.name if last else 'none' }}

Show when a chore is next due

Each Reminder gives nextDue, computed the way the app does: a smart repeat counts from the last time the task was done, and a “Snooze” or a “Skip” moves it. Read it instead of redoing the schedule from date and repeat. As a timestamp sensor, Home Assistant shows it as “in 3 days”:

configuration.yaml
rest:
  - resource: https://nipto.app/graphql
    method: POST
    scan_interval: 900
    headers:
      Authorization: !secret nipto_token
      Content-Type: application/json
    payload: >-
      {"query":"{ reminders { uid tasks { name } nextDue late } }"}
    sensor:
      - name: Nipto litter box next due
        unique_id: nipto_litter_next_due
        device_class: timestamp
        value_template: >-
          {{ (value_json.data.reminders
              | selectattr('uid', 'eq', 'LITTER_REMINDER_UID')
              | first).nextDue }}

late is true when the day of nextDue is over and the task is still not done. For a reminder with several tasks, dues gives the next due date of each one, with the members it is for.

Log a task from an automation

A REST command logs the task for one or more members. Here, when the dishwasher is done, it is logged for Camille:

configuration.yaml
rest_command:
  nipto_log_dishwasher:
    url: https://nipto.app/graphql
    method: POST
    headers:
      Authorization: !secret nipto_token
    content_type: application/json
    payload: >-
      {"query":"mutation($doers: [String!], $done: String!) { createActivity(doers: $doers, done: $done) { uid } }",
      "variables":{"doers":["CAMILLE_UID"],"done":"DISHWASHER_TASK_UID"}}
automations.yaml
automation:
  - alias: Log the dishwasher in Nipto
    triggers:
      - trigger: state
        entity_id: sensor.dishwasher_status
        to: "finished"
    actions:
      - action: rest_command.nipto_log_dishwasher

Several members in doers share the eggs, as when they log a task together in the app. Paused members cannot get activities, and if your account is under parental control the activity waits for an admin to approve it.

When it fails

  • The sensor turns unavailable when the token is wrong (401), Premium is over (403) or the day is over its calls (429). The log of Home Assistant shows the status, and Errors explains each one.
  • A 200 with an errors list means the query worked but something was refused, for example a task id that does not exist anymore.