Trying to use a virtual switch to set up some lighting automation

Fairly new to HA and trying to expand on my setup to build some more complex automations. I am running HA in a docker container & I’ve created a virtual switch which has the following entity ID;

input_boolean.o_mode_sw

Will this have default values of Off/On, or True/False? or do I have to create the values?

I believe to customise the values on this switch to anything I like I need to edit the configuration.yaml, which is new to me. I’ve located the file in winSCP, but the file seems really “light”

# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
# Text to speech
tts:
  - platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

The HA help pages say to customise an entity, put the values in this file and quotes an example:

homeassistant:

name: Home

unit_system: metric

# etc



customize:

# Add an entry for each entity that you want to overwrite.

thermostat.family_room:

entity_picture: https://example.com/images/nest.jpg
friendly_name: Nest

switch.wemo_switch_1:

friendly_name: Toaster

entity_picture: /local/toaster.jpg

switch.wemo_switch_2:

friendly_name: Kitchen kettle

icon: mdi:kettle

switch.rfxtrx_switch:

assumed_state: false

media_player.my_media_player:

source_list:

- Channel/input from my available sources

# Customize all entities in a domain

customize_domain:

light:

icon: mdi:home

automation:

initial_state: "on"

# Customize entities matching a pattern

customize_glob:

"light.kitchen_*":

icon: mdi:description

"scene.month_*_colors":

icon: mdi:other

do I just literally put the relevant code at the end of my existing yaml or do I have to begin a new section somehow?

Also there is a warning on that page that says: “If you implement customize, customize_domain, or customize_glob you must make sure it is done inside of homeassistant: or it will fail.”

But I cant do it from within home assistant as I am using docker so cant edit the file directly, I have to do it via ssh? Or am I reading that wrong?

Ideally I want the switch to have 4 states - Off, 1, 2, 3 (Or Off, On, 1, 2 if Off/On/True/False etc are required states).

I tried asking ChatGPT to get an idea of what I needed to do and it wrote the below code (I;m conscious its often wrong, but wanted a starting point)


- alias: "Switch to On-white"
  trigger:
    platform: state
    entity_id: input_boolean.o_mode_sw
    to: 'on-white'
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.o_mode_sw

- alias: "Switch to On-Music"
  trigger:
    platform: state
    entity_id: input_boolean.o_mode_sw
    to: 'on-music'
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.o_mode_sw

- alias: "Switch to On-DIY"
  trigger:
    platform: state
    entity_id: input_boolean.o_mode_sw
    to: 'on-diy'
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.o_mode_sw

- alias: "Switch to Off"
  trigger:
    platform: state
    entity_id: input_boolean.o_mode_sw
    to: 'off'
  action:
    - service: input_boolean.turn_off
      entity_id: input_boolean.o_mode_sw

I tried putting this into a blank automation in the Yaml editor in HA but got the error “Message malformed: extra keys not allowed @ data[‘0’]” ?

An input boolean will always have the state on or off. It will be displayed as On or Off. You can’t change this.

That ChatGPT output is unsurprisingly gibberish. Please stop using it and read the documentation instead.

That’s not a switch. Switches only have two states on or off.

Use an input_select helper instead.