Lovelace: Power wheel card

I do something wrong, only i can not find what.45

card config:

grid_power_consumption_entity: sensor.youless_usage
grid_power_production_entity: sensor.solaredge_energy_today
production_is_positive: false
solar_power_entity: sensor.solaredge_current_power
type: ‘custom:power-wheel-card’

Units not equal for all sensors for the power view.

And, is this indeed the case? Have you compared the units of the sensors involved?

If I have a single grid sensor in kW, which is positive when consuming from the grid, and negative.
At the end of the game I need two daily energy sensors in kWh for grid consumption and grid production, both as positive numbers.

Would the first step be to use the integration sensor to create two distinct sensors : one for production and one for consumption, both positive values) ? If so, I guess I should first start with creating 2 template sensors, based on +/- status of the grid sensor, then integrate each new sensor ?

Something like :

- platform: template
    sensors:
      grid_consume:
        friendly_name: "Grid power consumption"
        value_template: >-
          {% if states.sensor.solaredge_grid_power.state |float > 0 %}
            {{ states.sensor.solaredge_grid_power.state }}
          {% else %}
            0
          {% endif %}
      grid_produce:
        friendly_name: "Grid power production"
        value_template: >-
          {%- if states.sensor.solaredge_grid_power.state | float < 0 %}
            {{ states.sensor.solaredge_grid_power.state | float | abs }}
          {% else %}
            0
          {% endif %}

then create 2 integration sensors like:

sensor:
  - platform: integration
    source: sensor.grid_consume:
    name: grid_consume_int
    unit_prefix:
    round: 2
  - platform: integration
    source: sensor.grid_produce:
    name: grid_produce_int
    unit_prefix:
    round: 2

But then these would integrate for ever. So If I want daily energy counters both for production and consumption, would I finally need to create 2 additional sensors based on the Utility Meter, with a daily cycle ? Or is it possible to reset the integration sensors on a daily basis ?

Yes, this is exactly what I do and it works beautifully.

1 Like

Everything is working, but I wonder how accurate these integration/utility meter sensors are.
My SolarEdge inverter has, among others, 2 sensors:

  • sensor.solaredge_solar_power : solar production power, in kW
  • sensor.solaredge_energy_today : solar energy produced today, in Wh

Both sensors are updated every 10 minutes.

I made an integration sensor based on sensor.solaredge_solar_power called “sensor.solaredge_solar_power_int”, than used that new integration sensor with the Utility Meter sensor to get both a daily (sensor.daily_solar_prod) and a monthly value (sensor.monthly_solar_prod). I wanted to compare this approach with the “energy today” reported directly by the SolarEdge inverter, and the results are very much different:

  • sensor.solaredge_energy_today : 2529.0 Wh so 2.5 kWh
  • sensor.daily_solar_prod : 4.607 kWh

How could someone explain such difference between the 2 ? I have no clue if SolarEdge counts the variation in intensity in between data update intervals and that would be the reason for such difference.
Or am I wrongly using the various transpositions, ie going from the invertor kW sensor to an integration kWh sensor than going with it to utility meter sensors ?

If I did it right, then it also means my grid_consume and grid_produce sensors in Wh are worth nothing (they are based on the solaredge power consumption modbus option), and the only way to get proper readings for grid consumption is to have some type of sensor (like a smart meter) that would report directly on energy (Wh or kWh) and where the reported data takes into account any consumption/production event and variation that took place in between the data report intervals.

10 min is a long time, surely internally your SolarEdge is integrating much faster.

In my personal setup I get power measurements (using clamps) every 2 seconds! and my results are very close to my power meter.

BTW you can use the utility meter directly with sensor.daily_solar_prod

Do you mean the utility meter sensor is also integrating, so I don’t have to integrate 2 times (first with integration sensor than with utility meter sensor)?

The utility meter does not integrate, what I mean is that you don’t require the integration of sensor.solaredge_solar_power to account energy use. You can use SolarEdge_energy_today and the utility meter will work fine accumulating monthly, yearly, whatever…

Hi @Mariusthvdb,

I read you connected a modbus power sensor. I’ve ordered a solaredge PV-system with a solaredge modbus energy meter. Soon to be installed :slight_smile:

How did you read values trough the modbus connection? What hardware did you use? How is it wired?

I use a Iungo system which is connected to my modbusses (?) and Ha reads the Mqtt topics it publishes

I’ve recently installed a Solaredge PV system with the optional modbus power meter which measures your internal consumption.
I’ve got his set up using the built-in HA integration via solaredge web API
Thought it would be good to install this custom card. Like a few others here, and I assume all solaredge users, the built in solaredge sensors don’t conform to the +ve/-ve values for import/export.
Solaredge has:
‘sensor.solaredge_solar_power’ which gives solar production in kW
‘sensor.solaredge_grid_power’ which is the import (+ve) and export (-ve)
in addition, ‘sensor.solaredge_power_consumption’ tells me how much the house is consuming… I FOUND USING THIS ENTITY JUST CONFUSES ALL THE NUMBERS IN THE POWER WHEEL CARD!!

