rest_command:
  chores1_request:
    url: !secret grocy_api_uri_chore6
    method: PUT
    headers:
      accept: "*/*"
      GROCY-API-KEY: !secret grocy_api_key
    content_type: "application/json"
    payload: '{
      "name" : "{{ name }}" ,
      "next_execution_assigned_to_user_id" : "{{ assigned_to }}"
      }'
    #   payload: '{"name" : "{{ name }}" , "next_estimated_execution_time" : "{{ next_time }}", "next_execution_assigned_to_user_id" : "{{ assigned_to }}" }'
    verify_ssl: false

sensor:
  - platform: rest
    name: Dog Motel Cleaning
    resource: !secret grocy_api_uri_chore3
    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_key
    unit_of_measurement: "Days"
  - platform: rest
    name: Red Bin Out
    resource: !secret grocy_api_uri_chore2
    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_key
    unit_of_measurement: "Days"
