How to change the syle of a switch? [SOLVED]

He doesn’t like the 2 flash symbols for the light is how I read it in which case my solution will give him a slider switch.

3 Likes

He has another thread this conversation came from.

I was assuming he was trying to combine them.

If he would use a switch it would work just fine.

This:

1 Like

Thanks for your input guys. I am implementing an MQTT switch which turns on a group of Insteon switches from Openhab (Insteon scene doesn’t work well in HA yet).

Here I am solely concerned about the cosmetics of the buttons on the lovelace. I want the front yard to look master closet light (slider switch). assumed_state: false didn’t work nor setting the optimistic: true.

Any other ideas?

I have it like this in my config:

homeassistant:
    customize: !include customize.yaml
    whitelist_external_dirs:
        - '/config/tmp'
    customize_domain:
      light:
        - platform: mqtt
          name: "Front Yard"
          command_topic: "light/group/fy"
          assumed_state: false

however, check config spits out this error:

expected a dictionary for dictionary value @ data[‘customize_domain’][‘light’]

All I can say is that this mqtt switch works 100% for me without changing any customization:

- platform: mqtt
  name: 'Poo Button'
  command_topic: 'homeassistant/switch/poo_btn/cmd'
  state_topic: 'homeassistant/switch/poo_btn/state'
  payload_on: 'on'
  payload_off: 'off'
  retain: true
light:
    - platform: mqtt
      name: "Front Yard"
      command_topic: "light/group/fy"
      optimistic: true
      retain: true

This is how I have it, but still shows as two button switch like how it is on the the picture I posted. :frowning:

I never said to include all that other stuff in the customize domain. Just try it like I posted.

Nice it worked like charm

Yeah it works for me too lol… I was pretty sure that was what you wanted.

1 Like

Thank you so much david

1 Like

@DavidFW1960 how about going the opposite way? I want the 2 icons instead of the sliding switch. Thank you.

Remove your state topic (and template if there is one).

An old topic I know however I couldn’t get any of the options working for me.
I want to see the slider switch (per the below image), instead I’m seeing the two icons.

image

My configuration is as follows:

Lovelace Card

  • type: entities
    title: NFT System
    entities:
    • entity: switch.greenhouse_isolate_nft
      icon: mdi:pipe-valve
      name: Isolate Auto Top Up

YAML

input_boolean:
notify_home:
name: Notify when someone arrives home
icon: mdi:car

greenhouse_isolate_nft:
name: Greenhouse Isolate NFT

switch:
- platform: template
switches:
greenhouse_isolate_nft:
friendly_name: NFT Isolated
turn_on:
service: input_boolean.turn_on
data:
entity_id: input_boolean.greenhouse_isolate_nft
turn_off:
service: input_boolean.turn_off
data:
entity_id: input_boolean.greenhouse_isolate_nft

Please format your pasted configuration correctly. See point 11 here: Help us help you

Your switch does not have a value_template to determine what state the switch is in.

You could add this to the switch config:

value_template: "{{ is_state('input_boolean.greenhouse_isolate_nft', 'on') }}"

But this seems kind of pointless. Why are you duplicating an input boolean as a switch?

Hello,

I’m running Home Assistant Core 2023.5.4 on a Raspberry Pi. Before posting, I have read different contents and related community topics and run different tests and still cannot get the switch to replace to two lightnings for my RF switch to ligh the bulb on or off:
https://www.home-assistant.io/docs/configuration/customizing-devices/
https://www.home-assistant.io/docs/configuration/
https://community.home-assistant.io/t/integration-error-customize-integration-customize-not-found/428713
https://community.home-assistant.io/t/customize-include-customize-yaml-causing-an-error-in-the-config/120496/13

As I am in Core this is my setting:

configuration.yaml

# 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
homeassistant:
  customize: !include customize.yaml

[...]

mqtt:
  switch:
    - name: bulb
      unique_id: myuniquebulbid_1
      state_topic: "home/OMG_ESP8266_RF/MQTTto433"
      command_topic: "home/OMG_ESP8266_RF/commands/MQTTto433"
      value_template: '{{ value_json.value}}'
      payload_on: '{"value":1111}'
      payload_off: '{"value":0000}'
      state_on: 1111
      state_off: 0000
      qos: "0"
      retain: true
      device_class: switch

customize.yaml (only two lines)

switch.bulb:
  assumed.state: false

And this is how it looks:

Frontend:
image

Entity:


I must be missing something, but I do not know what else to try at this point so any feedback is appreciated.

I think it should be assumed_state: false not assumed.state: false

@fxcoolby Thank you I edited that line
image
Developer > Check configuration > Ok and then reboot. But it still does not show the switch. Thank you, anyway :+1:

Hi after taking a closer look the config should be like following:

homeassistant:
  customize:
    switch.myuniquebulbid_1:
      assumed_state: false

I think your mqtt unique_id serves as entity_id in ha unless it is not specified and it will pickup the name as entity_id.

Try above ans ee if it works.

How would we do this with rflink switches guys, any suggestion? I would like both ‘on’ and ‘off’ to be available at the same time because the 433 Mhz switches do not provide feedback.