Skip to content

add script shortcut for activating scenes#27223

Merged
balloob merged 2 commits into
home-assistant:devfrom
mdonoughe:scene-script
Oct 5, 2019
Merged

add script shortcut for activating scenes#27223
balloob merged 2 commits into
home-assistant:devfrom
mdonoughe:scene-script

Conversation

@mdonoughe
Copy link
Copy Markdown
Contributor

@mdonoughe mdonoughe commented Oct 5, 2019

Description:

Use - scene: scene.<scene name> in a script to activate a scene instead of writing

- service: scene.turn_on
  data:
    entity_id: scene.<scene name>

Should it be just -scene: <scene name>? Writing -scene: scene. seems redundant.

Related issue (if applicable): fixes #27026

Pull request with documentation for home-assistant.io: home-assistant/home-assistant.io#10616
Pull request for frontend: home-assistant/home-assistant-polymer#

Example entry for configuration.yaml (if applicable):

# Example configuration.yaml entry
script:
  message_temperature:
    sequence:
      - scene: scene.morning_living_room

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

use `- scene: scene.<scene name>` in a script to activate a scene

DEVICE_ACTION_SCHEMA = DEVICE_ACTION_BASE_SCHEMA.extend({}, extra=vol.ALLOW_EXTRA)

_SCRIPT_SCENE_SCHEMA = vol.Schema({vol.Required("scene"): string})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's validate it as entity ID for the scene domain.

Suggested change
_SCRIPT_SCENE_SCHEMA = vol.Schema({vol.Required("scene"): string})
_SCRIPT_SCENE_SCHEMA = vol.Schema({vol.Required("scene"): entity_domain("scene")})

Copy link
Copy Markdown
Member

@balloob balloob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! This is a great contribution 🎉 🐬

@balloob
Copy link
Copy Markdown
Member

balloob commented Oct 5, 2019

I think that we should keep it as an entity ID and not object ID, because we don't use just object ID anywhere in the codebase.

@balloob balloob merged commit d16edb3 into home-assistant:dev Oct 5, 2019
mdonoughe added a commit to mdonoughe/home-assistant.github.io that referenced this pull request Oct 5, 2019
mdonoughe added a commit to mdonoughe/home-assistant-polymer that referenced this pull request Oct 5, 2019
balloob pushed a commit to home-assistant/frontend that referenced this pull request Oct 5, 2019
@lock lock Bot locked and limited conversation to collaborators Oct 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add activate scene to script syntax

4 participants