Hi,
I’m trying to make a switch based on shelly1pm that would display the status of this switch and the icon according to the consumption in the mushroom light card. I’m somehow not succeeding. Either both are displayed from the switch or the sensor power or the icon is not displayed at all.
- type: custom:mushroom-light-card
entity: sensor.are_leds_of_childish_led_strip_switch_on
name: Reset
tap_action:
action: call-service
service: switch.toggle
service_data:
entity_id: switch.shellyplus1pm_d4d4da7cc500_switch_0
- type: custom:mushroom-light-card
entity: switch.shellyplus1pm_d4d4da7cc500_switch_0
name: Reset
icon: |
"{{ states('sensor.childish_led_strip_icon') }}"
Sensors
- sensor:
- name: "Are leds of childish led strip switch on"
unique_id: are_leds_of_childish_led_strip_switch_on
state: >
{% if is_state("switch.shellyplus1pm_d4d4da7cc500_switch_0", "on") %}
on
{% else %}
off
{% endif %}
icon: >
{% if states("sensor.shellyplus1pm_d4d4da7cc500_switch_0_power")|float > 3 %}
mdi:light-switch
{% else %}
mdi:light-switch-off
{% endif %}
- name: "Childish led strip icon"
unique_id: childish_led_strip_icon
value_template: >
{% if is_state('switch.shellyplus1pm_d4d4da7cc500_switch_0', 'on') %}
on
{% else %}
off
{% endif %}
icon_template: >
{% if states("sensor.shellyplus1pm_d4d4da7cc500_switch_0_power")|float > 3 %}
mdi:light-switch
{% else %}
mdi:light-switch-off
{% endif %}