JonahKr / power-distribution-card

A Lovelace Card for visualizing power distributions.
MIT License
209 stars 13 forks source link

invert arrow #162

Closed 1achy closed 4 months ago

1achy commented 4 months ago

Is it possible make if respect entity direction enrgy for invert battery arrow?

JonahKr commented 4 months ago

Hi there, I sadly don't understand what you are asking. I can highly recommend using Deepl as a translator or give me more context of what you are trying to achieve. Take care!

1achy commented 4 months ago

I would like to reverse the battery energy flow arrows. I have an entity that gives me the charging and discharging of the battery and based on this entity I would like to change towards arrows

example:

i want some like this:

i dont know us make this

1achy commented 4 months ago

This is correct :?

invert_arrow : {%- set sensor = states('sensor.esolar_batterydirection') %} {%- if sensor == 'Charging' %} True {%- elif sensor == 'Standby' %} 0 {%- else %} False {%- endif %}

JonahKr commented 4 months ago

Ah ok i see what you are trying to do. Sadly the yaml parsing for card configurations doesn't support jinja templates that I am aware of. However, there should be a relatively easy solution for this by utilizing helpers.

  1. Go to the Helpers tab and create a new Template sensor: Open your Home Assistant instance and show your helper entities.

  2. Fill out the necessary information which should roughly like this: grafik with the following State template:

    {% if is_state('sensor.esolar_batterydirection', 'Charging') %}
    {{  states('sensor.esolar_totalloadpower') | int * -1}}
    {% else %}
    {{ states('sensor.esolar_totalloadpower') | int}}
    {% endif %}
  3. Afterwards you can just use your new helper sensor as the entity for the tile.

Hope this helps!

1achy commented 4 months ago

VERY VERY tks ;)