jippi / hass-nordnet

Home Assistant + Nordnet API = awesome sensors with for your investments & holdings
https://github.com/jippi/hass-nordnet
7 stars 0 forks source link

Integration not updating after HA upgrade -> 2024.2 #9

Closed Justheretoreportanissue closed 4 months ago

Justheretoreportanissue commented 5 months ago

Is it just me or somebody else too have this problem?

After updating to HA 2024.2 I just get 1 update/read from this integration and after that, flat-line. No new values get into HA from that point.

If I reload the integration I again get 1 update/read and then nothing more.

If I restart HA the behavior is the same, 1 update/read only.

Regards,

/Jonas...

Justheretoreportanissue commented 4 months ago

Update: Looks like something have changed in HA and now I see this error just after the first run of this nordnet integration.

2024-02-12 11:15:59.790 DEBUG (MainThread) [custom_components.nordnet.coordinator] Refreshing data from Nordnet API 2024-02-12 11:15:59.790 DEBUG (MainThread) [custom_components.nordnet.coordinator] Getting HTTP session 2024-02-12 11:15:59.790 DEBUG (MainThread) [custom_components.nordnet.coordinator] Called _get_session 2024-02-12 11:15:59.790 DEBUG (MainThread) [custom_components.nordnet.coordinator] Returning existing HTTP session 2024-02-12 11:15:59.790 DEBUG (MainThread) [custom_components.nordnet.coordinator] Requesting stock positions from Nordnet API for account 1 2024-02-12 11:15:59.842 DEBUG (MainThread) [custom_components.nordnet.coordinator] Successfully updated stock positions from Nordnet API 2024-02-12 11:15:59.843 DEBUG (MainThread) [custom_components.nordnet.coordinator] Finished fetching nordnet data in 0.053 seconds (success: True) 2024-02-12 11:16:10.059 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback HomeAssistant.async_run_hass_job(>>) Traceback (most recent call last): File "/usr/local/lib/python3.12/asyncio/events.py", line 84, in _run self._context.run(self._callback, self._args) File "/usr/src/homeassistant/homeassistant/core.py", line 703, in async_run_hass_job return self.async_add_hass_job(hassjob, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 597, in async_add_hass_job task = self.loop.create_task(hassjob.target(*args), name=hassjob.name) ^^^^^^^^^^^^^^^^^^^^^ TypeError: Coordinator._handle_refresh_interval() missing 1 required positional argument: '_now'

Could it be that async def _handle_refresh_interval(self, _now: datetime) -> None: in coordinator.py needs to be rewritten in some way?

Regards,

/Jonas...

janchrillesen commented 4 months ago

I see the same issue. This is most likely due to Home Assistant shipping with Python 3.12, and not changes to Home Assistant itself

jippi commented 4 months ago

Hey guys,

I can't reproduce this on 2024.2.4 using the official Docker release 🤔 I wonder if it was a bug upstream they fixed

jippi commented 4 months ago

I noticed I had a bunch of unreleased local changes in place that I just pushed up and released, lmk if that helped :)

It's released as v0.3.1

Justheretoreportanissue commented 4 months ago

I will have a go at it as soon as HACS can 'see' it.

Report back later.

Thanks!

/Jonas...

Justheretoreportanissue commented 4 months ago

Hi again!

Looks like I'm now running latest, v0.3.2, on HA Core 2024.2.5. No more errors with debug logging turned on for hass-nordnet, but...

I still only get one update/read from the integration. My config is: Start of trading time: 8:30:00 End of trading time: 18:30:00 Query Nordnet API interval: 0:00:10

Looking at the log, filtered on nordnet, gives nothing after the initial entries after a reboot/restar/reload.

Can I do anything more to aid in the troubleshooting?

Regards, /Jonas...

jippi commented 4 months ago

Curious, I get updates with these settings 🤔

Start: 9:00:00 End: 23:00:00 Interval: 0:00:30

Do you run with these configuration.yaml settings?

logger:
  default: warning
  logs:
    custom_components.nordnet: debug
Justheretoreportanissue commented 4 months ago

Sorry, I spoke too soon.

Looking at the full log I can see the following after a reload (I also see this after a reboot/restart)

2024-03-01 13:39:57.113 DEBUG (MainThread) [custom_components.nordnet.coordinator] Refreshing data from Nordnet API 2024-03-01 13:39:57.114 DEBUG (MainThread) [custom_components.nordnet.coordinator] Getting HTTP session 2024-03-01 13:39:57.114 DEBUG (MainThread) [custom_components.nordnet.coordinator] Called _get_session 2024-03-01 13:39:57.114 DEBUG (MainThread) [custom_components.nordnet.coordinator] Returning existing HTTP session 2024-03-01 13:39:57.114 DEBUG (MainThread) [custom_components.nordnet.coordinator] Requesting stock positions from Nordnet API for account 1 2024-03-01 13:39:57.167 DEBUG (MainThread) [custom_components.nordnet.coordinator] Successfully updated stock positions from Nordnet API 2024-03-01 13:39:57.167 DEBUG (MainThread) [custom_components.nordnet.coordinator] Finished fetching nordnet data in 0.054 seconds (success: True) 2024-03-01 13:40:06.490 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback HomeAssistant.async_run_hass_job(>>) Traceback (most recent call last): File "/usr/local/lib/python3.12/asyncio/events.py", line 84, in _run self._context.run(self._callback, self._args) File "/usr/src/homeassistant/homeassistant/core.py", line 703, in async_run_hass_job return self.async_add_hass_job(hassjob, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 597, in async_add_hass_job task = self.loop.create_task(hassjob.target(*args), name=hassjob.name) ^^^^^^^^^^^^^^^^^^^^^ TypeError: Coordinator._handle_refresh_interval() missing 1 required positional argument: '_now'

I have turned on debug on the integration. I will change in configuration.yaml to your example.

/Jonas...

jippi commented 4 months ago

I tried to change an internal signature in https://github.com/jippi/hass-nordnet/releases/tag/v0.3.3 maybe that will help 🤔

janchrillesen commented 4 months ago

After upgrading to 0.3.3 it works for me

jippi commented 4 months ago

🎉 fantastic, thanks for the debugging help!

Justheretoreportanissue commented 4 months ago

Confirmed! v0.3.3 is now working here too.

Thanks for the support.

/Jonas...