Custom Solar Power Card the Tesla Style (almost)

I don’t actually understand what is wrong? What is not working?

what is not working is :

  • I have a negative value
  • it doesnt show the house consumption
  • no production on solar pannel when they are producing
  • no info about energy exported
  • no ingo about energy imported

I really want to say you thank you for your time

I think this is because of my sensor code… it looks like text in green :

I changed for power card, much easier to parameter… thanks again!

I’m not sure your sensors.yaml is configured correctly.

How is it included in configuration.yaml? as a package or like sensor: !include sensors.yaml

Hola, yes it does, but finally change for other intégration :stuck_out_tongue_winking_eye:

Hi all.

Is there a way to resize this card? I have tried using CardMod to size the card, but that doesn’t make the text/graphics scale, and so they just run off the sides of the card.

Thanks for any suggestions!

1 Like

Who can help me out ?

I have a huawei inverter and battery.

For this card all values need to be positve. But my battery uses the same sensor ( [sensor.battery_charge_discharge_power] ) for battery discharging and charging. The valua gets positive when charging and negative when discharging.

Use some templates with min, max and abs functions to make two new sensors, one for charging one for charging.

i’m not so good in this. This is what i made so far. Don’t know if it’s correct like this.

  template_solar_to_battery:
    friendly_name: "from solar to battery"
    unit_of_measurement: "W"
    device_class: power
    value_template: >
      {% if states('sensor.battery_charge_discharge_power') | int > 0 %}
        {{ states('sensor.battery_charge_discharge_power') }}
      {% else -%}
        0
      {% endif %}



  template_battery_to_house:
    friendly_name: "from battery to house"
    unit_of_measurement: "W"
    device_class: power
    value_template: >
      {% if states('sensor.battery_charge_discharge_power') | int < 0 %}
        {{ states('sensor.battery_charge_discharge_power') }}
      {% else -%}
        0
      {% endif %}

Who can help me out? I can’t figure it out any more. We now have a battery and all my values are wrong now. I really need some help. So who is so kind to help me out?

Not quite sure which parts exactly are working or not working for you now. However, from reading your previous post you say that all values need to be positive, so I guess that at least your “from battery to house” sensor is not giving you the expected value?

Adding an abs filters makes the negative sensor value a positive number:

Thanks for your answer.
All my readings are wrong now. :crazy_face:

Can you see what’s wrong in my configuration?

