Why the heck are many options so damned fussy?

Look at how the entity_id option in these examples is not fussy:

  service: light.turn
  entity_id:
   - light.kitchen
   - light.bathroom
  service: light.turn
  entity_id: light.kitchen, light.bathroom

In the first example, entity_id is assigned a list
['light.kitchen', 'light.bedroom']
In the second example, entity_id is assigned a string
light.kitchen, light.bedroom

Both examples work and all the magic happens internally without any complaining that entity_id was not given a list.

More of this easy-going behavior would be appreciated. Compare it to the fussiness of options like rgb_color. It requires a list and accepts nothing else.

That’s not just inconvenient but downright challenging if you want to template it. Templates can only produce a string. So you’re obliged to template each color value (i.e. three templates, one for red, a second for green, and a third for blue). Most users only discover this after posting a question in the forum about why their single template fails to work with rgb_color.

rgb_color ought to accept either a list or a comma-delimited string like this:

rgb_color: '125, 80, 200'

A single template can easily crank out a comma-delimited string.

Similar: WTH can´t I get hs_color in data_template to work

Indeed, I used the same example in both but here I’m generalizing. More options, that currently demand lists, ought to accept comma-delimited strings.

A better example is the params option for the Xiaomi vacuum cleaner. It only accepts a list and can have a variable number of items. You can’t support that with a template.

Also the specification of an entity id can be quite fussy:

If it works differently in different places, for no apparent good reason, that’s capricious. :wink:

You bring up a related WTH? and that has to do with consistency. As I recall there was some work done to standardize on the term scan_interval because it wasn’t used consistently. Similar efforts would be welcome in other areas as well (like the behavioral consistency of entity_id).

1 Like