How to group sensors with same suffix?

Hello community! First post, so go easy :slight_smile:

I’ve been running Home Assistant and OpenHAB in parallel for several weeks - each on it’s own Pi3B - and have decided that Hass.io is the way to go.

I’m starting to organise and customise my configuration now and one of the first things I’m doing is tidying up my messy, sensor ridden home screen.

I am using Dark Sky as a source of weather information - we already use it on our phones so it has a friendly “feel” even though it might not be to everyone’s taste - and I wonder if there is an easy way (programmatically in code) to group sensors with the same suffix into a group without having to type the name of each entity manually?

As an example, I have included the Dark Sky forecast array with 7 days of data, so there is a sensor configured for each metric with _1…_7 as a suffix where 1=tomorrow 2=tomorrow+1 etc.

I have started manually configuring my groups like this:

dark_sky_today:
  name: Today
  entities:
    - sensor.dark_sky_summary
    - sensor.dark_sky_temperature
    - sensor.dark_sky_apparent_temperature
    - sensor.dark_sky_daily_low_temperature
    - sensor.dark_sky_daily_high_temperature

dark_sky_tomorrow:
  name: Tomorrow
  entities:
    - sensor.dark_sky_daily_low_temperature_1
    - sensor.dark_sky_daily_high_temperature_1

dark_sky_next_day:
  name: Next Day
  entities:
    - sensor.dark_sky_daily_low_temperature_2
    - sensor.dark_sky_daily_high_temperature_2

I know I could use cut/paste after setting up the first group like I’ve started to do above (don’t judge me on the naming scheme :slight_smile: still experimenting!) but is there a better way to do this using a wildcard list of some sort or a-n-other means, or do I have to explicitly name each entity?

Any help much appreciated.
TIA,
Rowland.

2 Likes

I’m looking for the same thing. Did you find a solution?

Hey @kayhanbelek,

Never found a way to do this programmatically within HA, so I bit the bullet and entered the customisations manually. I realised I was only truly interested in creating two cards with today’s and tomorrow’s data, so I just lumped everything else into a dummy group in groups.yaml.

There was a breaking change for Dark Sky recently, which did weird things to the way in which today/tomorrow overnight low and daytime high are reported by the dark sky component which were a PITA to get sorted! The same breaking change that saw a stream of problems being reported for folks who had a generic Weather card on their home screen.

I bit the bullet and switched to Lovelace and haven’t looked back since. Been busy faffing with Z-Wave TRVs :nerd_face:.

ATB,
bikefright.

Hey there, i just run into this looking for something else.
If you just need the group for display purposes, i mean not to be able to turn them all on or off (in case of switches ex.) but, you just want to display them in your ui, take look in auto-entities. It does exactly that and very well.

Have anyone found a solution for this? :slight_smile: