Abeksis
January 1, 2022, 4:18pm
909
I need help @clemalex
I copied the code. It should be noted that I already have a robot-vacuum connected to the smart home - in another code. I’m just trying the minimalist.
I constantly get an error … and do not clear to me why.
Here’s the error:
And this information on the Vacuum:
the code:
vacuum_info:
tap_action:
action: none
icon: mdi:robot-vacuum
label: |-
[[[
if (entity.state.toUpperCase() == 'DOCKED' && entity.attributes.battery_level == '100'){
return 'On its base';
}
else if (entity.attributes.status.toUpperCase() == 'CHARGING'){
return 'In charge';
}
else if (entity.state.toUpperCase() == 'CLEANING'){
return 'Cleaning in progress';
}
else if (entity.attributes.status.toUpperCase() == 'RETURNING HOME'){
return 'Back to its base';
}
else if (entity.attributes.status.toUpperCase() == 'PAUSED'){
return 'On break';
}
else{
return '❓ Unknown ❓' ;
}
]]]
styles:
icon:
- color: |-
[[[
if (entity.state.toUpperCase() == 'DOCKED' && entity.attributes.battery_level == '100'){
return 'rgba(var(--couleur-gris),1)';
}
else if (entity.attributes.status.toUpperCase() == 'CHARGING'){
return 'rgba(var(--couleur-vert),1)';
}
else if (entity.state.toUpperCase() == 'CLEANING'){
return 'rgba(var(--couleur-jaune),1)';
}
else if (entity.attributes.status.toUpperCase() == 'RETURNING HOME'){
return 'rgba(var(--couleur-violet),1)';
}
else if (entity.attributes.status.toUpperCase() == 'PAUSED'){
return 'rgba(var(--couleur-bleu),1)';
}
else{
return 'rgba(var(--couleur-gris),1)';
}
]]]
img_cell:
- background-color: |-
[[[
if (entity.state.toUpperCase() == 'DOCKED' && entity.attributes.battery_level == '100'){
return 'rgba(var(--couleur-gris),0.2)';
}
else if (entity.attributes.status.toUpperCase() == 'CHARGING'){
return 'rgba(var(--couleur-vert),0.2)';
}
else if (entity.state.toUpperCase() == 'CLEANING'){
return 'rgba(var(--couleur-jaune),0.2)';
}
else if (entity.attributes.status.toUpperCase() == 'RETURNING HOME'){
return 'rgba(var(--couleur-violet),0.2)';
}
else if (entity.attributes.status.toUpperCase() == 'PAUSED'){
return 'rgba(var(--couleur-bleu),0.2)';
}
else{
return 'rgba(var(--couleur-gris),0.2)';
}
]]]
pedolsky
(Pedolsky)
January 1, 2022, 4:27pm
910
Seems that you have not defined the entity.
Abeksis
January 1, 2022, 4:38pm
912
I also think so, just I do not know what I’m supposed to do, you can give an example.
thanks
pedolsky
(Pedolsky)
January 1, 2022, 4:48pm
913
How did you define your custom:button-card? Could you please post its code?
I see that the temperatures are there, so it’s a problem with the icon templates. Both normal and collapse cards work in my home assistant, so I can’t understand why this happens in your configuration
Abeksis
January 1, 2022, 5:12pm
915
I tried two codes:
a:
- type: custom:button-card
template: vacuum
variables:
entity: vacuum.vacuum
name: vacuum abeksis
b:
- type: custom:stack-in-card
mode: vertical
style: |
ha-card{
border-radius: 21px;
}
cards:
- type: custom:button-card
template: vacuum
variables:
entity: vacuum.vacuum
name: Aspiro
- type: custom:button-card
template: card_1_line_4_actions_select_vacuum_fan_speed
triggers_update:
- sensor.aspiro_fan
variables:
item1_background_entity: sensor.aspiro_fan
item1_background_state: GENTLE
item1_icon: mdi:water
item2_background_entity: sensor.aspiro_fan
item2_background_state: SILENT
item2_icon: mdi:fan
item2_icon_scale: 0.75
item3_background_entity: sensor.aspiro_fan
item3_background_state: STANDARD
item3_icon: mdi:fan
item3_icon_scale: 1.3
item4_background_entity: sensor.aspiro_fan
item4_background_state: TURBO
item4_icon: mdi:fan
item4_icon_scale: 2
pedolsky
(Pedolsky)
January 1, 2022, 6:54pm
916
Your entity vacuum.vacuum
has no states in capital letters. Try it with
label: |-
[[[
if (entity.state == 'docked' && entity.attributes.battery_level == '100'){
return 'On its base';
}
Is vacuum_info:
correctly indented?
flave
January 2, 2022, 1:36am
917
wow, thats awesome. Will have a detailled look at it! Thank you very much for all your configs!
Abeksis
January 2, 2022, 3:59am
918
Thanks for the help,
I changed according to what you said - and unfortunately I still get an error.
code:
vacuum_info:
tap_action:
action: none
icon: mdi:robot-vacuum
label: |-
[[[
if (entity.state.toUpperCase() == 'docked' && entity.attributes.battery_level == '100'){
return 'On its base';
}
else if (entity.attributes.status.toUpperCase() == 'charging'){
return 'In charge';
}
else if (entity.state.toUpperCase() == 'cleaning'){
return 'Cleaning in progress';
}
else if (entity.attributes.status.toUpperCase() == 'retuning home'){
return 'Back to its base';
}
else if (entity.attributes.status.toUpperCase() == 'pause'){
return 'On break';
}
else{
return '❓ Unknown ❓' ;
}
]]]
styles:
icon:
- color: |-
[[[
if (entity.state.toUpperCase() == 'docked' && entity.attributes.battery_level == '100'){
return 'rgba(var(--couleur-gris),1)';
}
else if (entity.attributes.status.toUpperCase() == 'charging'){
return 'rgba(var(--couleur-vert),1)';
}
else if (entity.state.toUpperCase() == 'cleaning'){
return 'rgba(var(--couleur-jaune),1)';
}
else if (entity.attributes.status.toUpperCase() == 'retuning home'){
return 'rgba(var(--couleur-violet),1)';
}
else if (entity.attributes.status.toUpperCase() == 'pause'){
return 'rgba(var(--couleur-bleu),1)';
}
else{
return 'rgba(var(--couleur-gris),1)';
}
]]]
img_cell:
- background-color: |-
[[[
if (entity.state.toUpperCase() == 'docked' && entity.attributes.battery_level == '100'){
return 'rgba(var(--couleur-gris),0.2)';
}
else if (entity.attributes.status.toUpperCase() == 'charging'){
return 'rgba(var(--couleur-vert),0.2)';
}
else if (entity.state.toUpperCase() == 'cleaning'){
return 'rgba(var(--couleur-jaune),0.2)';
}
else if (entity.attributes.status.toUpperCase() == 'retuning home'){
return 'rgba(var(--couleur-violet),0.2)';
}
else if (entity.attributes.status.toUpperCase() == 'pause'){
return 'rgba(var(--couleur-bleu),0.2)';
}
else{
return 'rgba(var(--couleur-gris),0.2)';
}
]]]
manuel_R
(manuel R)
January 2, 2022, 7:58am
919
hello can you tell me if there is a model for the card in the picture? thank you
4 Likes
Abeksis
January 2, 2022, 8:39am
920
in the file button_card_templates.yaml
Look for:
### VERTICAL BUTTONS (fka SCENES) ###
2 Likes
pedolsky
(Pedolsky)
January 2, 2022, 9:56am
921
Please compare what I suggested with your code.
Abeksis
January 2, 2022, 10:00am
922
Sorry, I did not see this part. I’m just working on it now and updates
max5962
(Max5962)
January 2, 2022, 10:22am
923
nice !
the theme seems be to very popular. All custom card should be post on github in order to have an “database”
Abeksis
January 2, 2022, 10:26am
924
I tried like this:
vacuum_info:
tap_action:
action: none
icon: mdi:robot-vacuum
label: |-
[[[
if (entity.state == 'docked' && entity.attributes.battery_level == '100'){
return 'on its base';
}
else if (entity.state == 'charging'){
return 'in charge';
}
else if (entity.state == 'cleaning'){
return 'cleaning in progress';
}
else if (entity.state == 'docked' && 'retuning home'){
return 'back to its base';
}
else if (entity.state == 'pause'){
return 'on break';
}
else{
return '❓ unknown ❓' ;
}
]]]
styles:
icon:
- color: |-
[[[
if (entity.state == 'docked' && entity.attributes.battery_level == '100'){
return 'rgba(var(--couleur-gris),1)';
}
else if (entity.state == 'charging'){
return 'rgba(var(--couleur-vert),1)';
}
else if (entity.state == 'cleaning'){
return 'rgba(var(--couleur-jaune),1)';
}
else if (entity.state == 'retuning home'){
return 'rgba(var(--couleur-violet),1)';
}
else if (entity.state == 'pause'){
return 'rgba(var(--couleur-bleu),1)';
}
else{
return 'rgba(var(--couleur-gris),1)';
}
]]]
img_cell:
- background-color: |-
[[[
if (entity.state == 'docked' && entity.attributes.battery_level == '100'){
return 'rgba(var(--couleur-gris),0.2)';
}
else if (entity.state == 'charging'){
return 'rgba(var(--couleur-vert),0.2)';
}
else if (entity.state == 'cleaning'){
return 'rgba(var(--couleur-jaune),0.2)';
}
else if (entity.state == 'retuning home'){
return 'rgba(var(--couleur-violet),0.2)';
}
else if (entity.state == 'pause'){
return 'rgba(var(--couleur-bleu),0.2)';
}
else{
return 'rgba(var(--couleur-gris),0.2)';
}
]]]
And so: Unfortunately it does not work.
vacuum_info:
tap_action:
action: none
icon: mdi:robot-vacuum
label: |-
[[[
if (entity.state == 'docked' && entity.attributes.battery_level == '100'){
return 'on its base';
}
else if (entity.attributes.status.toUpperCase() == 'charging'){
return 'in charge';
}
else if (entity.state.toUpperCase() == 'cleaning'){
return 'cleaning in progress';
}
else if (entity.state == 'docked' && 'retuning home'){
return 'back to its base';
}
else if (entity.attributes.status.toUpperCase() == 'pause'){
return 'on break';
}
else{
return '❓ unknown ❓' ;
}
]]]
styles:
icon:
- color: |-
[[[
if (entity.state == 'docked' && entity.attributes.battery_level == '100'){
return 'rgba(var(--couleur-gris),1)';
}
else if (entity.attributes.status.toUpperCase() == 'charging'){
return 'rgba(var(--couleur-vert),1)';
}
else if (entity.state.toUpperCase() == 'cleaning'){
return 'rgba(var(--couleur-jaune),1)';
}
else if (entity.attributes.status.toUpperCase() == 'retuning home'){
return 'rgba(var(--couleur-violet),1)';
}
else if (entity.attributes.status.toUpperCase() == 'pause'){
return 'rgba(var(--couleur-bleu),1)';
}
else{
return 'rgba(var(--couleur-gris),1)';
}
]]]
img_cell:
- background-color: |-
[[[
if (entity.state == 'docked' && entity.attributes.battery_level == '100'){
return 'rgba(var(--couleur-gris),0.2)';
}
else if (entity.attributes.status.toUpperCase() == 'charging'){
return 'rgba(var(--couleur-vert),0.2)';
}
else if (entity.state.toUpperCase() == 'cleaning'){
return 'rgba(var(--couleur-jaune),0.2)';
}
else if (entity.attributes.status.toUpperCase() == 'retuning home'){
return 'rgba(var(--couleur-violet),0.2)';
}
else if (entity.attributes.status.toUpperCase() == 'pause'){
return 'rgba(var(--couleur-bleu),0.2)';
}
else{
return 'rgba(var(--couleur-gris),0.2)';
}
]]]
pedolsky
(Pedolsky)
January 2, 2022, 10:30am
925
You are using a template called „vacuum“ in your button-card. But in your template I can see „vacuum_info“ (which is not indented properly I think).
CM000n
(Simon)
January 2, 2022, 12:47pm
926
3 Likes
pedolsky
(Pedolsky)
January 2, 2022, 1:23pm
927
Awesome work again! Love your excellent Wiki .
Also kudos, love and warmth to Paddie
1 Like
CM000n
(Simon)
January 2, 2022, 1:46pm
928
Thank you very much. You should take the wiki with a grain of salt though. During @paddy0174 's absence it is practically not updated and therefore currently quite outdated. We still have some catching up to do here
pedolsky
(Pedolsky)
January 2, 2022, 1:56pm
929
Tell us where we can help