WTH is there no service to update the values stored in a scene?

Why the heck is there no scene.update service that can be called from automations / lovelace UI actions to update all of the values stored in a scene to their current runtime values.

It is often desirable to allow non-administrative / non-technical users to update scenes (for lighting in particular) without requiring them to have access to or knowledge of the editor UI or Home Assistant settings. Imagine an entity card configured like so where a button’s tap action recalls a scene and the hold action updates the scene:

type: entities
title: Updateable Lighting Scene
entities:
  - type: buttons
    entities:
      - entity: scene.mood_lighting
        name: Mood Lighting
        tap_action:
          action: call-service
          service: scene.turn_on
          data:
            entity_id: scene.mood_lighting
        hold_action:
          action: call-service
          service: scene.update
          data:
            entity_id: scene.mood_lighting

You can do this by creating scenes on the fly.

I should have been more specific - I think there should be a way to permanently update the values stored for entities in an existing scene defined in scenes.yaml without having to either edit the YAML directly or manually fiddle with lighting entities from inside the scene editor UI and re-save it from there, as I would consider both of those to be administrative-level functions.

As I understand it, scenes created on the fly are volatile and do not persist through config reloads / reboots, so that doesn’t work. Ignoring the volatility, you still have to “rebuild” the scene (by specifying desired entities, etc.) in your automations when you call scene.create. That’s an unnecessary step for my use case as I already have an existing - and appropriately named - scene that already contains a list of entities I care about. I just need to update the values associated with those entities to reflect their current state.

As far as a real-life use case, my 10-year-old son has RGB strip lights in his room that he controls through the companion app. I’ve defined some scenes for him (“Bright”, “Dim”, “Wacky!”, “Homework”, “Night Light”). If he decides to change up the “Wacky!” scene, he should be able to recall the scene from a button on his dashboard UI, make manual adjustments to the RGB strip lights through controls on his dashboard UI, then save those changes he just made back to the “Wacky!” scene by pressing a button on his dashboard UI. He doesn’t have access to Home Assistant settings or scenes.yaml, but should still be able to do this without getting “admin dad” involved. This can all be easily done with current Home Assistant functionality except the re-saving part.

Does that make more sense, or have I missed the obvious solution here?

4 Likes

Scenes which have been created and/or updated on the fly (i.e., via a service call) should have the option of persisting after a restart.

2 Likes

Have you figured this out?
I would love have this feature.

1 Like

Exact same use case as @fasteddy516.
Also need persistent on the fly scenes.

The feature request is there since 2021 and has gathered a number of upvotes…

Has anyone figured out a solution or could someone point us to a possible workaround?

Since the scene deletion has to be called from the code somewhere, is there a simple way to bypass/disable/comment out this part of the code?

There is no “scene deletion” code to comment out. The system does not work that way. The entities are created and only exist in memory. A system to store and recall from disk would need to be developed.

Got it. Just thought it was temporarily stored as YAML and could be retrieved somehow. Thanks for the feedback.

I’ve searched the forums for some workaround but haven’t been successful yet. I saw something via NodeRed but will need to investigate more.

Coming from a platform where user “scripting” was common I’m wondering if you came across any user developped solution to capture states and save/restore from disk?

Otherwise, fingers crossed as this feature was originally mentioned as a “part 2” of the scene.create service🤞(2019)

Thanks.

scene.create has a typical problem of losing it once restarted.
There is no other way that a script can update the saved scene.

What I am trying to achieve?
On ‘Scene1’ button press, save/update the selected entities’ states so it can be recalled next time.
User wants to keep 2 scenes.

Updating scenes via ‘Automation& Scenes’ is very difficult for non-technical users.
Also, non-admin users will have issues seeing all the scenes and being able to change everything.

Easy method to update the scene is: The user has its mushroom-based user-friendly dashboard, he/she changes lights/fan/climate as wanted and then long presses the scene button on same dashboard which calls script and update/save the scene.

However, currently, there is no way you can change the scene via script or save the current snapshot forever.

HA really needs to redesign its core scene methodology.

1 Like

Whoa, I just found this post today while trying to figure out how I can constantly store the last on attributes of a light entity in a scene so I can easily change it in an automation and revert back after. Is there really no way to do this, still?