Excluding/including entities with wildcards/glob/regex

Several components allow one to include or exclude entities or domains. For example, recorder and influxdb.

Is there any way to do this inclusion/exclusion with any sort of wildcards or regex? Something more fine-grained than just domains?

For example, I have a bunch of switches that report voltage, power, and current. They are all named things like sensor.sonoffs31_1_voltage or sensor.sonoffs31_2_power. Don’t really need all those in influxdb, either current or power is ebough. So I’d love to exclude something like sensor.sonoffs31_*_current.

Or, another example: my Octoprint component drops a bunch of sensors that I don’t want in influxdb. Would love to exclude sensor.octoprint* and not have to type them all in…

3 Likes

I’m a noob, glob syntax is an art… perhaps my learned experience to hide kinda mac addresses will help:

  customize_glob:
"device_tracker.[a-z,0-9][a-z,0-9]_[a-z,0-9][a-z,0-9]_[a-z,0-9][a-z,0-9]_[a-z,0-9][a-z,0-9]_[a-z,0-9][a-z,0-9]_[a-z,0-9][a-z,0-9]":
  hidden: true

these references where helpful:

glob tester for customization_glob:
http://www.globtester.com/

Wait, does HA just allow glob patterns in configuration.yaml? I’ve not seen this anywhere, do you know where this is documented? Not how to write the glob pattern, but how to use it in HA.

Customizing entities

# Customize entities matching a pattern
customize_glob:
     "light.kitchen_*":
      icon: mdi:description
    "scene.month_*_colors":
      hidden: true
      emulated_hue_hidden: false
      homebridge_hidden: true

Ah, ok, seems to only be for customizing. I don’t see anything to suggest it works beyond that, in other configuration contexts…

@Juliean_Galak you ever get anywhere on this ? I am facing a similar issue myself

I would also like to be able to this. Just getting going with ZHA Zigbee and would like to include “sensor.*_temperature” in recorder.

"scene.month_*_colors.*":
  hidden: true
  emulated_hue_hidden: false
  homebridge_hidden: true

will this wok also?
So everything that have things after color.

A bit late… but recorder now has the entity_globs attribute which allows wildcarding

1 Like