Energy view adds smart meter household consumption and solar panel production

Hi,

I do have a solar panel app (i.e. a SolarEdge inverter) and a created a sensor device that does track the household consumption. So this sensor device is configured like

 "class": "sensor",
  "capabilities": [
    "measure_power",
    "meter_power.imported",
    "meter_power.exported"
  ],
  "capabilitiesOptions": {
    "meter_power.imported": {
      "title": {
        "en": "Imported Energy"
      }
    },
    "meter_power.exported": {
      "title": {
        "en": "Exported Energy"
      }
    }
  },
  "energy": {
    "cumulative": true,
    "cumulativeImportedCapability": "meter_power.imported",
    "cumulativeExportedCapability": "meter_power.exported"
  },

in “measure_power” the total current household conumption is set… e.g. 500 watts.
In the device’s “energy” view (not the energy tab) this device is listed as a smart meter. Additionally I can see my solar panel (i.e. the inverter).

When the solar panel does not produce energy, everything is fine. I.e. the “circle” displays the current household consumption, substracts the e.g. smart plugs consumptions and everything else is denoted as “other”.

However, if the solar panel is producing (e.g. 2000 watts) the circle’s consumption value shown is adding the solar panels production to the household consumption, so e.g. 2000 + 500 watts = 2500 watts.

Somehow I wouldn’t say this is the expected result, the solar panel should not have its production added to the household consumption.

Now I’m not sure, if this is the way Homey presents that details, I’ve done something wrong with miy own app device’s config or it is expected.

BTW: If I exclude the Solarpanel inverter for the energy metrics, the circle would propertly show just the current household consumption, substract other meters and shows everything else as other. However this is no solution, because if I do that, I would also remove the solar panel from the “energy tab” which should show the solar production.

Is that a bug either in the custom driver or in Homey?

Cheers, Michael

Where is the energy from the solar panels going?
Do you have a Grid device?
If you are exporting the energy that should show a negative value to show where the solar energy is going.

Note: If you have a home battery, then the old energy view won’t work if it has been configured to work with the new energy tab. Basically, Athom have made conflicted choices with regards to the configurations, so a home battery doesn’t show up in the old energy view.

I have a sonnenBatterie homeBattery device. I’m currently prototyping the sonnenBatterie app for the new energy tab.
The sonnenBatterie being connected to the solar panels inverter would provide consumption as well as production values, knows about grid feed-in as well as grid-consumption. Also aggregating those values is possible by the app.

I’ve created above sensor device (called “sonnenBatterie_meter” for now) as a spin-off from the “sonnenBatterie” device being a battery with homeBattery config.

The derived metering device sets:
this.setCapabilityValue(‘measure_power’, Consumption_W);
this.setCapabilityValue(‘meter_power.imported’, currentState.totalGridConsumption_Wh / 1000);
this.setCapabilityValue(‘meter_power.exported’, currentState.totalGridFeedIn_Wh / 1000);

The master homebatterie device is having “meterPowerImportedCapability”: “meter_power.charged” and “meterPowerExportedCapability”: “meter_power.discharged” being set to the total watts sent to the battery respectively obtained from the battery.

this.setCapabilityValue(‘meter_power.charged’, currentState.totalToBattery_Wh / 1000);
this.setCapabilityValue(‘meter_power.discharged’, currentState.totalFromBattery_Wh / 1000);
“measure_power” of the battery is negative on discharge, positive on charge. So in the screenshot currently it’s discharging. “meter_power” of the homeBattery is accumulating the consumption.
So here the household consumption is 492W, -456W are being discharged from the battery (~30W are always taken from grid as the battery doesn’t support full autonomy), solar panel is not producing anymore. So daily production was 36,4 kWh, importing was just 0,4 kWh (as said the battery cannot run fully autonomous and always consumes a bit grid energy even if fully charged), but given that household total consumption was far below production, a lot energy was exported to grid.


If I’m running on battery everything looks okay in the energy view, because the solar panels inverter produces 0 watts, and household consumption is e.g. 481W.
However if there’s solar production it adds to the household consumption which I think is wrong, like below: 602W is the actual household consumption, so that should be shown in the circle. However it shows 768W=602W consumption + 166W solar production :frowning:

Code is in GitHub - mech78/Homey.Sonnen at improve_energy - not really cleaned up yet. As said yet prototyping. I tried to split the devices because I hoped that would work better compared to having all capabilities in one device.

You mentioned conflicting choices by Athom. What do you mean with homeBattery configured to work with the new energy tab vs. old energy view? - I’d only know about the toggle to include a device into the energy config. Then it’ll show up in the old view as well as in the energy tab.

If you take a look at my Sofar app in github, there’s two branches. The master is setup to work with the old energy view. The other branch is modified to work with the new energy tab. Unfortunately, I can’t find a way to make it work with both. I queried this with Athom and they are not interested in the old system, so won’t be making any changes. Therefore, you have make a choice between the two.

Thanks, I had a look.

What I found promising is that in ady.sofar/drivers/grid/driver.compose.json at NewEnergySystem · AdyRock/ady.sofar · GitHub you did basically what I also did when adding a dedicated metering device in Homey.Sonnen/Source/com.sonnen.battery/drivers/sonnenbatterie_meter/driver.compose.json at fix_energy_metering · mech78/Homey.Sonnen · GitHub - So splitting off a “grid”-like sensor device is the way to go for me.

For the homeBattery you are also using cumulative[Imported|Exported]Capability ady.sofar/drivers/battery/driver.compose.json at NewEnergySystem · AdyRock/ady.sofar · GitHub but without the cumulative flag. I however used meterPower[Imported|Exported]Capability for mine as these two are mentioned in Energy | Homey Apps SDK

I’ll probably try the other pair of capabilities in the homeBattery to check the difference. It’s a bit weird that the documentation mentiones the meterPower* would be available with v12.4.4 but my Homey Pro 2023 runs on v12.4.1 and there’s no newer version… Either the docs are ahead of time, this is a typo or I implemented against a future capability :wink:

Regards, Michael