Hi, I’m new to HA and HADashboard, so in trying to get to grips with things, I’ve created a sensor that lists my TV state. On/off. When added to HADashboard I have a widget called samsung TV but it shows text as on or off depending on the state. What I want to do is display the mdi-power icon, either coloured green if status is on and coloured red if status is off, see example pics below.
I’ve also created sunrise and sunset times, I want these to display the mdi-weather-sunset-up/down icons with the time underneath, again see example of how I want it to look.
for the TV you can use the binary_sensor widget.
a widget with a static icon and changing text beneath it isnt there.
fo that you probably need to create your own custom widget.
I spoke too soon! I thought the binary sensor was working but that’s because the TV was off. The sensor never changes state. I suspect it’s because I don’t know what I am doing! I’ve put together the sensor from various examples I found.
When I use similar code, just as a sensor, then it works fine so I’m definitely doing something wrong with the binary_sensor.
Here’s the code I’m using.
binary_sensor:
platform: template
sensors:
tvstate:
friendly_name: Samsung TV
value_template: >-
{%- if is_state(“states.media_player.samsung_tv.state”, “off”) -%}
off
{%- else -%}
on
{%- endif %}