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

Emoncms platform setup fails in helpers/entity_platform.py with TypeError #108828

Closed
scriptengine opened this issue Jan 25, 2024 · 4 comments
Closed

Comments

@scriptengine
Copy link

The problem

I'm using the Emoncms integration
( https://www.home-assistant.io/integrations/emoncms/ )

Since upgrading to Core 2024.1.3
The Emoncms fails to start

From the error log:

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:368
Integration: Sensor (documentation, issues)
First occurred: 06:59:46 (1 occurrences)
Last logged: 06:59:46

Error while setting up emoncms platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1282, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 945, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1066, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1006, in __async_calculate_state
attr.update(self.extra_state_attributes or {})
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/emoncms/sensor.py", line 224, in extra_state_attributes
ATTR_LASTUPDATETIMESTR: template.timestamp_local(float(self._elem["time"])),
^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: float() argument must be a string or a real number, not 'NoneType'

What version of Home Assistant Core has the issue?

2024.1.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Emoncms

Link to integration documentation on our website

https://www.home-assistant.io/integrations/emoncms/

Diagnostics information

No response

Example YAML snippet

#The API_key is specific to my platform and has been changed a little

sensor:
  - platform: emoncms
    api_key: d8b6c50fa94bedbc19a118adcd6d1755
    url: http://emonpi.local/emoncms
    id: 1

Anything in the logs that might be useful for us?

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:368
Integration: Sensor (documentation, issues)
First occurred: 06:59:46 (1 occurrences)
Last logged: 06:59:46

Error while setting up emoncms platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1282, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 945, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1066, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1006, in __async_calculate_state
    attr.update(self.extra_state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/emoncms/sensor.py", line 224, in extra_state_attributes
    ATTR_LASTUPDATETIMESTR: template.timestamp_local(float(self._elem["time"])),
                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: float() argument must be a string or a real number, not 'NoneType'

Additional information

Sorry I'm not sure what version of HA I was running before upgrading maybe march(massive ISH) 2023?

@home-assistant
Copy link

Hey there @borpin, mind taking a look at this issue as it has been labeled with an integration (emoncms) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of emoncms can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign emoncms Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


emoncms documentation
emoncms source
(message by IssueLinks)

@guyboltonking
Copy link

guyboltonking commented Mar 11, 2024

I think this is the problem described (and solved) in the forum here

@borpin
Copy link

borpin commented Mar 11, 2024

Yes, you need to ensure there are no NULL values returned and set up the UNITS in emoncms as well.

The integration needs a wholesale overhaul but there is no one with the skills who is willing to do it. There was a big update but was blocked for merging as was 'too complex'.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@issue-triage-workflows issue-triage-workflows bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants