The integration brings your Microsoft To Do tasks into Home Assistant and allows creating new tasks.
Work is still in progress and there might be breaking changes. Tasks for the 1st release are tracked on the MVP board.
This component can be installed using HACS. Simply add a custom repository black-roland/homeassistant-microsoft-todo and install the integration.
Alternatively, that's possible to copy the content of the custom_components to the config directory.
To get access to Microsoft To Do API you need to register an application in Azure:
- Open Azure portal;
- Go to app registrations:
 
- Register a new personal app and obtain client ID and secret:
 
- Add a redirect URI: https://[YOUR HOME ASSISTANT URL:PORT]/api/microsoft-todo, replace[YOUR HOME ASSISTANT URL:PORT]with the domain name and port of our Home Assistant instance:
 
 To be able to authenticate please make sure thatbase_urloption is configured properly and your browser can access the redirect URI (it doesn’t have to be accessible from the Internet, it can be evenlocalhost).
Add the following section to your configuration.yaml file:
calendar:
  - platform: microsoft_todo
    client_id: YOUR_CLIENT_ID
    client_secret: YOUR_CLIENT_SECRETRestart Home Assistant and finalize authorization through UI. There should be a new configuration request in notifications.
NOTE: After successful auth please restart your Home Assistant again (it's known issue #10).
To create a task in Microsoft To Do you can call microsoft_todo.new_task service.
Simple example:
- service: microsoft_todo.new_task
  data:
    subject: "Test task"
    list_name: "Home Assistant"Automation example:
automation:
  - alias: "Remind to pay utility bill"
    trigger:
      platform: time
      at: "00:00:00"
    condition:
      condition: template
      value_template: "{{ now().day == 1 }}"
    action:
      - service: microsoft_todo.new_task
        data_template:
          subject: "Pay utility bill for {{ now().replace(month=now().month - 1).strftime('%B') }}" # previous month name
          list_name: "Home Assistant"
          note: "Pay online: http://example.com/pay/"
          due_date: "{{ now().strftime('%Y-%m-09') }}" # due 9th
          reminder_date_time: "{{ now().strftime('%Y-%m-%dT17:00:00') }}" # at 17:00 todayThe integration creates a binary sensor for each to-do list with the tasks exposed as all_tasks attribute.
Currently, only all_tasks functionality is supported.
automation:
  - alias: "Remind to buy groceries after work"
    trigger:
      platform: state
      entity_id: person.bob
      from: "office"
      to: "away"
    condition:
      condition: template
      value_template: "{{ state_attr('calendar.shopping_list', 'all_tasks') | length > 0 }}"
    action:
      - service: notify.email_bob
        data:
          title: "Shopping list"
          message: "Don't forget to check your shopping list before going home"

