Skip to content

Instantly share code, notes, and snippets.

@0mhx
Last active September 17, 2023 23:25
Show Gist options
  • Select an option

  • Save 0mhx/efe280e61e7f18aa4b5bba6b9efa8902 to your computer and use it in GitHub Desktop.

Select an option

Save 0mhx/efe280e61e7f18aa4b5bba6b9efa8902 to your computer and use it in GitHub Desktop.
# ------------------------------------------------------------------------------------------ #
# Lines starting with “#” are comments and will be ignored by the automation.
# Indentation determines hierarchy within the script.
# Visit g.co/home/script-editor-docs for full documentation.
# ------------------------------------------------------------------------------------------ #
metadata:
name: motion # Choose a short name that summarizes important starters and actions, like “Sunset lights”.
description: Scripted automation # Write a detailed description that includes everything the automation does, like “At sunset, on weekdays, close blinds, turn on lights to 50%, and play the sunset playlist on certain speakers.”
automations:
# “starters” and “actions” are required; “conditions” are optional.
# Use Ctrl + Space to see autocomplete suggestions.
# ---- STARTERS ---- #
# Starters describe events that will start the automation.
# To add more than one starter, duplicate the "- type" section under "starters".
# If you add multiple starter events, any one of them happening will start the automation.
starters:
- type: device.event.MotionDetection # Motion has been detected by the device.
device: device name here
# ---- CONDITIONS ---- #
# Conditions are optional. Delete this section if it’s empty.
# Conditions will prevent an automation from starting if the conditions aren’t met.
# See g.co/home/script-editor-docs for documentation about how to use logical operators like “and”, “or”, and “not”.
#condition:
# type:
# ---- ACTIONS ---- #
# Actions will start when a starter event takes place and all conditions are met.
# Actions will start in the order they appear in the script and with any delay specified.
# To add more than one action, duplicate the "- type" section under "actions".
actions:
- type: device.command.OnOff # Turn the device on or off.
on: true
devices: devicenamehere
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment