Hello
Just created my first script and was then going to copy it several times for different hue scenes and noticed a number at the start of it. I used the Script UI so assume this is generated via using that.
I cannot remove it though without an error, and I cannot duplicate it so do I just pick random numbers for each script or should I be doing something different.
The script documentation is a bit different to what goes in the script.yaml file using the editor.
This is what the editor has created:
'1609766965146':
alias: Bedroom Energize Scene
sequence:
- service: hue.hue_activate_scene
data:
group_name: Bedroom
scene_name: Energize
mode: single
icon: mdi:sparkles
That number is the ‘name’ of the script. You can put anything you like there (so long as it is unique), the ui editor just creates a random one.
If you had written it yourself you would probably have put
bedroom_energize:
alias: Bedroom Energize Scene
sequence:
- service: hue.hue_activate_scene
data:
group_name: Bedroom
scene_name: Energize
mode: single
icon: mdi:sparkles
It will do exactly the same thing.
1 Like
Thanks.
Looks like I have messed it all up already.
One created using the UI. Then I copied it and did another version of exactly the same code, different name to try and load a different scene. This didnt work, so tried another script through the UI and now my UI looks like this:
but in my scrips.yaml I have three:
Bedroom Energize:
alias: Bedroom Energize Scene
sequence:
- service: hue.hue_activate_scene
data:
group_name: Bedroom
scene_name: Energize
mode: single
icon: mdi:sparkles
Bedroom Read:
alias: Bedroom Read Scene
sequence:
- service: hue.hue_activate_scene
data:
group_name: Bedroom
scene_name: Read
mode: single
icon: mdi:sparkles
bedroom_dimmed_scene:
alias: Bedroom Dimmed Scene
sequence:
- service: hue.hue_activate_scene
data:
group_name: Bedroom
scene_name: Dimmed
mode: single
what have I done wrong, why do all three not appear in the UI?
The name (or ‘key’) for the script must be all lowercase with no spaces (use underscores).
The only one that is working for you is the only one that you already did this with.
brill thanks! years of HA and I still get thrown by upper case and spaces!
1 Like