So many events in Home Assistant

Curious how you’ve got your recorder settings setup in configuration.yaml? I have mine with 7 days retention, auto_purge set to true and only the bed scale entities disabled because they update every 0.2s. My DB hums along just under 2gb steady and that’s with a blue on there for several months now.

A quick workaround for now could be excluding the number domain.

recorder:
  exclude:
    domains:
      - number

That will at least keep most of the entities from writing to the DB to keep it from growing exponentially.

Yeah I’ve since added many exclusions and disabled hundreds of unnecessary entities and it’s OK now. I do believe there shouldn’t be a requirement to go dial back the fire hose especially when you don’t expect expect a couple switches to result in suddenly being out of disk space.

I normally keep 30 days of history and that’s been fine for years with everything else I have.

I believe this is just an end result because of how z2m operates. Basically anything under that “exposes” tab gets exposed to HA as an entity. This happens on all of my devices on z2m. It’s MUCH more noticeable with the blues because of the sheer number of options and configurability these devices have, especially with the individually addressable LED’s.

I’ve personally never noticed an impact on my DB through testing, but 130+ entities will definitely add to it. I’m also going to exclude the numbers domain because I don’t need to track history of any of them. I’ll see if it makes an impact on my DB size. I personally would prefer excluding from the DB rather than disabling the entity. The bonus of having the entity created is it allows easy configuration through HA’s UI or something that can be set or changed through an automation.

All of my sitches have “switch” in their name/enity_id so I use these excludes.

  exclude:
    entity_globs:
      - number.*_switch_*
      - sensor.*_switch_*
      - binary_sensor.*_switch_*

Hey all! I continue to scrub my data and find ways to reduce the overall messaging load. I have been doing a number of things, one of which is a feature request I opened against Zigbee2Mqtt.

Foremost I created a Python script that connects to Home Assistant over a websocket. The script takes a device name and a configuration of a list of entity names to be disabled. So, instead of disabling recorder entities I completely disable the entities I don’t want to see. This reduces clutter in UI and keeps my database clean. If people would like I can post the script on this thread. It’s required that you have Python installed somewhere where you can run a script.

The script is nice but whenever I add a new switch I will have to run the script again (I like fully automated solutions). The feature request I submitted to Z2M is to enhance a configuration item they already have. There is a feature in Z2M to suppress attributes that are published. The config I added to Z2M (which is just an example) is:

"device_options": {
            "filtered_attributes": [
                "^defaultLed\\d.*When(On|Off)$",
                "^dimmingSpeed.*$",
                "^led.*When(On|Off)$",
                "^rampRate(On|Off)To.*$"
            ]
}

This config means that any attribute that matches one of the regular expressions in the list will not be published by Z2M. This does what it is supposed to, however it does not suppress those attributes on the MQTT message that causes HA to create entities – which is what I would really like. Here is the GitHub issue if you want to follow along and/or comment: [Feature request]: Add support for filtered_attributes on device creation · Issue #15075 · Koenkk/zigbee2mqtt · GitHub.

Other things I have done are to reduce the reporting thresholds on energy and power. In the reporting tab for the device I changed haElectricalMeasurementactivePower to 10 and I changed saMeteringcurrSummDelivered to 10. AThe power change was very helpful as I have a device whose power reading would flip back and forth between 10.5 and 10.6 and each flip causes a update. (I still don’t understand the reason these are updated on the Z2M reporting tab versus the Exposes tab.)

I plan on automated my default configuration of a switch in the future. This will include defaults I would like for me as well as the reporting parameters. I believe everything I want to configuration as defaults can be accomplished using the MQTT publish HA service call. I know configuration parameters can be handled, I don’t yet know about reporting parameters. Still learning here and would be grateful for any tips.

1 Like

I would be interested in the script

Comment on the GitHub gist if possible.

5 Likes

Thanks to @nathanfiscus who posted the recommendation in another thread.

This will remove the duplicate attribrutes in all the entities. Just uncheck the box for “Home Assistant legacy entity attributes” then submit. After you must do a complete Home Assistant restart. Only restarting Z2M will not work.

1 Like

“Home Assistant legacy entity attributes” is already disabled for me, yet I still see the huge number of attributes.

This script works great! Thank you!

Is there a tutorial somewhere on how to enter this script? I’ve search and haven’t found anything yet.
Thanks Paul

Did you figure out how to actually run this?