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

Not refreshing - Crashing instead #88

Open
pszewello opened this issue Mar 4, 2024 · 2 comments
Open

Not refreshing - Crashing instead #88

pszewello opened this issue Mar 4, 2024 · 2 comments

Comments

@pszewello
Copy link

I set the refresh interval to 60 (s)... on load it get's the value from myuplink but then on refresh it's crashing:

Logger: homeassistant
Source: custom_components/myuplink/number.py:52
Integration: myUplink (documentation, issues)
First occurred: 2:38:23 PM (13 occurrences)
Last logged: 2:53:33 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 256, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 412, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 183, in async_update_listeners
update_callback()
File "/config/custom_components/myuplink/entity.py", line 93, in _handle_coordinator_update
self._update_from_parameter(parameter)
File "/config/custom_components/myuplink/number.py", line 52, in _update_from_parameter
self._attr_native_max_value = parameter.max_value * parameter.scale_value
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

@jaroschek
Copy link
Owner

jaroschek commented Mar 4, 2024

Based on the error trace the operations to apply the scale value to the given values for the number entity fail, because the given values from the parameter seem to be of type NoneType.

To avoid the integration from crashing I secured these arithmetic operations to only be executed if the given values are not None.

I created a new release containing this change. Please give it a try: https://github.com/jaroschek/home-assistant-myuplink/releases/tag/1.2.2

On the other hand: If you set the refresh interval to 60s, this could lead to blocked requests in the API. I never observed any value to be updated more often than every 5 minutes. Do you really think you need a refresh interval of 60s? Instead I observed many occasions where the API blocked my requests temporarily although I comply with the rate limit. So may be you can also increase the refresh interval to avoid any blocked requests.

@pszewello
Copy link
Author

I made slightly different changes localy in the api.py for the min max and step to always resturn something if no value available… as far as interval goes the reason to move from uplink to myuplink was the fact that you don’t have to wait 5min :) let’s see what happens at 60… i will pull the update later :)

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