Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scene manipulation #29

Open
pbulteel opened this issue Mar 12, 2024 · 1 comment
Open

Scene manipulation #29

pbulteel opened this issue Mar 12, 2024 · 1 comment

Comments

@pbulteel
Copy link
Owner

pbulteel commented Mar 12, 2024

From FB

I have the following script which I use in automations to create a new scene. I can then call that scene to activate it back again.

alias: Scene Creator Script
sequence:
  - variables:
      scene_name: "{{ name_var }}_{{ room_var }}"
      scene_id: scene.{{ name_var }}_{{ room_var }}
      sxc: |
        {"scene": "{{ scene_name }}"}
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ states(scene_id) == 'unknown' }}"
        sequence:
          - service: scene.create
            data:
              snapshot_entities: "{{ my_entities_var }}"
              scene_id: "{{ scene_name }}"
      - conditions:
          - condition: template
            value_template: "{{ states(scene_id) != 'unknown' }}"
        sequence:
          - service: scene.delete
            target:
              entity_id: "{{ scene_name }}"
            data: {}
          - service: scene.create
            data:
              snapshot_entities: "{{ my_entities_var }}"
              scene_id: "{{ scene_name }}"
  - stop: Captured Scene
    response_variable: sxc
fields:
  name_var:
    selector:
      text: null
    name: name var
    required: true
  room_var:
    selector:
      area: {}
    name: room var
    required: true
  my_entities_var:
    selector:
      entity:
        multiple: true
    name: my entities var
    required: true
@pbulteel
Copy link
Owner Author

From Alan Gil Cardenas on HA group

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant