Closed danielbrunt57 closed 1 month ago
The code was there at this point:
_LOGGER.debug(f"({self._attr_name}) [init] entity_id: {self.entity_id}")
if self._exclude_from_recorder:
self.disable_recorder()
def disable_recorder(self):
if RECORDER_INSTANCE in self._hass.data:
_LOGGER.info(f"({self._attr_name}) [disable_recorder] Disabling Recorder")
recorder_prefilter.add_filter(self._hass, self.entity_id)
but disappeared here:
I tried adding that definition:
But a new error is thrown:
Logger: homeassistant.components.binary_sensor
Source: helpers/entity_platform.py:364
integration: Binary sensor (documentation, issues)
First occurred: 7:52:03 PM (1 occurrences)
Last logged: 7:52:03 PM
Error while setting up variable platform for binary_sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
await asyncio.shield(awaitable)
File "/config/custom_components/variable/binary_sensor.py", line 111, in async_setup_entry
async_add_entities([VariableNoRecorder(hass, config, config_entry, unique_id)])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/variable/binary_sensor.py", line 177, in __init__
self.disable_recorder()
File "/config/custom_components/variable/binary_sensor.py", line 180, in disable_recorder
if RECORDER_INSTANCE in self._hass.data:
^^^^^^^^^^^^^^^^^
NameError: name 'RECORDER_INSTANCE' is not defined
Thanks! That's the same fix that I decided to try...
_LOGGER.debug(f"({self._attr_name}) [init] entity_id: {self.entity_id}")
# if self._exclude_from_recorder:
# self.disable_recorder()
async def async_added_to_hass(self):
Sorry, I missed those 2 lines when I was quickly fixing the issues caused by Variables in HA 2024.7 in #121 .
Assuming you are running Variables v3.4.5: For now, you can just delete lines 176-177 in binary_sensor.py:
if self._exclude_from_recorder:
self.disable_recorder()
Hey, it happens to the best of us from time to time and fortunately, I know a little python. Thanks again for the quick response!
binary_sensor.py Lines 176-177
disable_recorder is not defined.