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 multiple 'to' states #358

Closed
wants to merge 1 commit into from

Conversation

vorostamas
Copy link

Example of having multiple states in "to":

automation:
  - alias: Turn on busylight if user is in a meeting
    trigger:
      platform: state
      entity_id: sensor.teams_activity # User status in Microsoft Teams 
      to: ["InACall", "InAMeeting"]
    action:
      - service: light.turn_on
        data:
          entity_id: light.bedroom_light

@@ -62,7 +62,7 @@ export interface StateTrigger {
platform: "state";
entity_id: string | string[];
from?: string | boolean;
to?: string | boolean;
to?: string | string[] | boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Accepting boolean is actually incorrect here.

Suggested change
to?: string | string[] | boolean;
to?: string | string[];

The HA state engine only works with strings.
See: https://github.com/home-assistant/core/blob/4acc6f333efe1d2426fb74510ce2de95971205b0/homeassistant/components/automation/state.py#L35

vol.Optional(CONF_TO): vol.Any(str, [str])

@@ -62,7 +62,7 @@ export interface StateTrigger {
platform: "state";
entity_id: string | string[];
from?: string | boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The same applies to the from case.

@frenck
Copy link
Collaborator

frenck commented Jul 11, 2020

I've also added it to #374
Not because I wanted to bypass you, but the structure is changing in that PR, which would made this PR a merge conflict.

@frenck
Copy link
Collaborator

frenck commented Jul 12, 2020

Replaced by #374

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

Successfully merging this pull request may close these issues.

2 participants