Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: PollUpdateMixin._async_historical_handle_update() takes 1 positional argument but 2 were given #8

Closed
shtrom opened this issue Jul 30, 2023 · 3 comments

Comments

@shtrom
Copy link
Contributor

shtrom commented Jul 30, 2023

I'm working on a historical electricity consumption sensor over at LeighCurran/AuroraPlusHA#9

I think I'm pretty much there, but I have an issue I can't work out the solution to, in the PollUpdateMixin.

homeassistant  | 2023-07-30 19:06:22.598 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback async_track_point_in_utc_time.<locals>.run_action(<Jo
b track ti...7fb4da782c00>>) at /usr/src/homeassistant/homeassistant/helpers/event.py:1350                                                                              
homeassistant  | Traceback (most recent call last):                                                                                                                     
homeassistant  |   File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
homeassistant  |     self._context.run(self._callback, *self._args)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1365, in run_action
homeassistant  |     hass.async_run_hass_job(job, utc_point_in_time)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/core.py", line 627, in async_run_hass_job
homeassistant  |     hassjob.target(*args)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1454, in interval_listener
homeassistant  |     hass.async_run_hass_job(job, now)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/core.py", line 630, in async_run_hass_job
homeassistant  |     return self.async_add_hass_job(hassjob, *args)
homeassistant  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/core.py", line 524, in async_add_hass_job
homeassistant  |     task = self.loop.create_task(hassjob.target(*args), name=hassjob.name)
homeassistant  |                                  ^^^^^^^^^^^^^^^^^^^^^
homeassistant  | TypeError: PollUpdateMixin._async_historical_handle_update() takes 1 positional argument but 2 were given

I'm not sure where the *args with two entries comes from, but it seems to be coming from deep within HA.

@ldotlopez
Copy link
Owner

I can confirm the bug, thanks.

I will (hopefully) fix it later today.

ldotlopez added a commit that referenced this issue Jul 30, 2023
@ldotlopez
Copy link
Owner

Ok, I think I fixed it, but...

Update manifest.json on Aurora integration to use historical-sensor 2.0.0rc2:

  "homeassistant-historical-sensor==2.0.0rc2"

Changes from 1.x to 2.x are minimal, I just fixed a typo and added minor warnings.

  • statatistics methods become statistics (the typo)
  • don't set state_class if your sensor declares statistics_id
  • Check delorian integration for referencence

I will make 2.0.0 the stable and public version later or tomorrow. (i was waiting for some testing, but it already seems enough)

@shtrom
Copy link
Contributor Author

shtrom commented Jul 31, 2023

Yup, that seems to have fixed it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants