惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Full Disclosure
WordPress大学
WordPress大学
小众软件
小众软件
Cloudbric
Cloudbric
AWS News Blog
AWS News Blog
腾讯CDC
量子位
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Vulnerabilities – Threatpost
Scott Helme
Scott Helme
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Hacker News
The Hacker News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
IT之家
IT之家
Jina AI
Jina AI
Attack and Defense Labs
Attack and Defense Labs
S
SegmentFault 最新的问题
Simon Willison's Weblog
Simon Willison's Weblog
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
Last Week in AI
Last Week in AI
博客园 - 【当耐特】
Google Online Security Blog
Google Online Security Blog
美团技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
罗磊的独立博客
L
LINUX DO - 最新话题
博客园 - Franky
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
The Last Watchdog
The Last Watchdog
J
Java Code Geeks
AI
AI
C
Cisco Blogs
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
博客园 - 三生石上(FineUI控件)
雷峰网
雷峰网
Help Net Security
Help Net Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
云风的 BLOG
云风的 BLOG
I
Intezer
S
Securelist

Simply Explained

Converting a Tuya Thermostat to ESPHome Bringing Foam Monsters to Life: How I Wrote and Illustrated a Children's Book Using AI How I Built an NFC Movie Library for my Kids Analyzing Link Rot in My Newsletter (After 31 Editions) How I Use Alfred to Search My Obsidian Notes Faster (with Spotlight!) Year in review: 2022 Smart lights behind a wall switch (Shelly, Z-Wave, ESPHome) Serverless Anagram Solver with Cloudflare R2 and Pages How WebP Images Reduced My Bandwidth Usage by 50% Tracking gas usage with ESPHome, Home Assistant, and TCRT5000 My Sixth Year as YouTube Creator (statistics + retrospective) EZStore: a tiny serverless datastore for IoT data (DynamoDB + Lambda) ESP-IDF: Storing AWS IoT certificates in the NVS partition (for OTA) How to securely access your home network with Cloudflare Tunnel and WARP I Built a CO2 Sensor and It Terrifies Me Filtering spam on YouTube with TensorFlow & AI Building a killer NAS with an old Rackable Server How I Structure My ESPHome Config Files Howto Virtualize Unraid on a Proxmox host MAX17043: Battery Monitoring Done Right (Arduino & ESP32) Preventing Cumulative Layout Shifts with lazy loaded images (Eleventy + markdown-it) Migrating This Blog From Jekyll to Eleventy Good Home Automation Should be Boring ESP32 Cam: cropping images on device Retrospective: My Fifth Year on YouTube Secure Home Assistant Access with Cloudflare and Ubiquiti Dream Machine Shelly 2.5 + ESPHome: potential fire hazard + fix Impact of Adblockers on Google Analytics (vs. Plausible) Shelly 2.5: Flash ESPHome Over The Air! Tuya IR Hub: control Daikin AC (Home Assistant + ESPHome) Building Air Quality Sensor: Luftdaten + Home Assistant HEIC to JPG: Build a Quick Action with Automator Make Your Garage Door Opener Smart: Shelly 1, ESPHome and Home Assistant Static webhosting benchmark: AWS, Google, Firebase, Netlify, GitHub & Cloudflare Why I don't take sponsorships Monitoring my 3D printer with a Pi Zero, Home Assistant and TinyCore Linux ESP32: Keep WiFi connection alive with a FreeRTOS task Home Energy Monitor: V2 Retrospective: 4 years on YouTube
Integrate Home Assistant with Apple Reminders
Xavier Decuy · 2022-07-27 · via Simply Explained

I recently integrated Home Assistant with Apple Reminders so that automations can create new todos. This is trickier as it sounds, because Reminders has no API that can be accessed from Home Assistant. Here's how I worked around that problem with a script, input text helper and an iOS Shortcut.

Why?

First up: why do I want my home automation system creating todos for me? The point of home automation is to free up time, and take tasks out of my hands, not to create them!

