Closed tedmau5e closed 10 months ago
The idea of this plugin is to remove need of scheduling anything on Home app side. Home app scheduling is not flexible and in case of temporary change in schedule, whole new scenario should be created and so on.
That's why I've decided to develop this plugin. For each trigger of shortcut or automation I'm creating event or series of events in calendar, then configuring plugin to listen for them and trigger respective automation.
Right now morning lights which are simulating sunrise are configured in this way on my side. This allows me to change "sunrise" time for one day from calendar without need to actually disable scenario or create new one.
As for you request, I would organise it in this way:
And that's it. When schedule should be changed - calendar events should be moved on desired time, no need to change anything on Home app side.
Let me know if something is not clear.
Stay safe 🇺🇦
Do start and end events need to be separate events? Or is it possible to have an event last a certain amount of time and the end closes the accessory?
Correct me if I have this right: I would create an automation that detects the sensor for the event opening, which would then trigger the HomePod to play. And then I guess I would have another sensor that waits for the event end to trigger and pause the HomePod, right?
The event accessory is a Contact Sensor. This sensor will be set to the state Open
once the event starts and to Close
when the event ends.
You are able to schedule the event to start at the time when you want the music to start playing and end at the time when the music should stop playing.
Both automations are directed at one accessory, with the only difference being that the first should listen for the Open
state and the second for the Closed
state of the same sensor.
Hey, how is it going? Were you able to setup your automation?
Hey thanks for checking in!
So, kind of. I was having some networking and Homebridge/Hyper-V issues Monday and Tuesday, so today ended up being the real test.
This morning, the music started at 9:00 when the event started and the automation trigger saw the sensor Open. But I set it to end at 10:00 to make sure it would trigger the sensor to Close and run the automation set to pause playing when the sensor changed to Close. But it didn't do that, it kept playing. So I'm not 100% sure what happened, but here's the config and the logs for around the 10:00 hour:
"caseInsensitiveEventsMatching": false, "unsafeEventNames": false, "debug": true, "calendars": [ { "calendarName": " HomePod Automation", "calendarUrl": "webcal://p30-caldav.icloud.com/published/2/OTg0ODE2MTA5ODQ4MTYxMAwSGA5I-UoJDPFJnugjGuMKXtpYd6UGihGBr3Y8Ve3OKVlZwG9uZOJd7QfoMPPFdHFovlVw9uM_q_Ie5xPBauQ", "calendarUpdateInterval": 60, "calendarUpdateButton": true, "calendarTriggerOnUpdates": false, "calendarTriggerOnAllEvents": false, "caseInsensitiveEventsMatching": false, "unsafeEventNames": false, "calendarEvents": [ { "eventName": "Open", "eventTriggerOnUpdates": false, "caseInsensitiveEventsMatching": false, "unsafeEventNames": false } ] } ], "platform": "CalendarScheduler", "_bridge": { "username": "0E:B1:4F:4E:3B:C8", "port": 30256
[12/6/2023, 9:59:06 AM] [homebridge-calendar-scheduler] [HomePod Automation] Set ActiveState On -> CONTACT_NOT_DETECTED [12/6/2023, 9:59:56 AM] [homebridge-calendar-scheduler] Tick handled: HomePod Automation [12/6/2023, 9:59:56 AM] [homebridge-calendar-scheduler] Found Events from 2023-12-06T14:59:00.000Z to 2023-12-06T14:59:00.000Z for HomePod Automation: 1 [12/6/2023, 9:59:56 AM] [homebridge-calendar-scheduler] Setting to cache: HomePod Automation 2023-12-06T14:59:00.000Z-2023-12-06T14:59:00.000Z [12/6/2023, 9:59:56 AM] [homebridge-calendar-scheduler] [HomePod Automation] Set ActiveState On -> CONTACT_DETECTED [12/6/2023, 10:00:06 AM] [homebridge-calendar-scheduler] [HomePod Automation] Set ActiveState On -> CONTACT_NOT_DETECTED [12/6/2023, 10:00:56 AM] [homebridge-calendar-scheduler] Tick handled: HomePod Automation [12/6/2023, 10:00:56 AM] [homebridge-calendar-scheduler] Found Events from 2023-12-06T15:00:00.000Z to 2023-12-06T15:00:00.000Z for HomePod Automation: 1 [12/6/2023, 10:00:56 AM] [homebridge-calendar-scheduler] Setting to cache: HomePod Automation 2023-12-06T15:00:00.000Z-2023-12-06T15:00:00.000Z [12/6/2023, 10:00:56 AM] [homebridge-calendar-scheduler] [HomePod Automation] Set ActiveState On -> CONTACT_DETECTED [12/6/2023, 10:01:06 AM] [homebridge-calendar-scheduler] [HomePod Automation] Set ActiveState On -> CONTACT_NOT_DETECTED [12/6/2023, 10:01:56 AM] [homebridge-calendar-scheduler] Tick handled: HomePod Automation [12/6/2023, 10:01:56 AM] [homebridge-calendar-scheduler] Found Events from 2023-12-06T15:01:00.000Z to 2023-12-06T15:01:00.000Z for HomePod Automation: 1 [12/6/2023, 10:01:56 AM] [homebridge-calendar-scheduler] Setting to cache: HomePod Automation 2023-12-06T15:01:00.000Z-2023-12-06T15:01:00.000Z [12/6/2023, 10:01:56 AM] [homebridge-calendar-scheduler] [HomePod Automation] Set ActiveState On -> CONTACT_DETECTED [12/6/2023, 10:01:58 AM] [homebridge-calendar-scheduler] [Open] Get ActiveState On -> CONTACT_NOT_DETECTED [12/6/2023, 10:01:58 AM] [homebridge-calendar-scheduler] [HomePod Automation] Get ActiveState On -> CONTACT_DETECTED
Whoops, just noticed that space before HomePod in the calendar name, but that wasn't the problem.
Hey, Finally found time to test this.
I've tried to add Test
accessory and check if automations still working fine with it.
So I've updated config for calendar event:
{
"eventName": "Test",
"eventTriggerOnUpdates": false,
"caseInsensitiveEventsMatching": false,
"unsafeEventNames": false
}
Then created two automations for this accessory:
1) For Opened state of accessory (when event starts)
2) For Closed state of accessory (when event ends)
Using this setup, first scene was enabled when event started and second one enabled when event ended.
Let me know if your automation configuration differs from my examples.
Hey!
Thanks, I ended up getting it figured out and working correctly not long after my last post/update. And then something happened with networking or Windows that caused a complete failure and I had to reset everything back up (using Ubuntu instead of Windows) and reset the HomePod because of the networking issue, but now everything is working perfectly!
Thank you for not forgetting and checking back in!
Actually I'm facing issues with Homebridge–Home connection a lot. It looks like after restating bridge AppleTV is not able to connect to Homebridge anymore. Switching on/off AppleTV plug helps to reestablish connection back.
I'm not sure if this is possible, or if I'm just underthinking/overthinking how to do this, but I'm trying to figure out how to get this configured such that a HomePod will play at a certain time everyday, except on certain days when it won't play at all (and an event is set for that day to trigger that). Similarly, I would like it to play a certain playlist depending on the date/date range (so I guess an event on the first day of the date range to trigger the change, and then another event to stop it and go back to the regular playlist).
I set up automations in the Home app to set the automations for play and pause at a certain time on the days, but I can't figure out how I would tell it to NOT play if it was a certain day/event on the calendar. I would also like the automations to change the time of play and pause based on a calendar event date range.
Is this possible? Or is there a better way of doing this?