Mas2112 / solarwatt-energymanager-homeassistant

A SOLARWATT EnergyManager Home Assistant custom component.
MIT License
17 stars 3 forks source link

Get raw 1.8.0/2.8.0 values as seen on electric meter #21

Closed PattaFeuFeu closed 1 month ago

PattaFeuFeu commented 2 months ago

I have an optical sensor connected to the energy manager which reads out the optical signals of my electric meter. Is it possible to get the raw 1.8.0 (consumed from grid) and 2.8.0 (sent to grid) values as they can be seen on the meter?

I noticed that there’s a huge discrepancy by now between what I get from this integration as energymanager_workin and energymanager_workout and what I can see on the electric meter as 1.8.0 and 2.8.0, e.g. ~28 MWh for 1.8.0 vs ~22MWh for energymanager_workin.

The optical sensor was plugged out for a bit and I then noticed that it didn’t jump straight to a way higher value after plugging it back in. Instead, it just continued with what it could read from that point on—which apparently wasn’t the electric meter work sum but instead only the current power which the energy manager seems to add up itself??

Can you shed some light on what’s happening here and which data can be read from the energy manager and how to interpret it? 😊

I also checked other values than the two mentions. None of them match what I see on the electric meter.

Mas2112 commented 2 months ago

The integration just reads the values from the energy manager and makes it available to home assistant.

I have no idea how it handles other devices connected to it. Maybe you can login to the energy manager and try to configure it?

PattaFeuFeu commented 2 months ago

I wouldn’t know where to look. The interface is very barebones with very few options (if any). 😕

PattaFeuFeu commented 2 months ago

@Mas2112 Ah, found the data! I checked $localIP/rest/kiwigrid/wizard/devices and found the correct values in result->items->8->tagValues->WorkIn.

The ones I had used (wrongly) so far are in result->items->1->tagValues->WorkIn and result->items->1->tagValues->WorkOut

Any idea how I could get the integration to get me that value? Would the integration need to be changed for that or the underlying Python library that connects with the energymanager?

Mas2112 commented 2 months ago

I think I know what the problem is. The integration assumes there are only one set of work values and takes the first one. Can you post your Json data? (delete personal data from the Json before posting)

On Tue, Aug 13, 2024, 21:29 Patrick Geselbracht @.***> wrote:

@Mas2112 https://github.com/Mas2112 Ah, found the data! I checked $localIP/rest/kiwigrid/wizard/devices and found the correct values in result->items->8->tagValues->WorkIn.

The ones I had used (wrongly) so far are in result->items->1->tagValues->WorkIn and result->items->1->tagValues->WorkOut

Any idea how I could get the integration to get me that value? Would the integration need to be changed for that or the underlying Python library that connects with the energymanager?

— Reply to this email directly, view it on GitHub https://github.com/Mas2112/solarwatt-energymanager-homeassistant/issues/21#issuecomment-2286980990, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABJLA4S6UZ73F6RIS5HKU3ZRJNCVAVCNFSM6AAAAABMNXAZ36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBWHE4DAOJZGA . You are receiving this because you were mentioned.Message ID: @.*** .com>

PattaFeuFeu commented 2 months ago

energymanager.json

The WorkIn/WorkOut values of the device with the SMLDriverService ("guid": "urn:sml:09-RE-DA-CT-ED-RE-DA-CT-ED-bf",) are the ones from the electric meter which match what it shows

m67hoff commented 2 months ago

You added an optical sensor to the energy manager? I only have read from the possibility, to connect an S0 energy meter to the S0 interface (wire connection) My values also differ 1.8.0 / 2.8.0: 14,1MWh / 21.4MWh Energymanager: WorkIN/Out 10,2MWh / 17,3MWh (Both started at the same day 4 years ago at 0)

BTW: Before using this integration, I just called the RestAPI with the HA restful integration. Here is some code for this: rest_solarwatt_energymanager.yaml.zip

PattaFeuFeu commented 2 months ago

You added an optical sensor to the energy manager?

Yes, I have an optical sensor attached to the energy manager via USB that is then attached to the optical interface of the energy meter. It had been installed like that initially and we didn’t change it ourselves.

BTW: Before using this integration, I just called the RestAPI with the HA restful integration.

Yeah, after I saw the JSON response for the call, I was thinking of just getting that. But I’d prefer an integration that is also used/tested and updated by others. 😊 It’s just a pity that I went with the wrong data for more than two years and all the historic data in the energy dashboard is wrong and I should start anew with the correct values once available.

Mas2112 commented 2 months ago

Oh I see the problem. My integration doesn't support the com.kiwigrid.devices.powermeter.PowerMeter device. By default, I pull the values from the com.kiwigrid.devices.location.Location device.

I need to add support for the PowerMeter device, and then it should appear as a new entity in Home Assistant.

Please be patient, it might take a while.

PattaFeuFeu commented 2 months ago

Please be patient, it might take a while.

@Mas2112 Absolutely, thank you kindly!

If there’s anything I could assist you with, just tell me. Unfortunately, my Python expertise is basically non-existent, otherwise I would create a PR for the base library myself.

PattaFeuFeu commented 2 months ago

By default, I pull the values from the com.kiwigrid.devices.location.Location device.

What is that though? There seems to be substantial difference in values for both @m67hoff and I so I wonder what that device is supposed to represent? 🤔

Mas2112 commented 1 month ago

Since its terrible weather here, I decided to use the time to add support for the Power Meter. I have created pre-release 0.10.0 with this support. Can you test it, see if it is working?

PattaFeuFeu commented 1 month ago

Oh, nice, thank you! @Mas2112

I’ll test that today or tomorrow and will get back to you.

PattaFeuFeu commented 1 month ago

@Mas2112 It’s working! 🥳 Thank you kindly! I got (at least?) two new sensors:

  1. energymanager_edl_zaehler_09_lo_ng_hex_st_ri_ng_workin
  2. energymanager_edl_zaehler_09_lo_ng_hex_st_ri_ng_workout

which represent 1.8.0 and 2.8.0