I want to cycle through different scenes with a press on one button. I have setup a input select with automations, and these work.
I am trying to use input_select.select_next but that is not working
This is what i have so far:
#input select
input_select:
living_room_scenes:
name: Scenes
options:
- Full Brighness
- Late Evening
- Dim to 50%
initial: Full Brighness
icon: mdi:lightbulb-on-outline
#Scenes
- name: Full Brighness
entities:
light.stue_loft:
state: on
brightness: 254
color_temp: 363
- name: Late Evening
entities:
light.stue_loft:
state: on
brightness: 25
color_temp: 363
- name: Dim to 50
entities:
light.stue_loft:
state: on
brightness: 127
color_temp: 363
#Automations
- action:
- data:
entity_id: scene.Late_Evening
service: scene.turn_on
alias: sent stue
condition: []
id: '1517247483895'
trigger:
- entity_id: input_select.living_room_scenes
platform: state
to: Late Evening
- action:
- data:
entity_id: scene.full_brighness
service: scene.turn_on
alias: full stue
condition: []
id: '1517165268340'
trigger:
- entity_id: input_select.living_room_scenes
platform: state
to: Full Brighness
- action:
- data:
entity_id: scene.Dim_to_50
service: scene.turn_on
alias: 50% stue
condition: []
id: '1517163787601'
trigger:
- entity_id: input_select.living_room_scenes
platform: state
to: Dim to 50%
- action:
- alias: ''
data:
entity_id: input_select.living_room_scenes
service: input_select.select_next
alias: test
condition: []
id: '1517316749974'
trigger:
- entity_id: sensor.living_room_switch
platform: state
to: 4_click
@Joachim_Ahm_Mortense
I’m also interest cycling through scenes with a button as I have Insteon keypad 6 and that will be great. Did you managed to get it working?
I something similar with a Xiaomi Smart Button, you need to make sure your input select works with your automation’s then use the below code with your own entity id.
##Lounge Fan Wall Switch
- alias: Lounge Wall Fan Switch
trigger:
- platform: event
event_type: click
event_data:
click_type: single
entity_id: binary_sensor.switch_158d000201ce4e
action:
- service: input_select.select_next
data:
entity_id: input_select.lounge_fan
Wow @jimpower that is quite impressive setup and documentation you did there. I will definitely take a deeper look at your “Kingia Castle” setup as it is exactly this kind of home automation I’m going toward. Big thanks for sharing!!
thanks for your time. Im new to home automation. Check config button gives error
Invalid config for [automation]: [input_select] is an invalid option for [automation]. Check: automation->action->0->input_select. (See /config/configuration.yaml, line 67). Please check the docs at https://home-assistant.io/components/automation/
can you explain which scene id from the states tab should i enter? Thank you
So you need to follow the steps I have provided above, the input_select does not go in the automation section.
Step One - Add input_select into your configuration.yaml file exactly as above.
Step Two - Add your scenes to your scene.yaml or configuration.yaml file depending on how you handle scenes, then reboot HA this will add the input_select & scenes and make them available for automations.
Step Three - Add automations to your automation.yaml and reboot.
Once HA Comes back up you can call your automations from the service button to ensure they work.
thank you, now i understand hassio structure much better.
Still struggling with this. Light doesnt respond to double click if input select and scenes are not connected. But from webui i can activate scenes. Where is my mistake?
input_select:
yeecolours:
name: Color Mode
options:
- dim
- bright
initial: bright
icon: mdi:palette
scene:
- name: dim
entities:
light.yeelight_rgb_7c49eb0ff332:
state: on
transition: 1
brightness_pct: 10
kelvin: 5000
- name: bright
entities:
light.yeelight_rgb_7c49eb0ff332:
state: on
transition: 1
brightness_pct: 100
kelvin: 5000
automations.yaml
- alias: Yeelight Dim
trigger:
- platform: state
entity_id: input_select.yeecolours
to: dim
action:
- service: scene.dim
- alias: Yeelight Bright
trigger:
- platform: state
entity_id: input_select.yeecolours
to: bright
action:
- service: scene.bright
- alias: Change light scenes
trigger:
- platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d0001d8ea53
click_type: double
action:
- service: input_select.select_next
data:
entity_id: input_select.yeecolours
I would love to use this solution for cycling through scenes (and playlist-entries) within Node-Red. Has anyone tried this perhaps? Will be thankful for any hints.
The options: script cycles through all options pressing the on (I) button, except for option 0 (off), which is only selected when the off (o) zigbee button is pressed.
To teach myself the new scripting features in 0.113, I modified your automation to use the new choose feature. It is useful when the action must choose between different services and especially when the services have different options. Although it can be done entirely with templates, the result is a bit messy; the choose feature makes it neater.
Here’s how it works:
If the event is 1002, it calls select_next.
If the event is 2002, it sets the input_select to its first option.
Finally, the action calls scene.turn_on and computes the scene’s name. I shortened the template slightly by using regex_replace to remove ( and ) characters.
Wow that looks lots better
Only question I have is, in my earlier script it skipped option 0 as this is the Off option, which I do not want to cycle through.
How does your script prevent that ?