Scene duplication

Hello,
Feature description

The idea would be to be able to duplicate a scene. (useful when you need to do the same scene x times)

The best would be, when copying, to ask which device should be taken into account.

Example:

  • An initial scene that signals a low battery for device X.
  • You duplicate the scene and specify that it is for device Y (note that I am not talking about also customizing the message sent if you use the « send a message » action)

Great idea for duplication!

On this point, I’m not sure, how do we do it if the scene is complex and has dozens of actions linked to many devices?

I think the simplest solution is to have a duplicate button and then modify the scene accordingly.

Very brief description:

  • Analysis of the scene to be copied and retrieval of the values of the « devices » variables
  • A page that displays the device value for each device of the copied scene in a « select box » first. For each « select box », the rest of the choices will be of the same type as the device of the copied scene.
  • The user will therefore be able to change their devices
  • A « save » button to validate their choices.

For this, of course, in the properties of the devices that gladys can query, the « type » property of the device must be entered and common to the same type of device.

I don’t know how a scene is coded (static mode (raw text file) or dynamic (via a database)) or how devices are referenced.

I recognize that this can be a gas plant especially if you are in static mode.

I’m not convinced, basically you’re suggesting to recode the « scene editing » view in another view, I don’t see the point.

Might as well just copy the scene and then the user can modify the scene!

Okay, that was just an extra, the important idea was scene duplication.

Hello, I just made a small PR to add scene duplication. When you click the copy button, it redirects to a new page to choose the new name for the duplicated scene.

Hello,

I just integrated it into my PROD Gladys because I integrated my Z-Wave devices and therefore I need to create countless scenes to manage my devices (for toggle ON/OFF I already need 2 scenes and when I have a 5-button switch :smirk:. It « works » except that (and I don’t think this is related to this new feature) but when you modify an element, for example, the device associated with an action « Control a device », the value field changes automatically. Similarly, when you modify a trigger « Device state change », the condition remains, the value also remains but when saving, I have an error because « null » is sent in the request.

You save my life :crazy_face:

Thanks @Romuald_Pochet for your feedback,
I will try to reproduce it on my side to see if I haven’t broken anything. Does your issue appear on all scenes or just the one you duplicated?

No, this happens on all scenes

I tried to reproduce it but since I don’t have many materials connected to my dev instance (I often reset the database to have a clean instance), I didn’t find anything. I would rather advise you to file a bug on the GitHub.

Hi @Lokkye,

I just tested your PR, (struck-through = not tested) :

  • On trigger :
    • :white_check_mark:Device state change
    • :white_check_mark:Scheduled trigger
    • At each sunrise
    • At each sunset
    • :white_check_mark:Return home
    • :white_check_mark:Leaving home
    • :white_check_mark:Home is empty
    • :white_check_mark:Home is no longer empty
    • User enters the zone
    • User leaves the zone
    • A calendar event occurs
  • On action :
    • :white_check_mark:Turn on the light (keeping the same one and editing it),
    • :white_check_mark:Turn off the lights (keeping the same one and editing it),
    • :white_check_mark:Turn on the plugs (keeping the same one and editing it),
    • :white_check_mark:Turn off the plugs (keeping the same one and editing it),
    • :white_check_mark:Wait,
    • :white_check_mark:Send a message (keeping the same one and editing it),
    • :white_check_mark:Retrieve the last state (keeping the same one and editing it),
    • :white_check_mark:Continue only if (keeping the same one and editing it),
    • :white_check_mark:User seen at home (keeping the same one and editing it),
    • :white_check_mark:User left the home (keeping the same one and editing it),
    • :white_check_mark:Check presence (keeping the same one and editing it),
    • Make an HTTP request,
    • :white_check_mark:Time condition,
    • :white_check_mark:Start the scene (keeping the same one and editing it),
    • :white_check_mark:If the home is empty (keeping the same home and editing it),
    • :white_check_mark:If the home is not empty (keeping the same home and editing it),
    • :white_check_mark:Control a device (keeping the same one and editing it),
    • Condition on a calendar event,

I can’t reproduce @Romuald_Pochet’s case on « Control a device » (well, if you change the device the value does indeed fall back but that’s part of the base scene construction) but if I save immediately it works and if I put back the previous value (e.g. switch to On), likewise it saves correctly.

Note: If it’s possible to change the icon that would be perfect. Even though in most cases it won’t be the case, there are use cases where it can be useful ^^

Great PR ^^

For your information, I just reviewed the PR on GitHub => Duplicate scene by callemand · Pull Request #1505 · GladysAssistant/Gladys · GitHub

Overall, the feature works well, I just have a few UX comments! Nice work.

Quick follow-up on this topic — if anyone drops by here, development is no longer active and we are therefore looking for someone to take over development :slight_smile:

The PR above was a good start, the work can be picked up again; you just need to address the various comments/feedback left on the PR.

Thank you very much for your feedback. I didn’t have as many test cases on my end. Great testing work.

I’m still here. I was just waiting for a few reviews. I’ll see about giving feedback ASAP.

Cool! :slight_smile: We’ll probably need to do a small rebase too since quite a few things have changed since the PR!

Don’t hesitate to ask if you have any questions

@pierre-gilles: I’ve done the rebase and the changes on the PR but I can’t reopen it.
Could you check on your end if you can do it ?
Otherwise I’ll have to create a new one :frowning:

Are you sure you can’t ( by commenting)?

I can’t do it either!

You can recreate it, it’s not a problem :slight_smile:

Here is the re-created PR: Duplicate scene by callemand · Pull Request #1670 · GladysAssistant/Gladys · GitHub