Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106229

Which kind of code to use

$
0
0

Hello,
I’m using this part of code inside a card:

custom_fields:
      battery: |
        [[[
         if (states["sensor.m2007j22g_battery_state"].state == "charging")
            return `<ha-icon
              icon="mdi:battery-charging"
              style="width: 20px; height: 20px;"></ha-icon
              <span>${states['sensor.m2007j22g_battery_level'].state}%</span>`
]]]
In the <span> tag, which is the command to use in order to choose the character dimension of battery level (XY%)?

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 106229

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>