Before I start showing some template examples, I have to say that I use the Nova Launcher on my Android - it allows me to ‘layer’ multiple widgets on top of each other.
So, I normally use a ‘Service Button’ widget that I use to call e.g. a switch.toggle service in the background; I use an image for the icon, but I don’t use the ‘Label’ field.
I then overlay it with a smaller/half-size ‘Template’ widget that allows me to not only show the status, but apply some basic formatting, e.g. font color.
The Service Button is straightforward and the template widget looks like this:
{% if is_state('automation.frigate_notification_poolcam','on') -%}
<font color="green">
{% else %}
<font color="red">
{% endif %}
<b> {{ states('automation.frigate_notification_poolcam') }}</b>
This is the result on my screen:
![image](https://community-assets.home-assistant.io/original/4X/2/8/1/281da0382fbc9085d37559bf878d09a4a69d7db6.png)
Tapping on the camera symbol turns the automation on and off.
I don’t think it’s straightforward to dynamically change the icon/symbol itself, but I’m good with the 2-layer setup.
To display info from multiple sensors I also use the template widget, e.g.
WS {{ ((states("sensor.temp") | float(0) - 32)*5/9) | round(1) }}C<br>Pt {{ ((states("sensor.temp_1") | float(0) - 32)*5/9) | round(1) }}C<br>Pl {{ ((states("sensor.temp_2") | float(0) - 32)*5/9) | round(1) }}C
This widget converts and shows temperature values in Celsius, which are in Fahrenheit in my Home Assistant installation, without having to create these sensors in the Home Assistant installation itself:
![image](https://community-assets.home-assistant.io/original/4X/9/2/a/92a68d0e1c2ac636267aa59ea5bc8fe415af9930.png)
The only way I’ve so far been able to drive multiple actions with one button is to use the setup from above and trigger an actionable notification.
Example:
I have two outdoor fans that are each switched on and off remotely.
I use the ‘Service Button’ widget to execute a script:
service: notify.mobile_app_pixel
data:
message: "Choose the Fan to toggle:"
title: Outdoor Fan Action
data:
ttl: 0
priority: high
tag: outdoor_fan_action
actions:
- action: toggle_outdoor_fan_both
title: Both
- action: toggle_outdoor_fan_patio
title: Patio
- action: toggle_outdoor_fan_terrace
title: Terrace
channel: Alert
importance: high
I am then presented the three options:
![image](https://community-assets.home-assistant.io/original/4X/0/3/8/0382fd2ef9e972f93c7e25bee782dcaa27b6c05a.png)
I select the option I want and the widget on my screen changes e.g. from
![image](https://community-assets.home-assistant.io/original/4X/c/7/7/c7794a2bc9f60a8e1ab53ecb7dbcd87c948054d4.png)
to
![image](https://community-assets.home-assistant.io/original/4X/6/f/1/6f18b75577af694a14a9f537a23132d649d5cc65.png)
And this is the code for the widget that changes the text color, the text itself comes from a separate helper:
{% if is_state('sensor.outdoor_fan_status','On') -%}
<font color="red">
{% elif is_state('sensor.outdoor_fan_status','Off') -%}
<font color="green">
{% else %}
<font color="yellow">
{% endif %}
<b>{{ states('sensor.outdoor_fan_status') }}</b>