I have a switch to toggle a smart outlet. Rather than change the icon based on the switch state, I need the icon to change based on another entity (plug current for example). The thought behind this is the switch can toggle an outlet for my dehumidifier on and off, but the icon will only turn yellow if the device is running. The switch and plug current entities are functional, just not sure how to merge the two. Ideas?
Thanks for the link! That’s cool, but not exactly what I’m looking for. The screenshot is what I currently have, but would like it to be one single row. For example: Dehumidifier Switch" controls the outlet, the I/O icon turns yellow when there is power draw on the outlet. I can monitor outlet power either in the config or NodeRed, so the code could be either place or both.
That allows you to template the icon and active state, which I would expect could combine a switch for one entity with an icon and color of another. In any case, I don’t use it, and YMMV.
Ok thanks, I’ll have to tinker with it. I like to reverse engineer code, but this thing I am trying to create has me stumped…
Getting closer. Still would like to have the switch be where “Running” is displayed. Here’s my Lovelace code:
type: entities
title: Default
entities:
- entity: switch.awp04l_plug_3
- type: custom:template-entity-row
icon: mdi:lamp
name: The Dehumidifier is {{states('switch.awp04l_plug_3')}} and is
state: >-
{% if is_state('binary_sensor.bdhm_status', 'on')%} Running {% else %} Not
Running {% endif %}
secondary: Current Time {{states('sensor.time')}}
active: '{{ is_state(''binary_sensor.bdhm_status'', ''on'') }}'
state_color: true
And the results:
If still relevant, I started with the sensor as a switch so it shows the status (in my case closed/open) and when pressed you can call service toggle:switch and choose the switch you want to operate.