sensor:

  • platform: template
    sensors:

    sensor used to show power flow from Panels to Grid, but shows a negative at night

    template_grid_feed_in:
    friendly_name: “Solar 2 Grid”
    unit_of_measurement: “W”
    device_class: power
    value_template: >
    {% if states(‘sensor.grid_active_power’) | int > 0 %}
    {{ states(‘sensor.grid_active_power’) }}
    {% else -%}
    0
    {% endif %}

    sensor used to show power flow from grid to house and doesn’t allow it to show a negative number only positive numbers

    template_grid_consumption:
    friendly_name: “net naar huis”
    unit_of_measurement: “W”
    device_class: power
    value_template: >
    {% if states(‘sensor.grid_active_power’) | int > 0 %}
    0
    {% else -%}
    {{ (states(‘sensor.grid_active_power’) | int) | abs }}
    {% endif %}

    shows the solar power being fed to the house and doesn’t allow it to show a negative number only positive numbers

    template_curent_solar_consumption:
    friendly_name: “curent solar consumption”
    unit_of_measurement: “W”
    device_class: power
    value_template: >-
    {% if states(‘sensor.template_grid_consumption’) | float > 0 %}
    {{ states(‘sensor.active_power’) }}
    {% else -%}
    {{ (states(‘sensor.active_power’)| float - states(‘sensor.template_grid_feed_in’)| float) }}
    {% endif %}

    shows live usage for the house

    template_live_verbruik:
    friendly_name: “verbruik huis live”
    unit_of_measurement: “W”
    device_class: power
    value_template: >-
    {% set val1 = states(‘sensor.active_power’)| float(0) %}
    {% set val2 = states(‘sensor.grid_active_power’)| float(0) %}
    {{ iif(val1 >= val2, val1 - val2, this.state) }}

    shows own usage

    template_own_usage:
    friendly_name: “eigen opwekking”
    unit_of_measurement: “kWh”
    device_class: power
    value_template: >-
    {{ (states(‘sensor.daily_yield’)| float - states(‘sensor.grid_export_solar_daily_energy’)| float) }}

    shows usage per day

    template_usage_per_day:
    friendly_name: “verbruik per dag”
    unit_of_measurement: “kWh”
    device_class: power
    value_template: >-
    {{ (states(‘sensor.template_own_usage’)| float + states(‘sensor.grid_import_solar_daily_energy’)| float) }}

    template_solar_to_battery:
    friendly_name: “from solar to battery”
    unit_of_measurement: “W”
    device_class: power
    value_template: >
    {% if states(‘sensor.battery_charge_discharge_power’) | int > 0 %}
    {{ states(‘sensor.battery_charge_discharge_power’) }}
    {% else -%}
    0
    {% endif %}

    template_battery_to_house:
    friendly_name: “from battery to house”
    unit_of_measurement: “W”
    device_class: power
    value_template: >
    {% if states(‘sensor.battery_charge_discharge_power’) | int > 0 %}
    0
    {% else -%}
    {{ (states(‘sensor.battery_charge_discharge_power’) | int) | abs }}
    {% endif %}

  • platform: integration
    source: sensor.boiler_power
    name: boiler energie
    unit_prefix: k
    round: 2

  • platform: integration
    source: sensor.vriezer_power
    name: vriezer energie
    method: left
    unit_prefix: k
    round: 2

  • platform: integration
    source: sensor.koelkast_power
    name: koelkast energie
    method: left
    unit_prefix: k
    round: 2

  • platform: integration
    source: sensor.wasmachine_power
    name: wasmachine energie
    method: left
    unit_prefix: k
    round: 2

  • platform: integration
    source: sensor.vaatwas_power
    method: left
    name: vaatwas energie
    unit_prefix: k
    round: 2

  • platform: integration
    source: sensor.koffiezet_power
    method: left
    name: koffiezet energie
    unit_prefix: k
    round: 2

  • platform: integration
    source: sensor.ender_5_plus_power
    method: left
    name: ender 5 plus energie
    unit_prefix: k
    round: 2

  • platform: integration
    source: sensor.pomp_zwembad_power
    method: left
    name: pomp zwembad energie
    unit_prefix: k
    round: 2

utility_meter:
grid_import_solar_daily_energy:
source: sensor.grid_consumption
cycle: daily
grid_export_solar_daily_energy:
source: sensor.grid_exported
cycle: daily

Sorry, that configuration is really hard to read when not formatted correctly.

Previously you have only explained what sensor sensor.battery_charge_discharge_power does (positive when charging and negative when discharging), but I have no idea what any of these other sensors do that you are using in your template expressions.
I am assuming that you are deriving those sensor values from things like the battery, solar inverter, etc. So, do you know the behaviour of each of those devices and what they report in each situation? That’s how I would approach this to then determine how my template sensors should process that data to use it in this card.

I’ve send you a pm.

I’ve exactly the same issue. Did you solve it already?

How can this be? I’ve deleted the line house_consumption_entity: sensor.house_consumption.
And still the value is there in the balloon of the house.

Hi there, I remember there was a discussion going on about units being off by a factor of 10. I got the same problem and I cannot figure it out. Rest is working.

Is there any theory floating around?

Hi,

is it possible to have more than two additional consumption values (e.g. Car1, Car2, Car3, Car4, …) in this card ?

You can set up the two additional appliances one above (notionally the car) the house icon and one below.

Do you could do car 1 & car 2 this fashion, there are two text boxes in each circle.

Or you could use some templates and group a number of entities or maybe have car1, car2 values in the top appliance numbers and car3, car4 in the bottom appliance numbers.

Hey, the question has already been asked above but not yet answered: is there a way to modify the size of the card ? I have included this card on the dashboard I display on a small Android tablet and this card is taking up too much screen estate. I’d love to be able to give a scaling factor as parameter.

1 Like