Flow Details
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 liking.
Don't forget to update MQTT info.
automation:
- id: awtrix_app_home_battery
alias: Awtrix Home Battery Charge
description: Publishes the current home battery charge to the Awtrix clock
trigger:
- alias: Matrix turned on
platform: state
entity_id: light.awtrix_xxxxxx_matrix
state: on
- alias: Charge level/mode changes
platform: state
entity_id:
- sensor.battery_state_of_charge
- sensor.battery_mode
condition: []
action:
- service: mqtt.publish
data:
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 %}
{# Output #}
{ "text": "{{ charge }} %", "icon": "{{ icon }}", "progress": {{ charge }} }
topic: awtrix_xxxxxx/custom/batterycharge
qos: 0
retain: false
![/flows/QE6B5QWRoMq0/13725.gif](/flows/QE6B5QWRoMq0/13725.gif)
![/flows/QE6B5QWRoMq0/13731.gif](/flows/QE6B5QWRoMq0/13731.gif)
![/flows/QE6B5QWRoMq0/13732.gif](/flows/QE6B5QWRoMq0/13732.gif)
![/flows/QE6B5QWRoMq0/13734.gif](/flows/QE6B5QWRoMq0/13734.gif)
![/flows/QE6B5QWRoMq0/13735.gif](/flows/QE6B5QWRoMq0/13735.gif)
![/flows/QE6B5QWRoMq0/32047.jpg](/flows/QE6B5QWRoMq0/32047.jpg)
![/flows/QE6B5QWRoMq0/32049.jpg](/flows/QE6B5QWRoMq0/32049.jpg)
![/flows/QE6B5QWRoMq0/32050.jpg](/flows/QE6B5QWRoMq0/32050.jpg)
![/flows/QE6B5QWRoMq0/32051.jpg](/flows/QE6B5QWRoMq0/32051.jpg)
![/flows/QE6B5QWRoMq0/32052.jpg](/flows/QE6B5QWRoMq0/32052.jpg)
![/flows/QE6B5QWRoMq0/32053.jpg](/flows/QE6B5QWRoMq0/32053.jpg)
![/flows/QE6B5QWRoMq0/32054.jpg](/flows/QE6B5QWRoMq0/32054.jpg)
![/flows/QE6B5QWRoMq0/32055.jpg](/flows/QE6B5QWRoMq0/32055.jpg)
![/flows/QE6B5QWRoMq0/32056.jpg](/flows/QE6B5QWRoMq0/32056.jpg)
![/flows/QE6B5QWRoMq0/32057.jpg](/flows/QE6B5QWRoMq0/32057.jpg)
![/flows/QE6B5QWRoMq0/32058.jpg](/flows/QE6B5QWRoMq0/32058.jpg)
![/flows/QE6B5QWRoMq0/32059.jpg](/flows/QE6B5QWRoMq0/32059.jpg)
-- Flow first published on September 22, 2023, last updated on September 22, 2023 at 12:43.