You can make this quite a bit easier you could just connect your Apple calendar or Google calendar to Home Assistant directly and just set up an automation there no script needed
You can make this quite a bit easier you could just connect your Apple calendar or Google calendar to Home Assistant directly and just set up an automation there no script needed