10-17-2025 03:54 AM
Hello
When I use the script editor to create an automation routine, anything that has a time condition is not working. If I remove the time.between condition the routing runs. With it, nothing. But there is no error.
What is wrong with this script?
metadata:
name: TEST
description: Broadcast when someone is seen
automations:
- starters:
- type: device.event.PersonDetection # A person has been detected by the camera.
device: Back garden camera - Back garden
condition:
type: time.between
after: 10:00 AM # HH:MM XM (12 hours format). Adjust time as needed
before: 8:00 PM # HH:MM XM (12 hours format). Adjust time as needed
actions:
- type: assistant.command.Broadcast
devices:
- Study speaker - Study
message: A person has been detected
Answered! Go to the Recommended Answer.
10-20-2025 10:55 PM
Thanks for reaching out. The script editor typically requires a 24-hour clock format (HH:MM) for time-based conditions, not the 12-hour format with AM/PM. Could your try the script below and let me know if this worked,
metadata:
name: TEST
description: Broadcast when someone is seen
automations:
- starters:
- type: device.event.PersonDetection # A person has been detected by the camera.
device: Back garden camera - Back garden
condition:
type: time.between
after: 10:00 # Corrected to 24-hour format
before: 20:00 # Corrected: 8:00 PM is 20:00 in 24-hour format
actions:
- type: assistant.command.Broadcast
devices:
- Study speaker - Study
message: A person has been detected
10-20-2025 10:55 PM
Thanks for reaching out. The script editor typically requires a 24-hour clock format (HH:MM) for time-based conditions, not the 12-hour format with AM/PM. Could your try the script below and let me know if this worked,
metadata:
name: TEST
description: Broadcast when someone is seen
automations:
- starters:
- type: device.event.PersonDetection # A person has been detected by the camera.
device: Back garden camera - Back garden
condition:
type: time.between
after: 10:00 # Corrected to 24-hour format
before: 20:00 # Corrected: 8:00 PM is 20:00 in 24-hour format
actions:
- type: assistant.command.Broadcast
devices:
- Study speaker - Study
message: A person has been detected