Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Swipe650/d8c89ae5b7005e86898a55ebabbb1832 to your computer and use it in GitHub Desktop.

Select an option

Save Swipe650/d8c89ae5b7005e86898a55ebabbb1832 to your computer and use it in GitHub Desktop.
mute and unmute my kitchen Google Home speaker for a set time period based on the time of the day
metadata:
name: mute kitchen
description: Mutes the kitchen speaker for 121s during the day, 140s in the evening, and 120s overnight.
automations:
# --- 1. DAYTIME PROFILE (120 Seconds) ---
# Runs between 6:00 AM and 7:00 PM
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: mute kitchen
condition:
type: time.between
before: 19:00
after: 06:00
actions:
- type: assistant.command.Broadcast
message: "Muting for 121 seconds"
devices: Kitchen home - Kitchen
- type: device.command.Mute
mute: true
devices: Kitchen home - Kitchen
- type: time.delay
for: 121 sec
- type: device.command.Mute
mute: false
devices: Kitchen home - Kitchen
# --- 2. EVENING PROFILE (140 Seconds) ---
# Runs between 7:00 PM and 10:00 PM
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: mute kitchen
condition:
type: time.between
before: 22:00
after: 19:00
actions:
- type: assistant.command.Broadcast
message: "Muting for 140 seconds"
devices: Kitchen home - Kitchen
- type: device.command.Mute
mute: true
devices: Kitchen home - Kitchen
- type: time.delay
for: 140 sec
- type: device.command.Mute
mute: false
devices: Kitchen home - Kitchen
# --- 3. LATE NIGHT / OVERNIGHT PROFILE (120 Seconds) ---
# Runs between 10:00 PM and 6:00 AM (handles crossing midnight)
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: mute kitchen
condition:
type: time.between
before: 06:00
after: 22:00
actions:
- type: assistant.command.Broadcast
message: "Muting for 120 seconds"
devices: Kitchen home - Kitchen
- type: device.command.Mute
mute: true
devices: Kitchen home - Kitchen
- type: time.delay
for: 120 sec
- type: device.command.Mute
mute: false
devices: Kitchen home - Kitchen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment