enkama / hass-variables

Home Assistant variables component
90 stars 12 forks source link

HA 2023.6+ Disabling Recorder throws AttributeError #62

Closed Snuffy2 closed 1 year ago

Snuffy2 commented 1 year ago

HA 2023.6 changes the way the Recorder works. What worked before, now throws an AttributeError. For now, I'll just catch the error so it fails gracefully. Once I figure out how to disable the recorder in 2023.6+, I'll implement that.

2023-06-02 18:16:16.932 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up variable platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 320, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/variable/sensor.py", line 94, in async_setup_entry
async_add_entities([Variable(hass, config, config_entry, unique_id)])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/variable/sensor.py", line 144, in __init__
self.disable_recorder()
File "/config/custom_components/variable/sensor.py", line 151, in disable_recorder
ha_history_recorder.entity_filter._exclude_e.add(self.entity_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'function' object has no attribute '_exclude_e'