Skip to content

Instantly share code, notes, and snippets.

@jcallaghan
Last active March 27, 2021 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcallaghan/67f6e90423984c020713de69e78218d2 to your computer and use it in GitHub Desktop.
Save jcallaghan/67f6e90423984c020713de69e78218d2 to your computer and use it in GitHub Desktop.
Toggle through scenes
alias: 'Remote - Next scene'
id: '6999bb6f-2240-4351-8713-9b5ff51ae34d'
description: ''
initial_state: true
# mode: queued
trigger:
- platform: device
domain: zha
device_id: 9cc8f74f10a011ebaccc019f907cbc1f # Bedroom Wall Light Switch
subtype: turn_on
type: remote_button_short_press
- platform: device
domain: zha
device_id: 9cc756d410a011ebb5418935c0e9e21d # Bedroom Light Switch
subtype: turn_on
type: remote_button_short_press
condition:
condition: or
conditions:
# We only want to change the scene with the remote 'On'button when the lights are already on.
- condition: state
entity_id: light.bedroom_lightgroup
state: 'on'
# We want to be able to change from 'Off' scene when it is used.
- condition: state
entity_id: input_select.bedroom_scenes
state: 'Off'
action:
# Move to the next scene based on the current activity of the room.
- service: input_select.select_next
data:
entity_id: input_select.bedroom_scenes
# Turn on the scene we have just selected.
# Note I use the replace function to remove spaces and replace them with underscores so I can use friendly names in the helper.
- service: scene.turn_on
data_template:
entity_id: "scene.bedroom_{{ states('input_select.bedroom_scenes') | replace(' ', '_') | replace('(', '') | replace(')', '') }}"
bedroom_scenes:
name: Bedroom scenes
options:
- Bright
- Subtle
- Concentrate
- Dimmed
- Night Light
- Subtle and TV
- Bed Light
- Bed Light and TV
- Ambilight
- Sexy time
- 'Off'
icon: mdi:lightbulb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment