#Hey guys i hope someone could help me

1 messages ยท Page 1 of 1 (latest)

soft veldt
#

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.

ocean girder
#

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.

soft veldt
ocean girder
soft veldt
#

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
ocean girder
#

my watch is actually on the charger now but it stays this icon

soft veldt
#

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.

ocean girder
#
- 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

soft veldt
#

what two icons do you want to use? what states does it report?

ocean girder
#

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

soft veldt
#

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.

ocean girder
#

i would like to use the mdi:watch if its not charging and maybe mdi:flash for charging

soft veldt
#

Maybe: ```yaml

  • type: template
    entity: sensor.watch4_battery_level
    icon: >
    {{ (states("binary_sensor.watch4_is_charging")=="charging") | iif("mdi:flash", "mdi:watch") }}
ocean girder
#

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

soft veldt
#

might be I put charging instead of watch. could also be a spacing issue.

ocean girder
#

hmm

#

when i was looking on google people used sensor.watch4_battery_state aswell

soft veldt
#

could be possible. I kinda guessed at the entity name

ocean girder
#

my watch is watch4

#

no space

#

isent mdi an icon?

soft veldt
#

I made some progress on this side. Gimme a sec.

ocean girder
ocean girder
soft veldt
#
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.

ocean girder
#

do i need to change binary_sensor.fire_computer_desk_plugged_in
to the binary sensor watch4?

soft veldt
#

perhaps. do you know how to look up the entities available to the watch4? (developer tools or in integrations)

ocean girder
#

ill check hold on

soft veldt
ocean girder
#

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 ๐Ÿ˜„

soft veldt
#

well that changes the icon but you don't have the battery level showing, right?

ocean girder
#

oh yeah correct

#

did not even notice it haha

#

i've been banging my head against this issue a whole day

soft veldt
#

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...

soft veldt
ocean girder
#

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

soft veldt
#

yeah. trying to dig around the docs.

ocean girder
#

U mean the chip card docs?

soft veldt
#

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'') }}'
ocean girder
#

With color woah

#

You know your stuff haha, ill put it in my yaml just a sec

soft veldt
#

Now, I'm going to see if I can make it "work" with as a chip.

soft veldt
ocean girder
#

ill look into it

soft veldt
#

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.

ocean girder
#

jinja?

soft veldt
#

it is something to do with the {{ ... }}. I don't know very much about it.

ocean girder
#

i did get the spacing right but it looks very off when its not a chip card haha

soft veldt
#

yeah. that's what I was afraid of.

ocean girder
#

also the % is gone aswell

#

does show up in a new card

soft veldt
#

because the second code is for a regular mushroom card. the mushroom chip card has a separate set of capabilities.

ocean girder
#

ahh yeah i removed the chips type and replaced it with the template card

soft veldt
#

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') }}
ocean girder
#

let me replace it sec

soft veldt
#

updated code to incorporate icon color

ocean girder
#

trying to get the code into the card

#

oh wait u changed the code again? xD

soft veldt
#

just added the last bit with the color. and changed to yellow & gray.

ocean girder
#

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!

soft veldt
#

I notice the same with my Fire. Probably just a matter of the integration updating.

ocean girder
#

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?

soft veldt
#

If you wanted to get really fancy, you could incorporate battery percent level icons....

ocean girder
#

i believe my phone does it

#

but i did not change the icon on there

soft veldt
#

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.

ocean girder
#

so youre a fast learner ๐Ÿ˜„

soft veldt
# ocean girder i believe my phone does it

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.

ocean girder
#

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

soft veldt
#

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.

ocean girder
#

might even consider using this instead of the flash since its on a wireless charger haha

ocean girder
soft veldt
#

that makes sense. I was just looking at the mdi watch icons.

ocean girder
#

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?

soft veldt
#

It might be possible to show two icons. I have a custom "thingie" that shows the battery percentage in a custom:button-card.

ocean girder
soft veldt
ocean girder
#

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

soft veldt
#

usually it is a matter of putting bits and pieces together to accomplish what you want.

ocean girder
#

if you have the knowledge on how everything fits togheter haha

soft veldt
#

this was some of the work-in-progress for the battery icon thing

ocean girder
#

so its animated i assume

soft veldt
#

no. the icons are static but just change based on percentage.

ocean girder
#

ooh so you mean something like this

soft veldt
#

these are animated when active. subdued when inactive; flashes red when active.

ocean girder
#

the 42% one is lets say half full

#

66% one a little more then half

ocean girder
soft veldt
#

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'; ]]]

ocean girder
#

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!

soft veldt
#

you must be in the UK or somewhere along there. Only 7 PM here.

#

any time.

ocean girder
#

i am from the netherlands

#

so 1 hour later then UK ๐Ÿ˜„

soft veldt
#

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..

ocean girder
#

i sure will! thanks ๐Ÿ˜„