Mode switch/Input select button redering

I’m Sorry, my explanation was not clear.

What i tried to explain was;

The mode switch is normally a switch to control 2 lights and thus has 2 codes with the status on or off. the left side; home and sleep, the right side; away and holiday.

when I click on the home button the switch gives the on ‘’ signal to HA, and switches home mode on.
the night mode must be set with the off signal from the switch.

when I press home, the status changes to home, I now press for example sleep, switches off the home status, but the status of sleep does not turn on, so also the same happens at away and holiday. I can turn on ‘away’ but not holiday.

sorry for my bad explanation.

I did test your code with the only switch (power socket) I have, and it works fine.

- alias: thuis (home) stand inschakelen
  trigger:
    platform: state
    entity_id: switch.power_and_meter_2
    to: 'on'
  action:
    service: input_boolean.turn_on
    entity_id: input_boolean.ha_mode_home

- alias: Slapen (night) stand inschakelen
  trigger:
    platform: state
    entity_id: switch.power_and_meter_2
    to: 'off'
  action:
    service: input_boolean.turn_on
    entity_id: input_boolean.ha_mode_night

@Tomahawk thanks for the code above. I literally started on HA this evening (bought an RPI 4 4GB version and got HA installed along with LIFX and Hue bulbs and sensors) so I’m a complete newbie and getting to grips with HA. I have come from SmartThings and then Hubitat (both of which had modes built in to make life easier). My question is - if the files don’t exist, do I just go ahead and create them? Or does the entire code snippet go into configuration.yaml?

Thanks in advance

Yes, create your file and include them in your configuration.yaml. You can organize your files in folders if you think it gives you a better overview.

1 Like

I know this is an old thread but the information still applies. I’d like to thank Tomahawk for this. I implemented it as a controller for the evaporative cooler in my house. I needed to be able to select one of three available fan speeds and no two speeds are allowed to be selected at once. I modified Tomahawk’s code to suit my needs and it worked perfectly, first go!

Thanks again.