Integrating Shelly 1PM with Home Assistant for Garage Lighting Automation

I’ve been exploring the world of Home Assistant for a while now, and I’m absolutely thrilled with the possibilities it offers for automating my home. However, I’m currently stuck on a project that I’m really excited about, and I’d love some guidance from the community.

The goal is to control the garage lighting using a Shelly 1PM. I’ve set up a motion sensor that sends a 1-second signal to the Shelly’s input, which I’ve configured as a long press. When triggered, I want the lights to turn on for 2 minutes. Additionally, I’ve connected a switch to the same input, which should activate the lights for 10 minutes with a single press and enable permanent lighting with a triple press.

I’ve created an automation using input events from the Shelly and linked it to a script that should handle the logic. However, despite the automation triggering and the script showing as executed, nothing happens at the Shelly’s output. I’ve even simplified the script to test individual functions, but the issue persists.

I suspect the timing of the Shelly’s signal might not align with the script’s expectations. Perhaps the states aren’t being captured at the right moment. I’d really appreciate any insights or suggestions on how to troubleshoot this.

Here’s a glimpse of my current setup:

Automation:
Screenshot of Automation

Script:
Screenshot of Script

Any help would be incredibly appreciated! I’m eager to get this working and continue exploring the amazing possibilities of Home Assistant.