fsaris / home-assistant-zonneplan-one

Unofficial Zonneplan integration for Home Assistant
https://github.com/fsaris/home-assistant-zonneplan-one
MIT License
105 stars 17 forks source link

Integration stopped reporting values #1

Closed tvandergeer closed 3 years ago

tvandergeer commented 3 years ago

It worked initially, but after a few days it reports "Niet beschikbaar" (not available). I tried reinstalling (and restarting HA) but that did not help. Is there anything I can do to pinpoint the problem?

image

fsaris commented 3 years ago

Do you see anything in the logs?

fsaris commented 3 years ago

Enable extra logging if you currently do not see anything

Add to config/configuration.yaml

logger:
  logs:
    custom_components.zonneplan_one: debug
tvandergeer commented 3 years ago

It's complaining about the authentication:

2021-04-09 08:38:20 ERROR (MainThread) [custom_components.zonneplan_one.coordinator] Error requesting zonneplan_one data: 401, message='Unauthorized', url=URL('https://app-api.zonneplan.nl/oauth/token')

I probably need to login again. Can I use the same account as I'm using for the Zonneplan App on my phone? Or should I create a separate account for the HA integration?

fsaris commented 3 years ago

I use the same account as the I use for the app.

Try to remove the integration and re-add it again.

If for some reason the request for a new token was made but for some reason the request couldn't be correctly processed this 401 can happen. Happened to me to during my first tests. Removing and re-adding it again so you go through the login process again should solve it

tvandergeer commented 3 years ago

Yes, It started working again by removing and re-adding it again!

Broekman commented 3 years ago

I had the same as well (second time). All available logs:

2021-04-16 20:12:52 INFO (MainThread) [custom_components.zonneplan_one.coordinator] _async_update_data: start
2021-04-16 20:12:52 INFO (MainThread) [custom_components.zonneplan_one.zonneplan_api.api] _async_request_new_token: {'grant_type': 'refresh_token', 'refresh_token': 'def5020080c531d46ae276b4b08c7c6cd3fdac091820a8cf684aa49670ec015940f5d732e1f9c067b5c517f239baef79e4f245ae091b869d458133de44e1bb334a524afe19936a837669610207087e6918f42d147557db40f05de22bb4a353a268b566e89a3499c3e856becce264043d8172d46f21fae128391e2cd07812040aef1a548bc3b81a1ec57847a447..........
2021-04-16 20:12:52 DEBUG (MainThread) [custom_components.zonneplan_one.zonneplan_api.api] ZonneplanAPI response header: <CIMultiDictProxy('Date': 'Fri, 16 Apr 2021 18:12:52 GMT', 'Server': 'Apache', 'Cache-Control': 'no-cache, private', 'X-RateLimit-Limit': '10', 'X-RateLimit-Remaining': '9', 'Upgrade': 'h2,h2c', 'Connection': 'Upgrade', 'Transfer-Encoding': 'chunked', 'Content-Type': 'application/json')>
2021-04-16 20:12:52 DEBUG (MainThread) [custom_components.zonneplan_one.zonneplan_api.api] ZonneplanAPI response status: 401
2021-04-16 20:12:52 ERROR (MainThread) [custom_components.zonneplan_one.coordinator] Error requesting zonneplan_one data: 401, message='Unauthorized', url=URL('https://app-api.zonneplan.nl/oauth/token')
2021-04-16 20:12:52 DEBUG (MainThread) [custom_components.zonneplan_one.coordinator] Finished fetching zonneplan_one data in 0.304 seconds