Skip to content

NameError: name 'ATTR_' is not defined #269

@domo86

Description

@domo86

System Health details

Méthode d'installation
Home Assistant OS
Core
2025.9.1
Supervisor
2025.09.0
Operating System
16.2
Interface utilisateur
20250903.3

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of any previous issues..

Describe the issue

With the latest update of Homeassistant, I see in the log every 30 seconds this part: ( Version of average : 2.4.0 )

NameError: name 'ATTR_' is not defined
2025-09-10 20:04:40.976 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.puissance_moyenne fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 963, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1314, in async_device_update
await self.async_update()
File "/config/custom_components/average/sensor.py", line 310, in async_update
await self._async_update_state()
File "/config/custom_components/average/sensor.py", line 477, in _async_update_state
self.init_mode(state)
~~~~~~~~~~~~~~~^^^^^^^
File "/config/custom_components/average/sensor.py", line 407, in init_mode
ATTR
)
^^^^^
NameError: name 'ATTR
' is not defined

Reproduction steps

Read logs

Debug logs

NameError: name 'ATTR_' is not defined
2025-09-10 20:04:40.976 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.puissance_moyenne fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 963, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1314, in async_device_update
    await self.async_update()
  File "/config/custom_components/average/sensor.py", line 310, in async_update
    await self._async_update_state()
  File "/config/custom_components/average/sensor.py", line 477, in _async_update_state
    self._init_mode(state)
    ~~~~~~~~~~~~~~~^^^^^^^
  File "/config/custom_components/average/sensor.py", line 407, in _init_mode
    ATTR_        )
    ^^^^^

Diagnostics dump

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions