Hello, I’m new.
Can I change the switch icon?
“On”: mdi: open
“Off”: mdi: closed
I created customize.yaml and typed:
switch.sonoff_1111cff59c:
friendly_name: Door
state_icon:
"On": mdi: open
"Off": mdi: closed
I guess it’s stupid?
tom_l
March 26, 2020, 8:25am
2
Why is your door sensor a switch ?
Switches are outputs to be controlled by home assistant, not inputs read by home assistant
tom_l:
Why is your door sensor a switch ?
Switches are outputs to be controlled by home assistant, not inputs read by home assistant
Sonoff produces a switch for the garage door.
tom_l
March 26, 2020, 8:33am
4
Customize does not support icon templates. Was the switch discovered or do you have a yaml config for it?
Switch has been discovered.Use the sonoff account in yaml
tom_l
March 26, 2020, 9:17am
6
Then your only option is to change it in Lovelace using something like this:
I had looked at the config-template card but, since I wanted to be able to reuse the Jinja2 templates I use in the rest of Home Assistant, I decided to see if I could create a card like that which could apply Jinja2 templates Lovelace cards.
Introducing the card-templater card
https://github.com/gadgetchnnel/lovelace-card-templater
Installation
This requires card-tools to be installed, check the link for details on installing this if you don’t have it installed.
This card can either be instal…
thank you for direction
it would be easy to change the icons on the switch you created? (input_boolean) ??
created automation, I’m not in HA long
tom_l
March 26, 2020, 9:48am
8
No, input booleans do not support icon templates either.
You could create a template switch that mimics your sonoff switch. They support icon templates.
switch:
- platform: template
switches:
garage:
value_template: "{{ is_state('switch.sonoff_1111cff59c', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.sonoff_1111cff59c
turn_off:
service: switch.turn_off
data:
entity_id: switch.sonoff_1111cff59c
icon_template: >-
{% if is_state('switch.sonoff_1111cff59c', 'on') %}
mdi:door-open
{% else %}
mdi:door-closed
{% endif %}
6 Likes
Thank you so much, this is how it works…
Many sensors will provide their own icons already, I wish there were less examples of this over complicated if-then-else for icon_template
icon_template: "{{ state_attr('binary_sensor.your_device', 'icon') }}"
You’ll need to provide more information. You have revived a SOLVED post from 2020 and it’s not clear what you are asking.
Sorry, updated my post thanks
What specific card are you referring too? You can template icons, some cards allow templating for the icon field and others may require modding. Trying to get a feel for your situation.
I’m trying to control my companion app’s functions, e.g. bluetooth, mute/unmute and it seems incredibly tedious given that they are all developed by HA, see Combining Bluetooth sensor and command into a toggle switch
I’ll let others chime in. You want to control your phones BT settings via a message command. From my understanding, Notify doesn’t control phone setting beyond the app.