# ADHDTasker — Home Assistant config snippets
# 1. Generate an API key in ADHDTasker -> Manage -> Inbound API.
# 2. Put it in secrets.yaml:   adhdtasker_api_key: "paste-your-key-here"
# 3. Add the blocks below to configuration.yaml and restart HA.

rest_command:
  adhdtasker:
    url: "https://us-central1-adhdtasker-68a50.cloudfunctions.net/api"
    method: POST
    headers:
      X-API-Key: !secret adhdtasker_api_key
      Content-Type: application/json
    payload: "{{ payload }}"

# Open-chore count as the state; counts + leaderboard as attributes (for dashboards/automations).
sensor:
  - platform: rest
    name: ADHDTasker
    resource: "https://us-central1-adhdtasker-68a50.cloudfunctions.net/api"
    headers:
      X-API-Key: !secret adhdtasker_api_key
    value_template: "{{ value_json.open }}"
    json_attributes: [counts, leaderboard]
    scan_interval: 300
