Comments (25)
Reg the web request, I see requests:
- OPTIONS Request – returns only response headers, no response body
OPTIONS https://api.wstw.at/gateway/WN_SMART_METER_PORTAL_API_B2B/1.0/zaehlpunkte/12020xxxxx/AT001000000000000000100000xxxxxxx/messwerte?datumVon=2023-06-01&datumBis=2023-06-30&wertetyp=DAY
Response headers
HTTP/1.1 200 OK
Date: Sat, 28 Oct 2023 11:24:18 GMT
Server: httpd
content-length: 0
access-control-max-age: -1
access-control-allow-origin: https://smartmeter-web.wienernetze.at
access-control-allow-methods: GET
access-control-allow-headers: authorization,expires,x-gateway-apikey,cache-control,pragma
strict-transport-security: max-age=15724800; includeSubDomains
set-cookie: LB_STICKY_SESSION=xxxxxxxxx; Path=/; Secure; HttpOnly
Keep-Alive: timeout=4, max=300
Connection: Keep-Alive
- GET request – returns response headers (omitted) and response body.
GET https://api.wstw.at/gateway/WN_SMART_METER_PORTAL_API_B2B/1.0/zaehlpunkte/12020xxxxx/AT001000000000000000100000xxxxxxx/messwerte?datumVon=2023-06-01&datumBis=2023-06-30&wertetyp=DAY
Response body (shortened)
{
"zaehlwerke": [
{
"obisCode": "1-1:1.9.0",
"einheit": "WH",
"messwerte": [
{
"messwert": 7459.0,
"zeitVon": "2023-05-31T22:00:00.000Z",
"zeitBis": "2023-06-01T22:00:00.000Z",
"qualitaet": "VAL"
},
{
"messwert": 4776.0,
"zeitVon": "2023-06-01T22:00:00.000Z",
"zeitBis": "2023-06-02T22:00:00.000Z",
"qualitaet": "VAL"
},
[...]
{
"messwert": 8241.0,
"zeitVon": "2023-06-29T22:00:00.000Z",
"zeitBis": "2023-06-30T22:00:00.000Z",
"qualitaet": "VAL"
}
]
}
],
"zaehlpunkt": "AT001000000000000000100000xxxxxxx"
}
from wienernetzesmartmeter.
since we're calling the /zaehlpunkt
endpoint anyway on device update, it's not a big deal to add this. good point. :)
I'm on it
from wienernetzesmartmeter.
@DarwinsBuddy first off, the good news – imports are started 🥳
Now, I see the following "WARNING" for each day of my historic data:
2023-10-29 18:12:05.079 WARNING (MainThread) [custom_components.wnsm.statistics_sensor] Starting import of historical data. This might take some time.
2023-10-29 18:12:05.994 WARNING (MainThread) [custom_components.wnsm.statistics_sensor] Unexpected time step detected in historic data: {'messwert': 2179.0, 'zeitVon': '2023-05-29T22:00:00.000Z', 'zeitBis': '2023-05-30T22:00:00.000Z', 'qualitaet': 'VAL'}
2023-10-29 18:12:05.995 WARNING (MainThread) [custom_components.wnsm.statistics_sensor] Unexpected time step detected in historic data: {'messwert': 4476.0, 'zeitVon': '2023-05-30T22:00:00.000Z', 'zeitBis': '2023-05-31T22:00:00.000Z', 'qualitaet': 'VAL'}
2023-10-29 18:12:05.996 WARNING (MainThread) [custom_components.wnsm.statistics_sensor] Unexpected time step detected in historic data: {'messwert': 7459.0, 'zeitVon': '2023-05-31T22:00:00.000Z', 'zeitBis': '2023-06-01T22:00:00.000Z', 'qualitaet': 'VAL'}
[...]
Shall I open a new issue for this? I guess this is something different/distinct to look at?
Cheers & thanks for working with me through this situation 😁
from wienernetzesmartmeter.
Also, I do not see anything suspicious in the home assistant logs, see below
- Home Assistant 2023.10.3
- Running in Docker on an 32bit RPi
- Note: Some devices are offline
$ docker logs -f homeassistant 2>&1| grep -v better_thermostat # remove verbose better thermostat logs
2023-10-28 11:31:48.269 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration scheduler which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-10-28 11:31:48.275 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration wnsm which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-10-28 11:32:26.149 WARNING (MainThread) [homeassistant.setup] Setup of zone is taking over 10 seconds.
2023-10-28 11:32:38.017 WARNING (MainThread) [homeassistant.config_entries] Config entry 'HP Officejet Pro XXXX [XXXXX]' for ipp integration not ready yet: Invalid response from API: Timeout occurred while connecting to IPP server.; Retrying in background
2023-10-28 11:32:52.334 WARNING (MainThread) [aioesphomeapi.reconnect_logic] Can't connect to ESPHome API for esp-mobile @ 192.x.x.5: Error connecting to ('192.x.x.5', 6053): [Errno 113] Connect call failed ('192.x.x.5', 6053) (SocketAPIError)
2023-10-28 11:32:53.800 WARNING (MainThread) [custom_components.wnsm.statistics_sensor] Starting import of historical data. This might take some time.
2023-10-28 11:32:54.571 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 573, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 991, 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 150, in _import_historical_data
raise ValueError("WienerNetze does not report hsitorical data (yet)")
ValueError: WienerNetze does not report hsitorical data (yet)
2023-10-28 11:33:18.178 WARNING (MainThread) [homeassistant.components.kodi.media_player] Unable to connect to Kodi via websocket
update_hvac_action(self)
from wienernetzesmartmeter.
@DarwinsBuddy please find the debug log attached (shortened to exclude better_thermostat
). anon.log
What i notice is
- the Customer ID
12020xxxxx
is missing from the second request wertetyp=QUARTER_HOUR
– my smart meter reports in days, I think (= default?)
REQUEST: https://api.wstw.at/gateway/WN_SMART_METER_PORTAL_API_B2B/1.0/zaehlpunkte/messwerte?zaehlpunkt=AT001000000000000000100000xxxxxxx&datumVon=2020-10-28&datumBis=2023-10-28&wertetyp=QUARTER_HOUR
Cheers,
Raoul
from wienernetzesmartmeter.
Will do so in the evening. Thanks!
from wienernetzesmartmeter.
yes please, open another one for that 😊
I'll have a look if it's still causing troubles
from wienernetzesmartmeter.
See #194
from wienernetzesmartmeter.
Same here. HA v2023.10.3
from wienernetzesmartmeter.
looks like they changed that... have to look into that!
from wienernetzesmartmeter.
Please let us know how we can support!
from wienernetzesmartmeter.
In my case it could be because my smartmeter is not yet exporting any usage data to csv.
maybe this helps.
from wienernetzesmartmeter.
Thanks @DarwinsBuddy, the error is now gone.
FYI there is a typo in the error message: hsitorical
vs. historical
.
Lastly, if I log into the account at https://smartmeter-web.wienernetze.at/
I am able do download historical data as a CSV.
Would you know what the issue might be that the component is not able to retrieve/import the historical data?
from wienernetzesmartmeter.
@raoulbhatia Thanks for reading more careful than I did 😅
I'll fix it with the next release 👍
I'll have to investigate, maybe the API response changed again without releasing a new version.
from wienernetzesmartmeter.
@raoulbhatia I just checked if the API changed somehow and cannot confirm.
Could it be that you have different "zaehlwerke", i.e. different entities of counting your consumption?
from wienernetzesmartmeter.
could you possibly hit F12
on your smart meter webinterface, navigate to your Network
tab, select some month to export and copy the response of the underlying request here (depicted in attached screenshot)?
from wienernetzesmartmeter.
Will do so within the next hour
from wienernetzesmartmeter.
Furthermore: Is there anything suspicious in your ha log?
from wienernetzesmartmeter.
that's really odd. It looks like everything should be working correctly, so maybe it has something to do with your response from this API call. We are calling
which returns a list of zaehlpunkte
the webinterface calls and endpoint where it adds the "contractId" and "zaehlpunktnummer" as path parameters, hence
which returns an object with presumably just the information for that zaehlpunkt.
I'd like to check if the responses somehow differ in your case.
Thus I released a new version 1.3.1
which adds some debug logs.
Could you
- Enable debug logs for the wnsm integration
- restart home assistant
- disable debug logs (you should be presented a save as dialog for the logs)
- attach the (anonymized) logs here
I'd very much appreciate it.
from wienernetzesmartmeter.
alright. I think I know what's up.
it seems that this endpoint which we are using is not returning values, but rather the one with the two path Params does.
I'll try to fix this. give me some time
from wienernetzesmartmeter.
FYI I fiddled around with the URL and it seems that one needs to pass the proper wertetyp=
parameter.
Upon a manual check (copied the web request to a curl
command)
- If I pass
wertetyp=QUARTER_HOUR
, it returns a basically empty reply
curl -s 'https://api.wstw.at/gateway/WN_SMART_METER_PORTAL_API_B2B/1.0/zaehlpunkte/12020xxxxx/AT001000000000000000100000xxxxxxx/messwerte?datumVon=2023-07-01&datumBis=2023-07-31&wertetyp=QUARTER_HOUR'
- If I pass
wertetyp=DAY
I get actual numbers.
curl -s 'https://api.wstw.at/gateway/WN_SMART_METER_PORTAL_API_B2B/1.0/zaehlpunkte/12020xxxxx/AT001000000000000000100000xxxxxxx/messwerte?datumVon=2023-07-01&datumBis=2023-07-31&wertetyp=DAY'
from wienernetzesmartmeter.
Might be worth to extract this information from the GET /zaehlpunkte
endpoint?
cat resp | jq '.[].zaehlpunkte.[].idexStatus.granularity'
{
"status": "DAY",
"canBeChanged": true
}
from wienernetzesmartmeter.
interesting. so I guess you didn't opt into quarter hourly reports.
if that's the reason, I think a fallback to hourly would do the trick.
from wienernetzesmartmeter.
Actually, as the granularity is available via the API,
why not use the data provided to select the right wertetyp
.
Wouldn't this make it more versatile and generic?
from wienernetzesmartmeter.
@raoulbhatia I released https://github.com/DarwinsBuddy/WienerNetzeSmartmeter/releases/tag/v1.3.2 which should use the "zaehlpunkt"'s granularity setting for pulling historical data. Please upgrade and report back with what you're observing :)
from wienernetzesmartmeter.
Related Issues (20)
- Since 1 week no more 1h consumption data HOT 2
- AttributeError: 'Smartmeter' object has no attribute 'tages_verbrauch' HOT 5
- JSON Decode Error HOT 1
- Not found in "setup new integration"
- Missing sensor after configuration with two Zählerpunkten HOT 1
- Error in live_sensor: "Please file an issue with this error[...]" HOT 1
- No values in API response HOT 8
- Incorrect Meter being selected HOT 7
- Only one entity added. _statistics entity is missing HOT 3
- No hourly data downloaded when the account includes an inactive zaehlpunkt ("Returned data does not match given zaehlpunkt!") HOT 40
- TypeError "Can't override _attr_state_class in subclass" in 1.4.2 HOT 11
- v1.4.2: The following integrations and platforms could not be set up: wnsm.sensor HOT 1
- no data showing up after (version 1.43) KeyError: "Sum" in Logfile HOT 3
- Einspeisezählpunkt wird gefunden aber keine Daten HOT 1
- after update 1.4.3 statistic entity is not working HOT 2
- Error on device update HOT 2
- since middle of January statistic entities are not working HOT 7
- trigger reimport of data due to huge negative consumption error? HOT 10
- Statistics Import Stops Working after Renaming Statistics Entity HOT 2
- Energy Dashboard shows feeding without actually feeding in place HOT 31
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wienernetzesmartmeter.