Skip to content

Instantly share code, notes, and snippets.

@jonmunson
Last active January 6, 2026 16:32
Show Gist options
  • Select an option

  • Save jonmunson/f4e560c9f6a81c315f46a28786a99ad8 to your computer and use it in GitHub Desktop.

Select an option

Save jonmunson/f4e560c9f6a81c315f46a28786a99ad8 to your computer and use it in GitHub Desktop.
Displays the battery percentage of your home battery. The icon will vary based on the battery percentage and the battery operation mode (charge/discharge/standby). Icons need to be downloaded from Lametric or provided by yourself. You will need a HA entity for the battery charge and one for the battery mode. Adapt percentages and modes to your l…
alias: Awtrix Home Battery Charge
description: Publishes the current home battery charge to the Awtrix clock
triggers:
- alias: Matrix turned on
trigger: state
entity_id: light.awtrix_xxxxxx_matrix
to: "on"
- alias: Charge level/mode changes
trigger: state
entity_id:
- sensor.battery_state_of_charge
- sensor.battery_mode
conditions: []
actions:
- action: mqtt.publish
data:
topic: awtrix_xxxxxx/custom/batterycharge
qos: 0
retain: false
payload: >-
{%- set charge = states('sensor.battery_state_of_charge') | float(-1) | round(0) -%}
{%- set mode = states('sensor.battery_mode') -%}
{%- if mode == "Charge" -%}
{%- if charge > 85 -%}
{%- set icon = 32047 -%}
{%- elif charge > 69 -%}
{%- set icon = 32049 -%}
{%- elif charge > 51 -%}
{%- set icon = 32050 -%}
{%- elif charge > 34 -%}
{%- set icon = 32051 -%}
{%- elif charge > 17 -%}
{%- set icon = 32052 -%}
{%- else -%}
{%- set icon = 32053 -%}
{%- endif -%}
{%- elif mode == "Discharge" -%}
{%- if charge > 85 -%}
{%- set icon = 32059 -%}
{%- elif charge > 69 -%}
{%- set icon = 32058 -%}
{%- elif charge > 51 -%}
{%- set icon = 32057 -%}
{%- elif charge > 34 -%}
{%- set icon = 32056 -%}
{%- elif charge > 17 -%}
{%- set icon = 32055 -%}
{%- else -%}
{%- set icon = 32054 -%}
{%- endif -%}
{%- else -%}
{%- if charge > 90 -%}
{%- set icon = 13735 -%}
{%- elif charge > 70 -%}
{%- set icon = 13732 -%}
{%- elif charge > 40 -%}
{%- set icon = 13731 -%}
{%- elif charge > 10 -%}
{%- set icon = 13725 -%}
{%- else -%}
{%- set icon = 13734 -%}
{%- endif -%}
{%- endif -%}
{"text": "{{ charge }} %", "icon": "{{ icon }}", "progress": {{ charge }}}
mode: single
@jonmunson
Copy link
Author

Awtrix Icon List

Based on the automation template, here are all the icon numbers you'll need to download to your Awtrix device:

Charging Icons (mode: "Charge")

  • 32047 (charge > 85%)
  • 32049 (charge 70-85%)
  • 32050 (charge 52-69%)
  • 32051 (charge 35-51%)
  • 32052 (charge 18-34%)
  • 32053 (charge ≤ 17%)

Discharging Icons (mode: "Discharge")

  • 32059 (charge > 85%)
  • 32058 (charge 70-85%)
  • 32057 (charge 52-69%)
  • 32056 (charge 35-51%)
  • 32055 (charge 18-34%)
  • 32054 (charge ≤ 17%)

Idle/Other Status Icons

  • 13735 (charge > 90%)
  • 13732 (charge 71-90%)
  • 13731 (charge 41-70%)
  • 13725 (charge 11-40%)
  • 13734 (charge ≤ 10%)

Total: 17 icons

These icons are likely from the Lametric icon database that Awtrix uses. You can download them through the Awtrix companion app or by accessing your Awtrix device's web interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment