#Hey guys i hope someone could help me
1 messages ยท Page 1 of 1 (latest)
I have a similar issue with my Fire tablets. I could have swore it used to show the charging status with the icon but it looks like it is not working even though my phone and Samsung tablet shows fine.
A couple of issues to consider. The first is the integrated battery/charging icon is actually multiple icons that take into consideration the battery percentage. So there's like 10 different icons... (not a roadblock though)
The next thing is you need the yaml to check the other entity's charging state. Not too big of a roadblock, still doable.
Lastly, different cards have different formats for being able to show different states.
I am actually using the mushroom card which only shows 2 icons for my phone, a solid battery icon and when charging it has a lightning bolt in it.
i did not want to have the same icon for my watch and phone thats why i want to change the battery icon into a watch and have it show the %
In that case, you might need something along these lines. This is for a muchroom-chips-card
- type: template
entity: input_boolean.guest_mode
content: Guest Mode
icon: >
{{ (states(entity)=="on") | iif("mdi:home",
"mdi:home-off-outline") }}
icon_color: |
{{ (states(entity)=="on") | iif("green", "red") }}
press_action:
action: toggle
I think your watch issue and my Fire tablet issue are pretty much similar. What entities do you have for your watch? Do you have an _is_charging or _is_plugged_in?
Post your yaml that you have so far for your mushroom card and I'll plug it in on my side with my tablet and we'll get it figured out.
noo wait my watch does show the charging state but i changed the icon to the watch, my question was if i could switch between 2 icons depending on the charging state
- type: entity
entity: sensor.watch4_battery_level
icon: mdi:watch
if i would remove the icon: mdi:watch it would be the same as my phone which would make it confusing
what two icons do you want to use? what states does it report?
I am pretty new to yaml code so bear with me haha, my watch does have binary_sensor.watch4_is_charging
i was thinking i should use it somewhere in my yaml
also, IIRC, one of the mushroom cards has a bug in it that did not allow some sort of customization. It might have been the entity card which is why I use the mushroom template card.
i would like to use the mdi:watch if its not charging and maybe mdi:flash for charging
Maybe: ```yaml
- type: template
entity: sensor.watch4_battery_level
icon: >
{{ (states("binary_sensor.watch4_is_charging")=="charging") | iif("mdi:flash", "mdi:watch") }}
i did read on google that you can change colors depending on its state
let me check
am i doing something wrong here ๐ฎ
not sure why it includes the stuff below in your code
not sure if its a problem but i am using custom:stack-in-card
might be I put charging instead of watch. could also be a spacing issue.
could be possible. I kinda guessed at the entity name
I made some progress on this side. Gimme a sec.
Really appreciate you helping me out, i got looking into yaml like 2 days ago so this is pretty advanced for me ๐
type: custom:mushroom-chips-card
chips:
- type: template
entity: sensor.fire_computer_desk_battery_level
icon: >
{{ (states("binary_sensor.fire_computer_desk_plugged_in")=="off") |
iif("mdi:watch", "mdi:flash") }}
Made some progress. This works for me so far.
do i need to change binary_sensor.fire_computer_desk_plugged_in
to the binary sensor watch4?
perhaps. do you know how to look up the entities available to the watch4? (developer tools or in integrations)
ill check hold on
is this what you are looking for?
omg
chips:
- type: template
entity: sensor.watch4_battery_level
icon: >
{{ (states("binary_sensor.watch4_is_charging")=="off") | iif("mdi:watch",
"mdi:flash") }}
this works
it has a small delay but thats more then alright!
you sir are my hero ๐
well that changes the icon but you don't have the battery level showing, right?
oh yeah correct
did not even notice it haha
i've been banging my head against this issue a whole day
so that's going to be the next step. I know if we use content: is shows exactly what we type which isn't going to work...
not uncommon when dealing with yaml and trying to get cards to do exactly what you want.
i need to just learn yaml some more but i dont really know where to start haha
so what you are doing is already a big help
content_info: state would that be something to use?
just a shot in the dark trying to be useful haha
Oh wait u said it wasnt going to work my bad
yeah. trying to dig around the docs.
U mean the chip card docs?
Yeah. The chips don't have as much documentation and "features" sometimes. I actually just completely redid everything...
But it works... ๐
type: custom:mushroom-template-card
entity: sensor.fire_computer_desk_battery_level
primary: '{{ states(''sensor.fire_computer_desk_battery_level'') }} %'
icon: '{{ is_state(''binary_sensor.fire_computer_desk_plugged_in'', ''on'') | iif(''mdi:flash'', ''mdi:watch'') }}'
icon_color: '{{ is_state(''binary_sensor.fire_computer_desk_plugged_in'', ''on'') | iif(''red'', ''green'') }}'
Now, I'm going to see if I can make it "work" with as a chip.
You may have to adjust your spacing and add a dash ( - ) before the type depending on your layout.
ill look into it
can't seem to make it work with the chip entity card. think this was the bug that I ran into before. the icon: does not accept the Jinja template.
jinja?
it is something to do with the {{ ... }}. I don't know very much about it.
i did get the spacing right but it looks very off when its not a chip card haha
yeah. that's what I was afraid of.
because the second code is for a regular mushroom card. the mushroom chip card has a separate set of capabilities.
ahh yeah i removed the chips type and replaced it with the template card
But, taking what I just learned with regular card. I think I may have figured out how to get the content: to work with the chip card.
type: custom:mushroom-chips-card
chips:
- type: template
entity: sensor.fire_computer_desk_battery_level
content: '{{ states(''sensor.fire_computer_desk_battery_level'') }} %'
icon: >
{{ (states("binary_sensor.fire_computer_desk_plugged_in")=="off") |
iif("mdi:watch", "mdi:flash") }}
icon_color: >-
{{ is_state('binary_sensor.fire_computer_desk_plugged_in', 'on') | iif('yellow',
'gray') }}
let me replace it sec
just added the last bit with the color. and changed to yellow & gray.
it does have around a 10 second delay before it notices it charges which is not a problem for me to be honest ๐
i cannot thank you enough!
I notice the same with my Fire. Probably just a matter of the integration updating.
i cannot write code but when i read it i do know what to change in order to put my own twist on it haha
where did you learn yaml if u dont mind me asking?
If you wanted to get really fancy, you could incorporate battery percent level icons....
yeah i think so but it does what i wanted it to do ๐
i believe my phone does it
but i did not change the icon on there
honestly, I just recently stated messing with YAML. been using HA for about 3 years. Was super intimidated with coding but wanted to start automating. Ended up using Node-RED instead of learning yaml. Ended up learning some JavaScript and making my own functions. Started messing with yaml when I started designing my tablet dashboards about a year ago.
so youre a fast learner ๐
yeah. the phone and tablet seem to do it through the HA app, but in the case of my Fire, I'm using the Kiosk Fully Browser integration. I think the integration (assuming for your watch too) just doesn't report or do something that HA understands regarding the battery and charging.
well it did if i did not add the icon:
but then i would have the same icon as my phone which will end up confusing me
i wanted to differentiate my watch and phone battery icon
HA has improved a lot in regards to being able to do stuff through the UI. Honestly, I don't do much with the UI and resort to straight yaml.
might even consider using this instead of the flash since its on a wireless charger haha
i wasent able to do what i have now through GUI
that makes sense. I was just looking at the mdi watch icons.
yeah i did not find a bolt with watch icon
now my watch icon ended up being fancier then my phone icon haha
do you mind if i message you if i have any future questions?
It might be possible to show two icons. I have a custom "thingie" that shows the battery percentage in a custom:button-card.
that sounds pretty cool ๐ i am still at the start of putting togheter a better dashboard for main use
I don't mind. I'm still learning myself, but can usually figure things out if I apply enough time (and Googling) towards it.
well i did a lot of googling, but could not find anything that i wanted, was even googling at work but no dice
even tried code from google but then it just does not work which frustrates me haha
usually it is a matter of putting bits and pieces together to accomplish what you want.
if you have the knowledge on how everything fits togheter haha
this was some of the work-in-progress for the battery icon thing
so its animated i assume
no. the icons are static but just change based on percentage.
these are animated when active. subdued when inactive; flashes red when active.
yeah i wanted to mess around with animated icons but havent goten around to it yet
should be in multiple of ten (I think) but yeah. In theory, something could be applied to the watch icon such as using color for battery level.
from the yellow battery icon above ```yaml
var_color: |-
[[[
var blevel=entity.state;
if (blevel > 70) return 'lime';
else if (blevel >= 30) return 'yellow';
else return 'red';
]]]
and the icon flashes if it is below 10% ```yaml
icon:
- color: '[[[ return variables.var_color ]]]'
- animation: |
[[[ if (entity.state <= 10 ) return 'blink 2s ease infinite'; ]]]
i am still pretty new to home assistant haha
started really getting into it in 2022
so all this code i dont know how it made but i would love to learn haha
i did find a post on google with a lot of animated icons
but not sure how to make them work for the icons i have to navigate to other sub views
i just noticed its almost 12 AM i should head off to bed haha
once again thanks a lot for taking the time to help me out I really appreciate it!
was pretty close. if you need any help lemme know. I work weird hours so my schedule is probably more in line with yours than most in the US..
i sure will! thanks ๐