Is there a way to automatically convert scenes to scripts?
I want to use Scenes but need variable brightness, temperature and colour control. Since Scenes don’t support templates, I need to convert them to Scripts.
However, I have over 20 Scenes with over 10 lights each, so converting them manually is far too time consuming. Is there a simple solution or has anyone written a Python script that does the job?
@tom_l Out of curiosity, how many scenes did you convert? I have 122 scenes that I want to pare down and convert to scripts as well and I’m trying to figure out just how big of a task I have in front of me.
The scenes are stored in YAML and scripts are YAML. The conversion looks fairly straightforward but a bit too complex for a shell script. Should not be too bad with a python program.
I was thinking that as well. Currently I have a bunch of scenes that target both areas and light groups. I want to add logic in the scripts that will determine brightness, color temp, colors, etc. I can do the main conversion using Python, but the actual logic will have to be custom based on the area and group I’m thinking.
@mlte I’ll try to get a quick script together tonight after I get off work and share it.
I use yq a lot from shell scripts, to autogen YAML config - mostly to add / remove steps / conditions from automations - and to combine multiple YAMLs into packages. There probably is a yq transform that would do the job. So that’s an option also, for me it’d be more difficult as set transforms are not a strength I have, but if you’ve used jq, the yq syntax is very similar.