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

Automation editor clobbers multiple state conditions #6664

Closed
skylyn opened this issue Aug 20, 2020 · 9 comments · Fixed by #10481
Closed

Automation editor clobbers multiple state conditions #6664

skylyn opened this issue Aug 20, 2020 · 9 comments · Fixed by #10481
Labels
Bug Current Bug in UI - Extra Attention

Comments

@skylyn
Copy link

skylyn commented Aug 20, 2020

Checklist

  • [ X ] I have updated to the latest available Home Assistant version.
  • [ X ] I have cleared the cache of my browser.
  • [ X ] I have tried a different browser to see if it is related to my browser.

The problem

Release 0.112 added multiple state support for conditions in Automations.

This is great, so I have many automations now that trigger if I'm in one of several modes. eg:

  condition:
  - condition: state
    entity_id: input_select.home_mode
    state:
      - Night
      - Home

However, if I load this automation in the UI, the UI reads it in and displays it as
image

and if I save any change to any part of this automation in the UI, it clobbers the condtion and becomes:

condition: state
entity_id: input_select.home_mode
state: 'Sleep,Night'

Expected behavior

Can open and edit automation in UI with multiple states and have it save in the correct format ie:

  condition:
  - condition: state
    entity_id: input_select.home_mode
    state:
      - Night
      - Home

instead of

condition: state
entity_id: input_select.home_mode
state: 'Sleep,Night'

Steps to reproduce

  1. Edit Automations.yaml manually and create an automation with a condition with multiple states such as:
- id: trigger_good_morning
  alias: 'Trigger: Good Morning'
  trigger:
  - entity_id: binary_sensor.master_closet_motion
    platform: state
    to: 'on'
  condition:
  - condition: state
    entity_id: input_select.home_mode
    state:
      - Sleep
      - Night
  action:
  - data: {}
    service: script.good_morning
  mode: single
  1. Go to the UI and load the automation "Trigger: Good Morning"
  2. Without changing anything, press save.

Environment

  • Home Assistant release with the issue: 0.114.3
  • Last working Home Assistant release (if known): n/a
  • Browser and browser version: Firefox Version 78.0.2 (64-bit) and Chrome 84.0.4147.89 and mobile app
  • Operating system: Windows and Android

State of relevant entities

n/a

Problem-relevant configuration

see steps to reproduce

Javascript errors shown in your browser console/inspector

n/a

Additional information

@skylyn skylyn added the Bug Current Bug in UI - Extra Attention label Aug 20, 2020
@jasonalsing
Copy link

Wow I think we were writing these at the same time: #6665

@seblu
Copy link

seblu commented Nov 10, 2020

I was hit by this issue recently. As I'm only looking for a state swap I replaced:

      - condition: state
        entity_id: light.bathroom
        state:
        - 'on'
        - 'off'
        for: 2

by

      - condition: template
        value_template: '{{ (now()-states.light.bathroom.last_changed).total_seconds() >= 120 }}'

to prevent any breakage when saving automation.

@github-actions
Copy link

github-actions bot commented Feb 8, 2021

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Feb 8, 2021
@skylyn
Copy link
Author

skylyn commented Feb 9, 2021

This is still an issue.

@github-actions github-actions bot removed the stale label Feb 9, 2021
@regoras
Copy link

regoras commented Feb 11, 2021

Was just reminded of this issue as I re-saved an automation and the trigger states got globbed into a string instead of a list again. Continues to occur in core 2021.2.2.

@aschor
Copy link

aschor commented May 10, 2021

Hi, the same happens for "to: " triggers . the UI converts a trigger

    to: 
      - error
      - complete

to

    to: 'error,complete'

and then off course the automation will never trigger.

@Plawasan
Copy link

Still broken in 2021.6.6

@svkurowski
Copy link

Hello, I'm impacted by this as well in 2021.8.6.

@titiviking
Copy link

titiviking commented Oct 26, 2021

Still broken in 2021.10.6

It is getting a real issue, as i need to start breaking down into OR-conditions... it's messy

@github-actions github-actions bot locked and limited conversation to collaborators Nov 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.