To make this work I needed both export and import to be positive values. To achieve this I created two template sensors, the first to read export and convert it to a positive value, the second to read import.

Export: this looks at ‘sensor.solaredge_grid_power’. if value is -ve (exporting) it converts to positive. if value already +ve it reads 0.
In the ‘sensors’ section of your config.yaml

platform: template
    sensors:
      solar_power_export:
        unit_of_measurement: 'kW'
        value_template: >-
          {%- if (states('sensor.solaredge_grid_power') | float <0) -%}
          {{ -(states('sensor.solaredge_grid_power') | float) }}
          {%- else -%}
          0
          {%- endif -%}
      solar_power_import:
        unit_of_measurement: 'kW'
        value_template: >-
          {%- if (states('sensor.solaredge_grid_power') | float >=0) -%}
          {{ (states('sensor.solaredge_grid_power') | float) }}
          {%- else -%}
          0
          {%- endif -%}

The second sensor is the opposite, reads the +ve value or zero.

Then in the lovelace frontend (I just add a manual card with this config as I find it easier)

grid_power_consumption_entity: sensor.solar_power_import
grid_power_production_entity: sensor.solar_power_export
power_decimals: 2
solar_power_entity: sensor.solaredge_solar_power
type: 'custom:power-wheel-card'
title: Power Distribution

Voila!

I’m looking to use this card to replicate my Sense monitor’s Solar ‘wheel’ in HA. Issue is I don’t know if I have the right sensors to use this card.

I have two sensors: First is sensor.energy_production which is my instantaneous solar production measured in watts (provided by my Sense monitor). Second is sensor.energy_usage which is my instantaneous house consumption (from both solar and grid) measured in watts. I don’t have sensors for what I’m pulling from the grid or what I’m exporting to the grid.

Can I use just these two sensors to drive the Power Wheel card? Or do I have to create a value template to do the math required to determine the grid import/export amounts? Is that template as simple as grid_nett = sensor.energy_production - sensor.energy_usage?

Use the integration integration to create kWh sensors for the card.

With the 2 values you have you will need to create 2 more. the maths is the easy bit, getting the syntax correct can take some trial and error.
Grid usage = house consumption - solar generation (when > 0)
Grid export = solar generation - house consumption

best way to learn is copy someone else’s code and modify to suit your needs.

If you get really stuck I’ll see what I can do to assist

After getting this up and running I went down another track of installing Floorplan ans whilst this is predominantly as the title suggests, it can be used to create any card where you want graphics to change state.
I integrated my own version of the power wheel and have the arrows change direction and colour based on the value.
I’ve got quite a bit more going on but there’s nothing to stop you making a card using floorplan purely for the power wheel.

1 Like

I assume this Reimann intregral is to get from my current instant Power values to an energy-over-time value? Thanks, I’ll keep it in mind if I decide I want that view.

Sense already provides sensors for solar energy produced and total energy consumed for daily/weekly/monthly/yearly.

Check this out:
Created something you might want to use:

Thanks for the response. Looks like you can actually do it with just a single additional template value: Net Grid Export (positive when you’re exporting power to the grid and negative when you’re importing power from the grid). This is the YOUR_GRID_POWER_SENSOR called out in the power wheel github docs. And using the optional grid_power_entity (C) parameter for the lovelace card.

Here’s my code for future readers:
In Sensors.yaml:

- platform: template
  sensors:
    grid_power_export: # Grid Power Export for Sense Power Wheel
        friendly_name: 'Grid power export'
        unit_of_measurement: 'W'
        value_template: >-
          {{ (states("sensor.energy_production") | float | int) - (states("sensor.energy_usage") | float | int) }}

And here’s my Lovelace Manual Card config:

type: 'custom:power-wheel-card'
solar_power_entity: sensor.energy_production  # <-- the Sense monitor's sensor
grid_power_entity: sensor.grid_power_export  # <-- the template value I created in sensors.yaml

Reminder to install the power wheel card plugin from the HACS marketplace. Also add the module text to your resources section of your lovelace.yaml.

HACS does that for you :slight_smile:

Any idea why HACS requires you to take a 2nd action to add the required module to your lovelace.yaml file? You click the install button, HACs installs, but then it prompts you to click a second button (‘add to lovelace’ or something like that). Why require the two separate actions? Why not just include the ‘add to lovelace’ step in the install process?

You’d have to ask leedus about his design decisions. :slight_smile:

1 Like