Afternoon All,
I’ve recently disconnected Hive from British Gas and gone local with Zigbee2MQTT and got the boost functionality working happily (It sends the correct command to the receiver so the boost shows on on the thermostat)
I’ve created a custom card (Not exactly this one) and it works fine however what I’d like to do is show the status via the icon colour to show if a boost is already in progress. I’ve tried the variations below and can’t make it change colour when Hive reports “emergency_boost” as one of the attributes
type: custom:button-card
entity: climate.hive_reciever
icon: mdi:fire
show_label: true
show_name: false
label: Boost to 25C
tap_action:
action: call-service
service: script.hive_boost_to_25c_for_30_mins
show_state: true
state:
- value_template: {{ state_attr('climate.hive_reciever', 'system_mode') }} === 'emergency_heating'
color: red
icon: mdi:fire
- value: climate.hive_reciever.attributes.system_mode === 'off'
color: blue
icon: mdi:fire
- value: {climate.hive_reciever.system_mode == heat}
color: rgb(3, 169, 244)
icon: mdi:fire
These are from the developer states area incase it’s required.
climate.hive_reciever
Hive Reciever
heat hvac_modes: off, auto, heat
min_temp: 5
max_temp: 32
target_temp_step: 0.5
current_temperature: 20.5
temperature: 19.5
hvac_action: off
linkquality: 72
local_temperature: 20.48
occupied_heating_setpoint: 19.5
running_state: idle
system_mode: heat
temperature_setpoint_hold: true
temperature_setpoint_hold_duration: 65535
friendly_name: Hive Reciever
supported_features: 1
What I’m really asking…is can it be done by pulling an attribute and I’m not seeing it?
pedolsky
(Pedolsky)
January 28, 2022, 8:05am
2
The syntax is wrong, try
state:
- operator: template
value: "[[[ return entity.attributes.system_mode == 'emergency_heating' ]]]"
color: red
icon: mdi:fire
1 Like
Thank you very much, it’s obvious now (as usual)
milutm
(Milutm)
May 25, 2022, 9:54pm
5
not work for me. See media player icon and state od media player. not attribute
type: custom:button-card
entity: media_player.moode_player
show_name: false
show_icon: true
show_state: true
state:
- operator: template
value: '[[[ return entity.attributes.is_volume_muted == ''true'' ]]]'
icon: mdi:fire
1 Like
pedolsky
(Pedolsky)
May 25, 2022, 10:18pm
6
If a state attribute’s value is true
or false
, use it without quotes:
value: '[[[ return entity.attributes.is_volume_muted == true ]]]'
1 Like
hammie00
(Hammie00)
September 27, 2022, 12:31pm
7
Hi, thanks for all the help here!
I’m still not getting to work, it always makes the upper statement true.
I also tried quotes around the number.
Anyone for help?
TIA,
Ed
type: custom:button-card
tap_action:
action: call-service
service: script.nest_19_graden_eco_uit
service_data: {}
target: {}
state:
- operator: template
value: '[[[ return climate.living_room.attributes.temperature != 19 ]]'
color: grey
- operator: template
value: '[[[ return climate.living_room.attributes.temperature == 19 ]]'
color: lawngreen
styles:
card:
- box-shadow: 0px 0px 10px 3px rgb(18,81,219,100%)
show_name: true
icon: mdi:radiator
show_icon: true
name: '19'
icon_height: 20px
pedolsky
(Pedolsky)
September 27, 2022, 1:47pm
8
If you don’t use the entity
variable, it’s states['climate.living_room'].attributes.temperature
(if the syntax hasn’t changed).
3 Likes
hammie00
(Hammie00)
September 30, 2022, 12:09pm
9
Thanks a million!! That worked!
(and i forget a third closing ] bracket at the end)
metodi
(metodi)
February 8, 2023, 11:54am
10
Hello,
I tried the same solution, but it didn’;t work for me.
Now i’ve tried the yaml below and it still doesn’t work.
Any suggestions:
entity: cover.kantoor_raam_2
show_entity_picture: null
show_icon: false
show_name: false
entity_picture: /local/icon/silhouette_closed.png
styles:
card:
- height: 220px
- padding: 1em
- background-image: url("/local/icon/silhouette_closed.png")
- background-repeat: no-repeat
- background-size: cover
state:
- value_template: >
{% if (state_attr('cover.kantoor_raam_2', 'current_tilt_position')|int ==
100) %}
styles:
card:
- background-image: url("/local/icon/silhouette_open.png")
- value_template: >
{% if (state_attr('cover.kantoor_raam_2', 'current_tilt_position')|int ==
0) %}
styles:
card:
- background-image: url("/local/icon/silhouette_closed.png")
pedolsky
(Pedolsky)
February 8, 2023, 5:55pm
11
custom:button-card
doesn’t use Jinja (this is what you are using in your code below) but Java. There are multiple examples in the documentation and in the main community topic .
I cannot really debug your code because I don’t use it anymore.
metodi
(metodi)
February 13, 2023, 9:55am
12
I don’t know what jinja is. I just need to show a different picture depending on the attribute status