I have animated solar inverter event and I came up with the following:
#---------------------------------------Inverter Animation-----------------------------------------------#
#---sensor.power - solar power, sensor.pgrid - grid power, sensor.pinverter - battery power -------------#
- platform: template
sensors:
charger_card:
value_template: >-
{% if states.sensor.power.state | float > 50 and states.sensor.pgrid.state | float > -50 and now().strftime('%T') > '7:00:00' and now().strftime('%T') < '18:00:00' %}
1
{% elif states.sensor.pinverter.state | float > 50 and states.sensor.pgrid.state | float < -50 and now().strftime('%T') > '7:00:00' and now().strftime('%T') < '18:00:00' %}
2
{% elif states.sensor.power.state | float < 50 and states.sensor.pgrid.state | float < -50 and now().strftime('%T') > '7:00:00' and now().strftime('%T') < '18:00:00' %}
3
{% elif states.sensor.power.state | float > 50 and states.sensor.pgrid.state | float < -50 and now().strftime('%T') > '7:00:00' and now().strftime('%T') < '18:00:00' %}
4
{% elif states.sensor.power.state | float < 50 and states.sensor.pinverter.state | float > 50 and states.sensor.pgrid.state | float < -50 and now().strftime('%T') > '7:00:00' and now().strftime('%T') < '18:00:00' %}
5
{% elif states.sensor.power.state | float < 50 and states.sensor.pinverter.state | float > 50 and states.sensor.pgrid.state | float > -50 and now().strftime('%T') > '7:00:00' and now().strftime('%T') < '18:00:00' %}
6
{% elif states.sensor.power.state | float < 50 and states.sensor.pinverter.state | float < 50 and states.sensor.pgrid.state | float < -50 and now().strftime('%T') > '18:00:00' and now().strftime('%T') < '22:00:00' %}
7
{% elif states.sensor.power.state | float < 50 and states.sensor.pinverter.state | float > 50 and states.sensor.pgrid.state | float > -50 and now().strftime('%T') > '18:00:00' and now().strftime('%T') < '22:00:00' %}
8
{% elif states.sensor.power.state | float < 50 and states.sensor.pinverter.state | float > 50 and states.sensor.pgrid.state | float > -50 and now().strftime('%T') > '22:00:00' and now().strftime('%T') < '23:59:59' %}
9
{% elif states.sensor.power.state | float < 50 and states.sensor.pinverter.state | float > 50 and states.sensor.pgrid.state | float > -50 and now().strftime('%T') < '7:00:00' %}
9
{% elif states.sensor.power.state | float < 50 and states.sensor.pinverter.state | float < 50 and states.sensor.pgrid.state | float < -50 and now().strftime('%T') > '22:00:00' and now().strftime('%T') < '23:59:59' %}
10
{% elif states.sensor.power.state | float < 50 and states.sensor.pinverter.state | float < 50 and states.sensor.pgrid.state | float < -50 and now().strftime('%T') < '7:00:00' %}
10
{% elif states.sensor.power.state | float < 50 and states.sensor.pinverter.state | float > 50 and states.sensor.pgrid.state | float < -50 and now().strftime('%T') > '22:00:00' and now().strftime('%T') < '23:59:59' %}
11
{% elif states.sensor.power.state | float < 50 and states.sensor.pinverter.state | float > 50 and states.sensor.pgrid.state | float < -50 and now().strftime('%T') < '7:00:00' %}
11
{% else %}
NONE
{% endif %}
#---1 - # solar power, no grid
#---2 - # no solar power, battery power and grid power, day
#---3 - # no solar power, grid power, day
#---4 - # solar power, grid power, day
#---5 - # foggy, battery power, grid power, day
#---6 - # foggy, battery power, day
#---7 - # foggy, only grid power, day
#---8 - # battery power, noon
#---9 - # only battery power, night
#---10 -# only grid power, night
#---11 -# battery and grid power, night
#-----------------------------------------------END---------------------------------------------------------#
lovelace:
type: picture-glance
title: Inverter animation
entities:
- sensor.power
state_image:
'1': /local/gif/inverter/day.gif
'2': /local/gif/inverter/day_batt_grid.gif
'3': /local/gif/inverter/day_grid.gif
'4': /local/gif/inverter/day_grid_solar.gif
'5': /local/gif/inverter/foggy_batt_grid.gif
'6': /local/gif/inverter/foggy_batt.gif
'7': /local/gif/inverter/foggy_grid.gif
'8': /local/gif/inverter/noon.gif
'9': /local/gif/inverter/night_battery.gif
'10': /local/gif/inverter/night.gif
'11': /local/gif/inverter/night_batt_grid.gif
entity: sensor.charger_card
Not sure if this can be done easier somehow, please check and let me know any other way of animating event based on time of the day.