Unfortunately, certain devices just require manual maintenance. A robot vacuum cleaner and dehumidifier are perfect examples of this. When their tanks are full, they need to be emptied. And since Home Assistant already knows the state of these devices, it might as well create a todo for me.

I used to send myself notifications for these chores, but notifications aren't meant to be used as a todo list. They can be dismissed accidentally, and they get lost in the endless stream of notifications during a day. Instead, tasks belong in a todo app.

Overview

Here's a high-level overview of how I integrated Reminders with Home Assistant:

Home Assistant

I started by creating an input text helper in Home Assistant. This will temporarily store all todos until they're processed by Shortcuts.

input_text:
  xtodo_todos:
    name: Pending todos
    initial: ""
    max: 255  # No way to increase this, so make sure that iOS syncs frequently

An input text helper has one drawback: it can only store up to 255 characters. But this should be sufficient, given that todos are very short and that the helper is cleared whenever todos have been processed.

Next, I created a script that can append items to this input text helper. It basically takes the existing value of the helper and adds a line break followed by your todo:

script:
  xtodo_create_todo:
    alias: Create new TODO
    sequence:
      - if:
          condition: template
          value_template: "{{todo is not defined}}"
        then:
          - stop: "No \"todo\" variable defined."
            error: true
      - service: input_text.set_value
        entity_id: input_text.xtodo_todos
        data:
          value: >-
            {%- if states('input_text.xtodo_todos') |length != 0 -%}
            {{states('input_text.xtodo_todos')}}\n
            {%- endif -%}
            {{ todo }}

It's a very simple script, but it centralizes the logic in one place. It can now be used in any automation you want.

For instance, I have an automation that is triggered when the dehumidifier's tank is full. Instead of sending me a push notification, it now creates a new todo:

- alias: '[☑️] Create todo when dehumidifier tank is full'
  trigger:
    - platform: state
      entity_id: binary_sensor.dehumidifier_tank_full
      from: "off"
      to: "on"
  action:
    # Add a new todo!
    - service: script.turn_on
      entity_id: script.xtodo_create_todo
      data:
        variables:
          todo: "Empty dehumdifier tank"

When you created multiple todos, the state of the input text helper will look like this:

Empty dehumidifier tank
Put trash out: Paper, PMD

Shortcut

To bring these todos into Reminders, I'm using the Shortcuts app on iOS. Here's what it does:

  • Grab the state of input_text.xtodo_todos
  • Split the text by new lines
  • Loop over each line and add it to Reminders with a due date of today
  • Set the state of input_text.xtodo_todos to an empty string

And this is what it looks like when you translate it into "code":

All that’s left now is making sure that this shortcut runs regularly, so it transfers todos from Home Assistant into Reminders. I’ve created 3 automations for that in the Shortcuts app:

Three times a day, Shortcuts will run my workflow and fetch todos from Home Assistant. I wish Apple would allow you to set multiple triggers for an automation though.

And that's it! All done!

Home Assistant Package + Shortcut download

Want to use this system yourself? Here's a package](https://www.home-assistant.io/docs/configuration/packages/) you can use in your Home Assistant config:

packages:
  xtodo:
    input_text:
      xtodo_todos:
        name: Pending todos
        initial: ""
        max: 255  # No way to increase this, so make sure that iOS syncs frequently

    script:
      xtodo_create_todo:
        alias: Create new TODO
        sequence:
          - if:
              condition: template
              value_template: "{{todo is not defined}}"
            then:
              - stop: "No \"todo\" variable defined."
                error: true
          - service: input_text.set_value
            entity_id: input_text.xtodo_todos
            data:
              value: >-
                {%- if states('input_text.xtodo_todos') |length != 0 -%}
                {{states('input_text.xtodo_todos')}}\n
                {%- endif -%}
                {{ todo }}

And here's a link to the iOS Shortcut: https://www.icloud.com/shortcuts/f31e9022a6d247e8869e0be9b4d8e1e4

Conclusion

I've been using this setup for a few months and it has been working great. However, I still try to automate whatever can be automated and keep the amount of todos to a minimum. My smart home should work for me, not boss me around ;)