Code Monkey home page Code Monkey logo

wienernetzesmartmeter's People

Contributors

darwinsbuddy avatar dependabot[bot] avatar reox avatar therealvira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wienernetzesmartmeter's Issues

15Min Opt-In Unit of Measurement

I just realized my values are wrong.
The sensor read 9533 which was shown as 9.533 on the dashboard.
It should be 9,533 kWh.

I divided the sum by 1000 in line 183:
s = sum([y["value"] if y["value"] is not None else avg for y in yesterdays_consumption["values"]]) / 1000

Option to set offset date for received data

The daily consumption gets reported on the next day. So today I receive the value for yesterday.
I would like to have an option to tell the integration to add the value for daily consumption to yesterday 23:59.

Energy tab does not display any data

Hello, i've installed and configured your integration yesterday but unfortunately i do not see any data displayed in the energy dashboard. Is there any extra steps i perhaps missed? The entity itself does contain some data/attributes.

The log file also returns some exceptions

Logger: homeassistant.helpers.entity
Source: custom_components/wnsm/api/client.py:38
Integration: WienerNetzeSmartmeter ([documentation](https://github.com/DarwinsBuddy/WienerNetzeSmartmeter), [issues](https://github.com/DarwinsBuddy/WienerNetzeSmartmeter/issues))
First occurred: 3:55:50 PM (1 occurrences)
Last logged: 3:55:50 PM

Update for sensor.x fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/local/lib/python3.10/socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 358, in connect
    self.sock = conn = self._new_conn()
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f7be422c7f0>: Failed to establish a new connection: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='log.wien', port=443): Max retries exceeded with url: /auth/realms/logwien/protocol/openid-connect/auth?client_id=wn-smartmeter&redirect_uri=https%3A%2F%2Fsmartmeter-web.wienernetze.at%2F&response_mode=fragment&response_type=code&scope=openid&nonce= (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7be422c7f0>: Failed to establish a new connection: [Errno -3] Try again'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/wnsm/api/client.py", line 36, in login
    result = self.session.get(login_url)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 600, in get
    return self.request("GET", url, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 565, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='log.wien', port=443): Max retries exceeded with url: /auth/realms/logwien/protocol/openid-connect/auth?client_id=wn-smartmeter&redirect_uri=https%3A%2F%2Fsmartmeter-web.wienernetze.at%2F&response_mode=fragment&response_type=code&scope=openid&nonce= (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7be422c7f0>: Failed to establish a new connection: [Errno -3] Try again'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 515, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 710, in async_device_update
    raise exc
  File "/config/custom_components/wnsm/sensor.py", line 163, in async_update
    await self.hass.async_add_executor_job(smartmeter.login)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/wnsm/api/client.py", line 38, in login
    raise SmartmeterConnectionError(f"Could not load login page. Error: {e}")
custom_components.wnsm.api.errors.SmartmeterConnectionError: Could not load login page. Error: HTTPSConnectionPool(host='log.wien', port=443): Max retries exceeded with url: /auth/realms/logwien/protocol/openid-connect/auth?client_id=wn-smartmeter&redirect_uri=https%3A%2F%2Fsmartmeter-web.wienernetze.at%2F&response_mode=fragment&response_type=code&scope=openid&nonce= (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7be422c7f0>: Failed to establish a new connection: [Errno -3] Try again'))

Username/password invalid

Hi,
I'm having issues with the login, immediately after adding the integration.
I've successfully copied the custom components over, found it in HACS, downloaded, restarted and tried to add the integration under the "Devices and Integrations" tab in Home Assistant.
The credentials I'm using work fine when logging in directly on the website, but I get an error "Username/password invalid" when using the same credentials for the integration.
What am I doing wrong?
Thanks!!

Provide semantic versioning + release action

In order to better keep track of dependencies and stay compatible with potentially breaking changes of home assistant core,
we should

  • introduce semantic versioning
  • use package release of github
  • add a dedicated github action or "step" for releasing those
  • integrate the release management into HACS

Integration is not working any more as WienerNetze API changed

This error originated from a custom integration.

Logger: custom_components.wnsm.sensor
Source: custom_components/wnsm/sensor.py:179
Integration: WienerNetzeSmartmeter (documentation, issues)
First occurred: 04:44:55 (1 occurrences)
Last logged: 04:44:55

Error retrieving data from smart meter api
Traceback (most recent call last):
File "/config/custom_components/wnsm/sensor.py", line 231, in async_update
welcome = await self.get_welcome(smartmeter)
File "/config/custom_components/wnsm/sensor.py", line 179, in get_welcome
raise RuntimeError("Cannot access welcome: ", response)
RuntimeError: ('Cannot access welcome: ', {'Exception': 'PROD API Gateway encountered an error. Error Message: Resource /zaehlpunkt/default/welcome not found. Request Details: Service - WN_SMART_METER_PORTAL_API_B2C, Operation - null, Invocation Time:3:44:54 AM, Date:Feb 17, 2023, Client IP - xxxxxxx, User - Default and Application:null'})

Checking smartmeter homepage show the smartmeter dat even if they have not been updates since 2 months which is an other issue but from WN this time.
Have they changed the API again?

Consumption and Energy usage

Hi DarwinsBuddy,

thank you for this great integration and for your effort.

I have a problem with the values I got. According to the integration the consumption was 9.822 kWh yesterday.
However the Smart Meter Webportal shows me 9.381 kWh. Previously I was also using the Vienna Smart Meter integration and there was always a gap between the values. What could be the reason for this difference?

My other question is related to the energy usage dashboard. I see either negative values or small differences between consumption of the day before yesterday and yesterday. As far as I understood SensorStateClass.TOTAL_INCREASING is meant for energy meters showing totals.
E.g.
Monday: meter shows: 10.000 kWh, daily usage: 10.000 kWh
Tuesday: meter shows: 15.000 kWh, daily usage: 5.000 kWh
The increasing value is the total consumption, the daily usage is the difference between those two values. A decreasing value means a new meter cylce. Since we already get daily consumption from the Smart Meter Webportal, this sensor class seems to be the wrong approach.

Honestly, I did not found a suitable state class for this scenario in the developer documentation. https://developers.home-assistant.io/docs/core/entity/sensor/

What is your experience?

Unable to prepare setup for platform wnsm.sensor

I get the following error after adding the WNSM integration:

Logger: homeassistant.setup
Source: setup.py:320
First occurred: 16:33:29 (1 occurrences)
Last logged: 16:33:29

Unable to prepare setup for platform wnsm.sensor: Platform not found (cannot import name 'UnitOfEnergy' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)).

Data not updated

It seems that Wr. Netze updates the data unregulary with weeks between updates. Previous update was with data including 9th April.
New update visible on the smart meter portal was ~3rd May. However, in Homeassistant the new data is not visible, it is still stuck at 9th April.
Is the integration catchin up with older _statistics data when it gets new data?

Energy Dashboard takes wrong date (+1 day) for displaying consumption delta

Hi,

I noticed that the energy dashboard is one day off displaying the daily consumption data. I suppose this happens because

  1. Integration gets the meter value for yesterday (at least for me) between 12:00-14:00
  2. HA says "alright, so today's consumption is meter value latest - meter value latest-1" even though that's yesterday's consumption

Please see the screenshots for more details. I am not sure if this is related to this integration or rather to the way HA calculates delta values for aggregated sensors. I am still researching how I can change this behaviour for a particular entity in HA.

Screenshot 2023-01-11 at 14 33 43

Screenshot 2023-01-11 at 14 31 50

Screenshot 2023-01-11 at 14 37 18

Cache Auth Token

Right now, the API is logged in every time it is triggered. However, I think the token can be used for much longer time than 15min.
Is it possible to store it and re-use for longer time?

AttributeError: 'datetime.datetime' object has no attribute 'timedelta'

Hey there,

I'm not sure if this is the best, or even the right place to report this. If it isn't, please let me know.

I was trying to configure the WienerNetze integration, and noticed the v1.0.2 release 2 days ago. After updating via HACS, I now the get the following error.

I am not familiar with Python. I tried googling the error, but that didn't bring up any useful results. I looked into the Python documentation, but didn't find anything obvious either. I'd be grateful for any pointers on what might be causing this and how to fix it.

Home Assistant 2023.2.5 (Running as a Docker container)
Frontend 20230202.0 - latest
HACS 1.30.1
wnsm v1.0.2

Logs:

Logger: homeassistant.components.sensor
Source: custom_components/wnsm/utils.py:24
Integration: Sensor (documentation, issues)
First occurred: 8:31:54 PM (1 occurrences)
Last logged: 8:31:54 PM

wnsm: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 739, in async_device_update
    await task
  File "/config/custom_components/wnsm/sensor.py", line 269, in async_update
    smartmeter, before(today())
  File "/config/custom_components/wnsm/utils.py", line 24, in before
    return datetime - datetime.timedelta(days=days)
AttributeError: 'datetime.datetime' object has no attribute 'timedelta'

Entity is not updating

Hi @DarwinsBuddy
I have the issue, that the entity is not updating. When adding the lines to configuration.yaml and secrets.yaml, I get the actual Zählerstand of my smart meter but after that the entity is never updating.
Do you have any ideas why this is not working?
Many thanks!
Andreas

Fill holes of statistics data

Detached from here: #89 (comment)

The problem can be, that measurements are delayed in the API and the next day enters the system earlier than the previous day.
That could then lead to days missing consumption data.

The biggest question is how they could be added, as the statistics import does not really allow to insert data between already inserted data.
One proposed idea was to delete all imported data back to the missing date and then start the import again.

Integration is using deprecated `DEVICE_CLASS_*` constants

This custom integration uses deprecated DEVICE_CLASS_* constants in its codebase.

The DEVICE_CLASS_* constants have been deprecated and replaced in Home Assistant Core 2021.12 (over a year ago). I would highly suggest updating/migrating this integration to the new enums.

For example, for the device classes supported by the sensor platform, there is now a SensorDeviceClass enum. So if a sensor previously used the DEVICE_CLASS_ENERGY constant, it should now use SensorDeviceClass.ENERGY. Other platforms (like binary_sensor, and number) provide similar enumerations for their supported device classes.

The migration thus only consists of replacing constants with an enumeration member and is, therefore, very low impact and should be fairly straightforward.

If I can help resolve any questions regarding this change or migration, feel free to ask or respond to this issue. I'm happy to help!

Kindest regards,

../Frenck

No updates for several days

Looks like the API changed again. I haven't had any sensor updates since last Friday and when I enabled debug logging for the integration, I get this in the logs:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 541, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 747, in async_device_update
    await task
  File "/config/custom_components/wnsm/sensor.py", line 244, in async_update
    zaehlpunkt = await self.get_zaehlpunkt(smartmeter)
  File "/config/custom_components/wnsm/sensor.py", line 150, in get_zaehlpunkt
    z for z in zps[0]["zaehlpunkte"] if z["zaehlpunktnummer"] == self.zaehlpunkt
KeyError: 0

List index out of range during login

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 527, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 730, in async_device_update
    await task
  File "/config/custom_components/wnsm/sensor.py", line 284, in async_update
    await self.hass.async_add_executor_job(smartmeter.login)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/wnsm/api/client.py", line 58, in login
    code = result.headers["Location"].split("&code=", 1)[1]
IndexError: list index out of range

Not sure what failed there... Apparently the Location was in the header but not the &code...
I guess it would not hurt to put in some more checks in the login function, as this might be related to #23 (which is the exception just two lines earlier)

Improve API Documentation

Hi!
Loving the simplicity of this and would like to contribute!
Unfortunately, it is not quite obious to me from reading the code how the api communication is set up and what the different endpoints provide. I see two different api tokens and have no clue how and what they are used for and how they are aquired.

It would be nice to have a bit of documentation about this to make it easier to get started!

Something like this would toatally suffice:

/api/zaehler

Example Request:

{
    "apikey": "asdf"
}

Example Response:

{
    "values": [1, 2, 69]
}

I can try writing some of this if you show me where to look :). Chrome Devtools on the smartmeter dashboard?

Calculate Mean Consumption from Hourly data

Crosspost from https://community.home-assistant.io/t/create-daily-monthly-yearly-reports-for-energy-consumption/476352/2

This is a question related to #20 maybe someone has an idea...
I tried to get a mean value for the daily consumption as a UI panel. However, I can not select Mean in the statistic panel.
Maybe that is because I do not import the correct data into the statistics table? Do I have to use the mean as well? But what use is a hourly mean when I want the mean consumption per day of, say the last year?
Anyone has an idea how this could work? Does it work at all?

Import 15 Minute Data

Data is provided on the next day. So daily import of yesterdays 15 minute consumption data would be a nice feature.

showing consumption differently

I have three meters connected to ha via two different accounts.
sm
T3 is running on the first account and shows the total consumption of the meter.

T14 running on the second account is defined in the "Wiener Netze Smart Meter portal" as "Favorit" and also shows the total consumption.
T7 is also running on the second account and shows the consumption of the last day (what i like much better than showing the total consumption). When setting this one to "Favorit" the behavior of Meter T14 and T7 flips.

Is there a way of only showing yesterdays consumption?
Thanks for your help,
Andreas

Error on Device Update

After adding the Integration & entering my UN/PW; I don't get any new Entities in HA - but some errors in the Log.
(I only did opt into the 15 minute interval yesterday & the values do look pretty strange/off in the wienerNetze online portal).

Screenie from the online portal:
image
(did defenitly not use 7000 kWh yesterday; probably the smart meter returned the aggregated usage since its installation in feb 2020?; before yesterday I have no measurements at all)

Screens of the error message:
image

image

Error with configuration flow (and manual configuration results in error on startup)

I can not add the wnsm integration through configuration (error configration flow)

Logger: homeassistant.config_entries
Source: config_entries.py:712
First occurred: 12:19:56 PM (1 occurrences)
Last logged: 12:19:56 PM

Error occurred loading configuration flow for integration wnsm: cannot import name 'UnionType' from 'types' (/usr/local/lib/python3.9/types.py)

When I add it manually like the example configuration I get the following error on startup:

Logger: homeassistant.config
Source: custom_components/wnsm/sensor.py:12
Integration: wnsm (documentation, issues)
First occurred: 12:13:16 PM (1 occurrences)
Last logged: 12:13:16 PM

Platform error: sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 891, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 524, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 529, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/custom_components/wnsm/sensor.py", line 12, in <module>
    from homeassistant.components.sensor import (
ImportError: cannot import name 'SensorDeviceClass' from 'homeassistant.components.sensor' (/usr/src/homeassistant/homeassistant/components/sensor/__init__.py)

Username/password invalid

As per #22
"The credentials I'm using work fine when logging in directly on the website, but I get an error "Username/password invalid" when using the same credentials for the integration."

I'm sorry, I should have made this clearer. I am not using any sort of oauth, but an email and password directly when logging in via https://smartmeter-web.wienernetze.at/
The same credentials are rejected by the integration.

Updating wnsm sensor took longer than the scheduled update interval 0:15:00

I noticed this the first time in the log.
I constantly get errors like Update of sensor.at10.... is taking over 10 seconds but that one is new.

The API is actually quite slow, but it seems that in this case, it hang in a request for over 15min - at least that is what I can reconstruct from the logfiles. 🤯

Probably it is a good idea to set a timeout in requests.Session.request to like 60s?

Invalid handler specified after trying to add the integration

After adding the module in hacs and trying to add the integration I get following error:

Der Konfigurationsfluss konnte nicht geladen werden: {"message":"Invalid handler specified"}

And in the logs I get:

Logger: homeassistant.config_entries
Source: config_entries.py:809
First occurred: 10:50:57 (1 occurrences)
Last logged: 10:50:57

Error occurred loading configuration flow for integration wnsm: No module named 'lxml'

Also for manual configuration I get Platform error sensor.wnsm - No module named 'lxml'

Einspeise Zählerstand "unknown"

Hi,

I have connected my HA with this plugin via HACS to the Wiener Netze Smartmeter.
The meter with the "Bezug" I am correctly receiving daily.
I also have a second meterpoint for the produced PV. This I can see in the smartmeter website from Wiener Netzte and the integrations reads is correctly, but the data is always "unknown".
The attributes in the integration are correct shown.

And a second question: Is it possible to get also the 181 and 182 values instead only the 180?
thanks a lot for any help.
Mark

granular measurements

Instead of having a total sensor per Zählpunkt, it would be nice to have a sensor capable of providing the same granularity in measurements as WN delivers. Unfortunately, WN delivers them not as they appear, but merely once a day.

Find the right way in HomeAssistant to store those measurements in bulk for the individual 15minutes/hourly intervals per day, when the API is returning them finally.

Logon not working any more since 3 days

Integration was working will since 3 days..
Now I got the error:

Logger: homeassistant.components.sensor
Source: custom_components/wnsm/sensor.py:138
Integration: Sensor (documentation, issues)
First occurred: 05:47:49 (1 occurrences)
Last logged: 05:47:49

wnsm: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 503, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 729, in async_device_update
await task
File "/config/custom_components/wnsm/sensor.py", line 195, in async_update
zp = await self.get_zaehlpunkt(smartmeter)
File "/config/custom_components/wnsm/sensor.py", line 138, in get_zaehlpunkt
for z in zps[0]["zaehlpunkte"]
KeyError: 0

Redownloaded version 1.0 again

Tried to reinstall and resetup the Integration same issue

This error originated from a custom integration.

Logger: custom_components.wnsm.config_flow
Source: custom_components/wnsm/config_flow.py:34
Integration: WienerNetzeSmartmeter (documentation, issues)
First occurred: 06:04:27 (2 occurrences)
Last logged: 06:04:50

0
Traceback (most recent call last):
File "/config/custom_components/wnsm/config_flow.py", line 41, in async_step_user
zps = await self.validate_auth(
File "/config/custom_components/wnsm/config_flow.py", line 34, in validate_auth
return zps[0]["zaehlpunkte"] if zps is not None else []
KeyError: 0

Make URL constants configurable

Maybe you can make the URLs configurable from the UI, because most of the energy companies are using the same API for smartmeter data.
Would be nice, so there would be no need to fork the repository for example in my case.

v1.1.0 --> statistics_sensor --> list index out of range

Hi @DarwinsBuddy

I go a new smart Meter with customer interface and I get now the below message on the statistic sensor.
Not sure if the change is related to I guess not.
I use as well 15 mins value in the Smart meter Portal.

Error message is given as.

Logger: homeassistant.components.sensor
Source: custom_components/wnsm/statistics_sensor.py:179
Integration: Sensor (documentation, issues)
First occurred: 23:43:55 (1 occurrences)
Last logged: 23:43:55

wnsm: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_device_update
await self.async_update()
File "/config/custom_components/wnsm/statistics_sensor.py", line 126, in async_update
await self._import_historical_data(smartmeter)
File "/config/custom_components/wnsm/statistics_sensor.py", line 179, in _import_historical_data
_LOGGER.debug(f"Importing statistics from {statistics[0]} to {statistics[-1]}")
IndexError: list index out of range

Data is collected incorrectly (date shifted by one day)

If I compare the data in the Home Assistant and on the Smartmeter website, the data in the Home Assistant is shifted back by one day, i.e. the 10.515 kWh from Friday appear in the Home Assistant on Saturday and the 11.313 kWh from Saturday appear in the Home Assistant on Sunday . Thus, the weekly total data displays are not correct! (see printscreens)
Please check it.
ScreenShot 20230326-135942
ScreenShot 20230326-135915
ScreenShot 20230326-135848

Entität nicht definiert / not defined

Added the attribute to the energy tab, receiving the following error:
grafik

for reference:
in the smart meter portal the "newest" data for my smart meter is from 15 days ago.
My data history starts on the 24. February 2023

Power consumption shows minus value

Hi,
as the integration stopped working some days ago I realized there was a newer version available.
After the latest update it shows a high minus value "-3.164,95 kWh" for this day.
Do you have an idea why this is happening and how to solve this?
Is there a way to start from scratch? I tried to remove the integration and add it again but the value is still there.
Thanks in advance!

Sensor not shown on energy dashboard

Hi teams,

thanks for developing this integration.

I get a correct value for sensor.at001xxx but it is not shown in my engery dashboard.

How can I get it to be shown there?

Thanks
Ralph

Import historical data

when activating the integration it would be fine if there is a switch, or a service, or a button, or any other way to trigger the import of historical data.

Energy dashboard doesn't show data

Could you please provide more information on how the energy dashboard has to be configured so that you can see the daily usage? After adding the integration via HACS, I am unable to get any meaningful data from the entity besides the total usage meterReadings:value and hence I assume the energy dashboard won't show anything either.

I checked my /welcome api result and it does show data in consumptionYesterday and consumptionDayBeforeYesterday so the issue must be with the integration itself?

Update of Sensor fails

Got the following Error message in the log file:

2022-09-23 08:50:39.778 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.at00100000000000000010000XXXXXXXX is taking over 10 seconds
2022-09-23 08:52:12.303 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.at00100000000000000010000XXXXXXXX fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 515, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 718, in async_device_update
await task
File "/config/custom_components/wnsm/sensor.py", line 164, in async_update
zp = await self.get_zaehlpunkt(smartmeter)
File "/config/custom_components/wnsm/sensor.py", line 120, in get_zaehlpunkt
zp = [z for z in zps[0]["zaehlpunkte"] if z["zaehlpunktnummer"] == self.zaehlpunkt]
KeyError: 0

integrate PV BEZUG sensor

Since this was requested multiple times already, let's get going with it.
This depends imho on #35

which will alter the way we are setting up sensors.

outage agnostic support

Every now and then WN doesn't return any data or due to a sensor error we may miss days of usage.

Extend the sensor, s.t. it somehow recognizes which days have been missed since the setup of the sensor and try to pull them retrospectively

Login issue

I have used the integration succesfull till yesterday . Today was my router changed because of any other issue. My Smartmeter was after the change unavaliable. I have deleted the integration, restarted the server and tried to reinstall. At login i am using "log wien" . Till today i did not have any problem with this method.

Ez a hiba egy egyéni integrációból lett származtatva.

Logger: custom_components.wnsm.config_flow
Source: custom_components/wnsm/api/client.py:58
Integration: WienerNetzeSmartmeter (documentation, issues)
First occurred: 17:45:16 (2 occurrences)
Last logged: 17:45:28

Login failed. Check username/password.
Traceback (most recent call last):
File "/config/custom_components/wnsm/config_flow.py", line 41, in async_step_user
zps = await self.validate_auth(
File "/config/custom_components/wnsm/config_flow.py", line 32, in validate_auth
await self.hass.async_add_executor_job(api.login)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/wnsm/api/client.py", line 58, in login
raise SmartmeterLoginError("Login failed. Check username/password.")
custom_components.wnsm.api.errors.SmartmeterLoginError: Login failed. Check username/password.

Logger: custom_components.wnsm.config_flow
Source: custom_components/wnsm/config_flow.py:45
Integration: WienerNetzeSmartmeter (documentation, issues)
First occurred: 17:44:48 (3 occurrences)
Last logged: 17:45:28

Error validating Wiener Netze auth

yet another KeyError

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 554, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_device_update
    await self.async_update()
  File "/config/custom_components/wnsm/live_sensor.py", line 41, in async_update
    zaehlpunkt = await self.get_zaehlpunkt(smartmeter)
  File "/config/custom_components/wnsm/base_sensor.py", line 98, in get_zaehlpunkt
    z for z in zps[0]["zaehlpunkte"] if z["zaehlpunktnummer"] == self.zaehlpunkt
KeyError: 0

Seems like another hick-up of the API...

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.