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

add script shortcut for activating scenes #27223

Merged
merged 2 commits into from Oct 5, 2019

Conversation

mdonoughe
Copy link
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
@@ -885,6 +885,8 @@ def custom_serializer(schema):

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

_SCRIPT_SCENE_SCHEMA = vol.Schema({vol.Required("scene"): string})
Copy link
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
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 🎉 🐬

Dev automation moved this from Needs review to Reviewer approved Oct 5, 2019
@balloob
Copy link
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
Dev automation moved this from Reviewer approved to Done 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
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

Add activate scene to script syntax
4 participants