DarwinsBuddy / WienerNetzeSmartmeter

A home-assistant integration supporting WienerNetze Smartmeters as sensors
142 stars 15 forks source link

historical_data throws error with multiple Zaehlwerke/OBIS Codes #272

Open tschoerk opened 1 day ago

tschoerk commented 1 day ago

log.txt

Originally posted by @ryanbrown-at in https://github.com/DarwinsBuddy/WienerNetzeSmartmeter/issues/267#issuecomment-2469328272

The live_sensor, which saves the current meter readings, uses a call to historical_data to get the current meter readings. This function works only with one zaehlwerk, since it has usually only one and we didn't know yet, how to data with multiple zaehlwerke looks like.

Opening a new issue from #267 since ryanbrown-at hat multiple different errors.

tschoerk commented 1 day ago

@ryanbrown-at Can you tell me what wienernetzte assumes as your meter reading for the bezugzaehlpunkt? You find it either on this page https://smartmeter-web.wienernetze.at/verbrauchsdaten/zaehlerdaten with the correct zaehlpunkt selected in the table below under Zählerstand in the line 2024 or on the front page ("Ihr Zählerstand am Date") if the bezug zaehlpunkt is the favourite one (indicated by a star under https://smartmeter-web.wienernetze.at/anlagen-und-vertraege/anlagendaten). Thank you!

gotaede commented 12 hours ago

I have the same issue and can confirm the correct Zählpunkt is marked as favourite. In my case the second Zählpunkt is from my old apartment and inactive. I assume it is ranked first because the number is smaller than the number of my current Zählpunkt.

tschoerk commented 12 hours ago

What error do you get?

Zählwerke are inside a single Zählpunkt, which is usually only one Zählwerk/Zählpunkt. In this case the user's log show there are multiple, which is very unusual. If you also have it, that's interesting.

Can you fully reset data and post the log/send it per mail? Follow the steps in the faq https://github.com/DarwinsBuddy/WienerNetzeSmartmeter/discussions/19 under General Troubleshooting to acquire a log regarding this integration. Replace your name/adress/customer number/zählpunkt number, so you don't share this data publically.

