Scripts, set area, separate script files

I am trying to reorganize my dashboards based on areas and want to include things like scripts on the auto-entities I generally use to pull these in.

Which means setting an area on scripts.

Which I think cannot be done in YAML (all my scripts are in YAML). You can’t do it in customize apparently either, only in the GUI. I think. Right? Would REALLY prefer to do this in YAML (or any text).

All my YAML are separated into files, for example a lot of camera oriented ones in scripts_camera.yaml, music in something else, etc.

If a particular script is not in the main script.yaml file I cannot use the GUI, even though the GUI doesn’t write the area back in YAML.

Is there any alternative here other than re-combining all the nicely organized and separated script files into one?

Linwood

PS. Please, please – developers – please please pleaase while continuing the goal of allowing everything to work in GUI’s, please stop having things one can ONLY do in GUI, allow us to continue with text files. We really should be able to put an area, icon, precision, device class and such on YAML created entities, so that half the config isn’t in text and half in the GUI. Please.

You can do it with the Spook integration:

action: homeassistant.add_entity_to_area
data:
  area_id: study
  entity_id:
    - script.computer_sockets_off

In fact you can add multiple entities to an area in one go.

So… if HA won’t let me add an area in the GUI, is it safe (persistence, no corruption, no orphan info if I remove the script, etc.) if I do it in Spook?

I guess I assumed there was a good reason for the restriction, do you mean it’s just bogus?

Better ask @frenck - Spook is his baby.

I have scripts stored in separate files in a /config/scripts folder, linked into configuration.yaml using !include_dir_merge_named. Using the GUI to assign an area to them seemed to work just fine when I tested less than a minute ago…?

1 Like

Well this is a bit embarrassing… This is what happens for me:

I stopped at that point and did not try to get into change it. But if I go to the three dots, then info, then gear:

I was thrown by the seeming error message on the prior screen, which I guess only applies to the sequence itself not the attributes.

My apologies for the silly question, and thank you for making me look closer.

1 Like