Code Monkey home page Code Monkey logo

Comments (7)

DarwinsBuddy avatar DarwinsBuddy commented on September 22, 2024

Hi @sonypsx
Happy to see that this integration helps. :)
After some time of deciphering your log message (it's hard without linebreaks), I am wondering if this issue still persists.
It seems like you get back no historical meter readings from the API.
Since the Wiener Netze API is not a public API and thus may be subject to change, it could be that

  • a) for your account WN is reporting your readings differently
  • b) there was an outage for your user batch
  • c) the api changed and our client has to adapt those changes

In order to rule out the first two possibilities, could you

  1. install the new release 1.4.7
  2. again look into your installation and check if you still get the same error
    ?

Thanks in advance.

from wienernetzesmartmeter.

sonypsx avatar sonypsx commented on September 22, 2024

Hello,

thanks the reply!
Die install 1.4.7 as requested, didn't help much :(
2024-03-17 15:54:01.931 WARNING (MainThread) [custom_components.wnsm.statistics_sensor] Starting import of historical data. This might take some time. 2024-03-17 15:54:02.735 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform wnsm is taking over 10 seconds. 2024-03-17 15:54:03.963 ERROR (MainThread) [homeassistant.components.sensor] wnsm: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 682, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1262, in async_device_update await self.async_update() File "/config/custom_components/wnsm/statistics_sensor.py", line 123, in async_update await self._import_bewegungsdaten(smartmeter) File "/config/custom_components/wnsm/statistics_sensor.py", line 195, in _import_bewegungsdaten recording = await self.get_bewegungsdaten(smartmeter) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/wnsm/base_sensor.py", line 154, in get_bewegungsdaten response = await self.hass.async_add_executor_job( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/wnsm/api/client.py", line 505, in bewegungsdaten raise SmartmeterQueryError("Historical data is empty") custom_components.wnsm.api.errors.SmartmeterQueryError: Historical data is empty 2024-03-17 15:54:05.321 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'hacs' accesses hass.components.frontend. This is deprecated and will stop working in Home Assistant 2024.9, it should be updated to import functions used from frontend directly at custom_components/hacs/frontend.py, line 68: hass.components.frontend.async_register_built_in_panel(, please create a bug report at https://github.com/hacs/integration/issues 2024-03-17 15:54:05.662 ERROR (MainThread) [custom_components.wnsm.live_sensor] Unable to load consumption 2024-03-17 15:54:05.663 ERROR (MainThread) [custom_components.wnsm.live_sensor] Please file an issue with this error and (anonymized) payload in github {'hasSmartMeter': True, 'isDataDeleted': False, 'zaehlpunkt': 'AT0010000000000000001000012345678', 'type': 'BEZUG', 'address': 'Street, 1234 MyCity', 'zip': '1234'} {'consumptionYesterdayValue': 19737, 'consumptionYesterdayValidated': True, 'consumptionYesterdayTimestamp': '2024-03-15T23:00:00.000Z', 'consumptionDayBeforeYesterdayValue': 18839, 'consumptionDayBeforeYesterdayValidated': True, 'consumptionDayBeforeYesterdayTimestamp': '2024-03-14T23:00:00.000Z'} {'lastValue': 385734, 'lastReading': '2024-03-16T23:00:00.000Z', 'lastValidated': True, 'lastType': '1-2:2.8.0'} {'optIn': True, 'consumptionAverage': 0, 'consumptionMinimum': 0, 'consumptionMaximum': 0}

If i look the attributes of the 3 entities it looks valid.
CustomerId and all other values look legit!
About the theory that there was an outage of my user batch: I know that last week were some maintenance at WN, but i have this issue since the begining of using WNSM which was several month ago.
About the API - yeah could be a reason.

if i click on the "statistics" entity and check for "last month" i'm getting VERY low (unusual low) reading ~0.5 to 1.5kWh which isn't right, if compared to the WN web portal.
2024-03-17 16_17_58-Verlauf – Home Assistant – Mozilla Firefox

vs. the values from the Web Portal:
2024-03-17 16_20_28-TAGESWERTE-20240201-bis-20240229 csv - Excel

About "2024-03-17 15:54:01.931 WARNING (MainThread) [custom_components.wnsm.statistics_sensor] Starting import of historical data. This might take some time."

How long does this normally take? and how many days are pulled?

Best regards
sonypsx

from wienernetzesmartmeter.

tschoerk avatar tschoerk commented on September 22, 2024

I also get the "Error on device update" for my feed in Zählerpunkt. The consumption works and creates two sensors a live and statistics one, but for the feed in there's only 1 sensor created (the live one, not the statistics one) and that one is empty, so it's not usable in the energy dashboard. I only have that feedin Zählerpunkt for a couple of days, maybe it has to be a certain age before it's usable?

Core 2024.5.2
Supervisor 2024.04.4
Operating System 12.2
Frontend 20240501.1
wnsm: v1.4.

2024-05-07 10:38:06.760 DEBUG (SyncWorker_8) [custom_components.wnsm.api.client] 
API Request: https://service.wienernetze.at/sm/api/user/messwerte/bewegungsdaten?geschaeftspartner=#########&zaehlpunktnummer=AT001000000000000000##########&rolle=V002&zeitpunktVon=2021-05-07T00%3A00%3A00.000Z&zeitpunktBis=2024-05-07T23%3A59%3A59.999Z&aggregat=NONE


API Response: {
  "descriptor": {
    "geschaeftspartnernummer": "###########",
    "zaehlpunktnummer": "AT00100000000000000010000##########",
    "rolle": "V002",
    "aggregat": "NONE",
    "granularitaet": "QH",
    "einheit": "KWH"
  },
  "values": []
}
2024-05-07 10:38:06.763 ERROR (MainThread) [homeassistant.components.sensor] wnsm: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 707, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1293, in async_device_update
    await self.async_update()
  File "/config/custom_components/wnsm/statistics_sensor.py", line 123, in async_update
    await self._import_bewegungsdaten(smartmeter)
  File "/config/custom_components/wnsm/statistics_sensor.py", line 195, in _import_bewegungsdaten
    recording = await self.get_bewegungsdaten(smartmeter)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/wnsm/base_sensor.py", line 154, in get_bewegungsdaten
    response = await self.hass.async_add_executor_job(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/wnsm/api/client.py", line 505, in bewegungsdaten
    raise SmartmeterQueryError("Historical data is empty")
custom_components.wnsm.api.errors.SmartmeterQueryError: Historical data is empty

from wienernetzesmartmeter.

W-M-B avatar W-M-B commented on September 22, 2024

hi, @tschoerk it works nicely for me. I am running on y x86 device, HA updated to the latest version, same for wnsm and HACS.

I had issues before, but I removed the wnsm deleted all at.. data eintries etc. rebootet. then it worked.

if you log in the Portal of Wiener Netze it works nicely I assume?

from wienernetzesmartmeter.

tschoerk avatar tschoerk commented on September 22, 2024

Thanks for the hint. I tried it as well, deleted everything like described in the FAQs with reboots between each step and reinstalled everything. The error still persists. Also got an error like described in issue #227 maybe they are stemming from the same issue.

from wienernetzesmartmeter.

W-M-B avatar W-M-B commented on September 22, 2024

strange .. the code base 1.40 works (at least for me), so either some config data in your smartmeter is different creating an issue, or something is wrong with your data.
my next try would be to try to retrieve the data with another system/app to see if this is an issue with Wiener Netze or a bug due to some data topics.

from wienernetzesmartmeter.

tschoerk avatar tschoerk commented on September 22, 2024

After testing it on several devices and the error still persisted, I figured it out. The Zählerpunkt which feeds in the unused power as the Anlagetyp "BEZUG" instead of "TAGSTROM", like the normal Zählerpunkte.

Checking the API calls directly at the Wiener Netze Portal showed me the correct URL.
https://service.wienernetze.at/sm/api/user/messwerte/bewegungsdaten?geschaeftspartner=XXXXXXXXX&zaehlpunktnummer=AT001000000000000000###########&rolle=E002&zeitpunktVon=2024-05-06T22%3A00%3A00.000Z&zeitpunktBis=2024-05-07T21%3A59%3A59.999Z&aggregat=NONE

The correct parameter for rolle is E002 (quarterly check in this case) instead of the hard-coded V002 (or E001 instead of V001).

I made a fix by changing the get_zaehlpunkt method in the client.py to also return the Anlagentyp and then check if the type is BEZUG. If true, then the role is changed to E001 or E002 depending on the valuetype. I will make a pull request, maybe it's viable to use - at least the idea should be. Not too much experience with it.

Restarted HA and now I have a fourth entity with all the feeding statistics to use for the energy dashboard.

from wienernetzesmartmeter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.