Also please do the following to check how to get proper meter readings in your case:

  1. Go to https://smartmeter-web.wienernetze.at/verbrauchsdaten/zaehlerdaten
  2. Press F12 to bring up the dev tools
  3. Click the Tab "Network Analysis"
  4. Filter only "XHR"
  5. Select your bezugs Zaehlpunkt in the dropdown
  6. Refresh the page if needed
  7. Look for a GET call to messwerte?datumVon=2021-11-10&datumBis=2024-11-11&wertetyp=METER_READ
  8. Click on it and the on "Response" to see which data it returned
  9. Right-click copy all
  10. Post it here or send it per mail (there's one occurence of the zaehlpunkt you would need to remove, the rest is just data)

Also please let me know what meter reading the smartmeter shows (see my comment above).

gotaede commented 11 hours ago

@tschoerk I've sent the requested logs via email

tschoerk commented 10 hours ago

@tschoerk I've sent the requested logs via email

Thank you got it. Can you tell me what wienernetzte assumes as your meter reading for the zaehlpunkt? You find it either on this page https://smartmeter-web.wienernetze.at/verbrauchsdaten/zaehlerdaten with the correct zaehlpunkt selected in the table below under Zählerstand in the line 2024 or on the front page ("Ihr Zählerstand am Date") if the bezug zaehlpunkt is the favourite one (indicated by a star under https://smartmeter-web.wienernetze.at/anlagen-und-vertraege/anlagendaten). Thank you!

gotaede commented 10 hours ago

I either don't understand your instructions correct or i forgot to copy it in my email: 7.472,565

tschoerk commented 10 hours ago

Sorry, my bad, you wrote it in the mail already. Just looked at the attachements. Thanks for all the information, I can work with that!

tschoerk commented 9 hours ago

Ok it seems like there's a differentation between a "normal" Tagstrom zaehlpunkt and a warmepumpe zaehlpunkt. Both are consuming, but one uses obisCode 1.8.0 and the Wärmepumpe uses 1.9.0, which is the sum of 1.8.1 and 1.8.2.

I'll work on a fix.

W-M-B commented 9 hours ago

@tschoerk as you mentioned OBIS = Zählwerke. normal private households only have 1 OBIS (kWh/h). but there are multiple others like Tagstrom / Nachtstrom = called interruptible Power as well. then Leistung, Blindstrom etc. I will try to look for the offical definition for Austria, so the api is ready to eat all the different options. [edit] found a Wiener Netze Smartmeter explanation. As the API only works with smartmeter, I think it is safe to use this list:

https://www.wienernetze.at/o/document/wienernetze/210317-sm_anleitung_landis_gyr_e570_v8_final .. Die Standard-Anzeige (rollierendes Display) wechselt alle 5 Sekunden zwischen folgenden Werten: – OBIS-Code 1.6.0 Viertelstündliches Leistungsmaximum (Bezug) in Kilowatt (kW) – OBIS-Code 1.7.0: Momentanleistung in Kilowatt (kW) – OBIS-Code 1.8.0: Summe der bezogenen Wirkenergie in Kilowattstunden (kWh) – OBIS-Code 1.8.x (x=1-4): Bezogene Wirkenergie pro Tarif (1.8.1 Niedertarif, 1.8.2. Hochtarif) in Kilowattstunden (kWh) – OBIS-Code 3.8.0 Summe der bezogenen Blindenergie in Kilovoltamperereaktivstunden (kVArh) – OBIS-Code F.F.0: Fehlerregister Bei Einspeisern zeigt der Zähler außerdem an: – OBIS-Code: 2.6.0: Viertelstündliches Leistungsmaximum in Kilowatt (kW) – OBIS-Code: 2.8.0: Summe der gelieferten Wirkenergie in Kilowattstunden (kWh) – OBIS-Code: 2.8.x (x=1-4): gelieferte Wirkenergie pro Tarif x in Kilowattstunden (2.8.1 Niedertarif, 2.8.2. Hochtarif) in Kilowattstunden (kWh) – OBIS-Code 4.8.0: Summe der gelieferten Blindenergie in Kilovoltamperereaktivstunden (kVArh)

tschoerk commented 9 hours ago

Thanks for those. We currently assume the API returns 1.8.0 for consuming zaehlpunkte (the sum of 1.8.x which the API doesn't send) and 2.8.0 (the sum of 2.8.xm which the API doesn't send) for feeding zaehlpunkt. For example:

{
    "zaehlwerke": [
        {
            "obisCode": "1-1:1.8.0",
            "einheit": "WH",
            "messwerte": [
                {
                    "messwert": 1000000,
                    "zeitVon": "2024-11-09T23:00:00.000Z",
                    "zeitBis": "2024-11-10T23:00:00.000Z",
                    "qualitaet": "VAL"
                }
            ]
        }
    ],
    "zaehlpunkt": "AT0010000000000000000"
}

Now there's another one which is 1.9.0 (the sum of 1.8.x, which the API does send it this case), which is interesting since they don't list this OBIS-Code, so we could not even prepare for it. Apparently that's something specifically they use for heat pumps (AnlagenType = WAERMEPUMPE).

{
    "zaehlwerke": [
        {
            "obisCode": "1-1:1.8.1",
            "einheit": "WH",
            "messwerte": [
                {
                    "messwert": 1000000,
                    "zeitVon": "2024-11-09T23:00:00.000Z",
                    "zeitBis": "2024-11-10T23:00:00.000Z",
                    "qualitaet": "VAL"
                }
            ]
        },
        {
            "obisCode": "1-1:1.8.2",
            "einheit": "WH",
            "messwerte": [          
                {
                    "messwert": 1000000,
                    "zeitVon": "2024-11-09T23:00:00.000Z",
                    "zeitBis": "2024-11-10T23:00:00.000Z",
                    "qualitaet": "VAL"
                }
            ]
        },
        {
            "obisCode": "1-1:1.9.0",
            "einheit": "WH",
            "messwerte": [
                {
                    "messwert": 2000000,
                    "zeitVon": "2024-11-09T23:00:00.000Z",
                    "zeitBis": "2024-11-10T23:00:00.000Z",
                    "qualitaet": "VAL"
                }
            ]
        }
    ],
    "zaehlpunkt": "AT0010000000000000000"
}

The big questions is, are those other OBIS-Codes interesting to anyone? The API does not return the other codes, but maybe there's a possibility for that and if so, maybe it's beneficial to someone. I don't have much knowledge about all those types.

W-M-B commented 8 hours ago

I forgot this stuff already, I looked a bit around, so it seems that 1-1:1.8.0 Wiener Netze uses for Smartmeter kWh as a standard. but officially 1-1:1.9.0 is the Wirkarbeit bezug, so the official consumption that shoud be used. so I would need to correct by assumption and treat – OBIS-Code 1.6.0 Viertelstündliches Leistungsmaximum (Bezug) in Kilowatt (kW) – OBIS-Code 1.7.0: Momentanleistung in Kilowatt (kW) – OBIS-Code 1.8.0: Summe der bezogenen Wirkenergie in Kilowattstunden (kWh) – OBIS-Code 1.8.x (x=1-4): Bezogene Wirkenergie pro Tarif (1.8.1 Niedertarif, 1.8.2. Hochtarif) in Kilowattstunden (kWh) **- OBIS-CDE 1.9.0:

Source: I found the formal austrian list of OBIS which differs from the smartmeter one (EB utilitites ist the website that publishes the Standards for data exchange and processes within Austrian Energy Market) https://www.ebutilities.at/documents/20200304112759_MeterCodes_ConsumptionRecord.pdf Also we might face some Energiegemeinschaften that use different OBIS https://energiegemeinschaften.gv.at/wp-content/uploads/sites/19/2024/05/Verbraucher-Obis-Codes_28.04.2024.png

so in short I guess a list of relevant OBIS needs to be used for data ingestions and the others to be ignored. It is safe to say that multiple obis will happen more and more often.

W-M-B commented 8 hours ago

I would recommend to prepare for n OBIS values but only take the ones interesting and through away the others. if we have API users that face issues with a different setup, there is then at least some data to resolve this. I would ingest 1.9.0 and 1.8.0 also production 2.9.0 and 2.8.0 and ignore the others