Integrating Channels calendar into Home Assistant

I’m trying to integrate the Channels scheduled recordings calendar into Home Assistant for use in triggering automations. Sure would appreciate some help :grinning:.

That’s a little open ended for the community to help with.

Do you have a particular problem you’ve run in to or a specific question about this?

Have you attempted it yourself yet and run into an issue you can’t figure out?

Yeah, I’ve tried to add it as using the CalDAV integration but it requires a user name and password. Just not sure how to configure it in home assistant as it would be very helpful for some very specific automations I’d like to run.

The API has no authentication and only works locally.

You’ll need to use the local IP address when you provide a URL to your Home Assistant.

http://192.168.1.30:8089/api/v1/feed.ics?contentType=jobs

My confusion lies in how to implement this link into Home Assistant in order to add the calendar. I realize this is outside of the scope of support so I thank you for your help…

This sounds more like a question for the Home Assistant community.

There’s a lot of HASS fans here too though, so you might still get some help.

Maybe this thread belongs in the Playground area. :wink:

It seems you would like to know when your DVR is recording. Any specific programs?

For my own curiosity, what actions will you perform once you have your desired triggers?

Maybe this will give you some clues...

I already have this working using a 3rd party program on my Mac which looks for “NHL Hockey” in the subject line of the Channels DVR schedule recording calendar. It then schedules a macOS shortcut to run at the time of that recording which turns on the appropriate TV and starts playing the game. I created this for my elderly father and he loves it as he doesn’t need to remember to tune the game as it just happens automatically. I would simply like to eliminate the 3rd party app and roll it into Home Assistant for simplicity and less clutter…

2 Likes

That's cool. You're good with the action in HA to turn on the TV, you're just missing the trigger?

Very interesting. Now that it's in my head, that won't go away until I play with it and see if I can figure it out. :laughing:
Maybe somebody will beat me to it. :slightly_smiling_face:

I'm thinking it should be possible to create a binary sensor that monitors your DVR activity and returns True when it is recording the desired program.

Ok, got the calendar imported using the HACS iCal integration. Now I see all of my recordings. Now I just have to figure out how to build an automation that triggers on “NHL Hockey” at the event time.

1 Like

Got it working! Had to resort to ChatGPT. Here is the automation YAML code if anyone is interested:

alias: Watch Hockey
description: ""
trigger:
  - platform: template
    value_template: |
      {% set event = state_attr('calendar.dvr', 'start_time') %} {% if event %}
        {{ (as_timestamp(event) + 60) <= as_timestamp(now()) }}
      {% else %}
        False
      {% endif %}
    alias: When current time is 1 minute past start of event
condition:
  - alias: Check for 'NHL' in event
    condition: template
    value_template: >
      {% set title = state_attr('calendar.dvr', 'message') %} {% set description
      = state_attr('calendar.dvr', 'description') %} {{ (title is not none and
      'NHL' in title) or (description is not none and 'NHL' in description) }}
action:
  - action: rest_command.watch_hockey
    metadata: {}
    data: {}
    alias: Run Shortcut 'Watch Hockey' on Mac
mode: single

Very nice! :smiley:

Combining the best DVR and the best automation platform (personal opinions) is a great thing.

In your case, this even has a very practical use.

You got me thinking about it earlier and I will still try my idea of the binary sensor with the DVR activity. I will create a separate thread for it if I manage to make it work.

Well done! :clap:

I couldn’t agree more! Channels and HA are an awesome combination. That said, please keep us updated on your progress. :grinning:

1 Like