Open Snuffy2 opened 1 month ago
Architecture Discussion: https://github.com/home-assistant/architecture/discussions/1106
FYI, for places
and hass-variables
, I've implemented a kinda klunky workaround by having a child class that inherits from my main entity class that sets _unrecorded_attributes = frozenset({MATCH_ALL})
as a class attribute. Then in async_setup_entry
calling async_add_entities
for the normal vs the no-recorder class.
So I'm not using recorder_history_prefilter at all at least for now. From the architecture discussion, it sounds like they're at least considering the ability to disable a recorder by entity. Fingers crossed.
https://github.com/custom-components/places/pull/290 https://github.com/enkama/hass-variables/pull/121
I am home from Switzerland and have fixed the iCloud3 recorder-history issue. I had several hardware issues to fix before I could get into it. I turned on my computer and saw smoke coming from inside it's case. It turned out that the video card was fried, probably from some electrical storms and power outages we had while I was away. My Rpi was also fried and failed to boot. Fortunately, I had an older one with 2Gb of memory that was sitting in a closet. I am now using that while I wait for Amazon to bring me a new 8Gb model.
In any case, you will find iCloud3 v3.0.5.5 below. Can you unzip it into the icloud3 directory and restart. Everything should now work as expected. I'll issue a new release if everything is OK.
I found that the _unrecorded_attributes = frozenset({MATCH_ALL})
was not working. All of the sensor attributes were still being added to the HA recorder history database. I have the sensor Classes structured in a way to have a class for distance, time, text, info, battery, etc. sensors that generate the attributes associated with a parent class for the general updating for the Sensor Entity.
Class DeviceSensor_Base(SensorEntity):
def __init__(---):
--- lots of code ---
Class Sensor_Timer(DeviceSensor_Base):
_unrecorded_attributes = frozenset({MATCH_ALL})
def attribute_code():
--- code for attributes
That was not working. Nothing was being excluded. I changed the structure to:
Class DeviceSensor_Base():
def __init__(---):
--- lots of code ---
Class Sensor_Timer(DeviceSensor_Base, SensorEntity):
_unrecorded_attributes = frozenset({MATCH_ALL})
def attribute_code():
--- code for attributes
That also did not work. What got everything running was specifying the attributes to be excluded for each type of sensor instead of using the MATCH_ALL.
_unrecorded_attributes = frozenset(['integration', 'sensor_updated', 'icon', 'friendly_name', 'last_located',...])
This may have been caused by various timer type sensors with different attributes that all use the 'Sensor_Timer' class and the class attribute was turning into an instance attribute. I don't know but wanted to give you a heads up on what I ran into.
The places-attrs-ha-history.txt file is the entry in the home-assistant_v2.db history database showing the places attributes when the extended attributes is enabled and disabled. It seemed like a lot of attributes and I'm not sure if the ones that should be excluded are really being excluded. I'm using SQLite Expert Personal to display the ha database (sensor_attributes table).
Wow! I hope your trip was amazing though. Seems like your tech missed you and revolted (both software and hardware) in response.
It's really weird that specifying SensorEntity in your base class doesn't work but doing it in the inherited child class does. Not sure why that would be. Might be worth a question to HA, but not if you think it will derail the architecture discussion for a better fix in process.
I loaded v3.0.5.5 and everything seems to be ok. However, a number of caveats from my end:
sensor.icloud3_event_log
manually excluded in my configuration.yaml. Not sure how long ago I put that in, but it was likely when we were having the recorder issues months (years?) ago, but before you developed the recorder_history_prefilter. I commented out the exclusion yesterday when I upgraded to v3.0.5.5Regarding MATCH_ALL in places:
Just adding this here for tracking: https://github.com/gcobb321/icloud3/issues/349 https://github.com/enkama/hass-variables/issues/120
Likely from changes made as part of this: https://developers.home-assistant.io/blog/2024/06/22/excluding-state-attributes-from-recording-match-all/ https://developers.home-assistant.io/docs/core/entity/#excluding-state-attributes-from-recorder-history