Skip to content

Home Assistant sensor

Home Assistant’s RESTful integration turns any JSON API into sensors. This one counts the episodes airing today for the shows you follow.

Key: calendar:read.

  1. Create the key in Settings › Integrations, then store it in secrets.yaml, with its Bearer prefix:

    loomkeep_api_key: "Bearer lk_…"
  2. Add the sensor to configuration.yaml:

    rest:
    - resource: https://loomkeep.app/api/v1/calendar?days=1
    headers:
    Authorization: !secret loomkeep_api_key
    scan_interval: 1800 # 30 minutes
    sensor:
    - name: Loomkeep episodes today
    unique_id: loomkeep_episodes_today
    icon: mdi:television-play
    value_template: "{{ value_json | length }}"
  3. Restart Home Assistant: sensor.loomkeep_episodes_today appears.

An automation can say it out loud when you get home, for instance:

automation:
- alias: Announce today's episodes
triggers:
- trigger: state
entity_id: person.me
to: home
conditions:
- condition: numeric_state
entity_id: sensor.loomkeep_episodes_today
above: 0
actions:
- action: tts.speak
target:
entity_id: tts.home_assistant_cloud
data:
media_player_entity_id: media_player.living_room
message: >-
{{ states('sensor.loomkeep_episodes_today') }} new episodes
are out today.

Replace the person, the speech service and the speaker with yours.

To list the episodes in Home Assistant’s calendar rather than count them, subscribe to your calendar link with the remote calendar integration: no key needed.