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

Adding sensor throws error #55

Closed
Calimerorulez opened this issue May 24, 2024 · 6 comments
Closed

Adding sensor throws error #55

Calimerorulez opened this issue May 24, 2024 · 6 comments

Comments

@Calimerorulez
Copy link

Hi,

I'm trying to add a sensor, but the following error is thrown in the HA log:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/daily/sensor.py", line 38, in async_setup_entry
    coordinator = hass.data[DOMAIN][entry.entry_id][COORDINATOR]
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'coordinator'

The sensor is created, but it shows no entity in the details.

@Calimerorulez
Copy link
Author

Reverting back to 2024.4.2 solves it.

@jeroenterheerdt
Copy link
Owner

I don't see this issue at all, it works fine for me.

@jeroenterheerdt
Copy link
Owner

can you explain a bit more of what you're doing?

@Calimerorulez
Copy link
Author

Hi @jeroenterheerdt

When adding a new daily sensor, I select the sensor from which the new daily sensor should take its value. When done configuring the new sensor via the config flow introduced in .3, I see the new daily sensor is being created in the integration, but it does not save the (name) of the sensor from which it should take its value. When looking in the logging the error in the openings post is shown.

Existing daily sensors, created before the update to .3, continue to work, but newly created give me the error.

I suspect that it has something to do with the added config flow.

Groeten,
Patrick

@jeroenterheerdt
Copy link
Owner

I am not seeing that at all... is there any chance you could do a uninstall, reboot, reinstall to see if that helps?

@Giorsetti
Copy link

Hello,
I've uninstalled everything and restarted HA, but the problem is still the same.
Before the update, at the beginning of the week, everything was operational.
Here are the error messages:

This error comes from a custom integration

Recorder: homeassistant
Source: custom_components/daily/sensor.py:155
Integration: Daily sensor (documentation, problems)
First occurred: 17:32:06 (7 occurrences)
Last recorded: 17:35:06

Error doing job: Future exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/daily/sensor.py", line 72, in
lambda event: self._handle_update( # pylint: disable=unnecessary-lambda
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/daily/sensor.py", line 102, in _handle_update
the_val = self.convert_to_float(input_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/daily/sensor.py", line 155, in convert_to_float
return float(float_value)
^^^^^^^^^^^^^^^^^^
TypeError: float() argument must be a string or a real number, not 'State'

Thank you.

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

3 participants