frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Automations: shorthand conditions are not supported by (and can "crash") UI editor [2022.9.0b6]

Open kulmegil opened this issue 2 years ago • 3 comments

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.

Describe the issue you are experiencing

"Shorthand" template conditions are not supported by updated UI editor and can cause serious issues when placed in the root of actions: or conditions: block

If it's placed in the root of conditions: / actions: then entire list becomes invisible and uneditable from UI.

If it's placed inside choose: | if: action nor and: | or: | not: condition it will not display actions/conditions list for that block only and will prevent adding new ones from UI.

They cannot be placed inside parallel: (or parallel: > sequence: where it makes more sense) action at all - that might be a separate issue.

Describe the behavior you expected

"Shorthand" template conditions are not supported by UI editor.

Steps to reproduce the issue

  1. Create or edit automation
  2. Enter YAML mode
  3. Create shorthand template condition

What version of Home Assistant Core has the issue?

core-2022.9.0b6

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Google Chrome 105.0.5195.102, Mozilla Firefox 105beta, Android mobile app 2022.8

Which operating system are you using to run this browser?

Windows 10, android 11

State of relevant entities

No response

Problem-relevant frontend configuration

alias: 2022.9.beta - shorthand test
description: ""
trigger: []
condition:
  # will affect only "or:" condition block
  - or:
      - "{{ true }}"
      - "{{ true }}"
  - and:
      - "{{ true }}"
      - "{{ true }}"
  - not:
      - "{{ true }}"
      - "{{ true }}"
  # putting one in the root will crash entire conditions list
  - "{{ true }}"
action:
  - if:
      - "{{ true }}"
      - "{{ true }}"
    then: []
  - choose:
      - conditions:
          - "{{ true }}"
          - "{{ true }}"
        sequence: []
  - parallel:
      - sequence:
           # cannot be added inside parallel: at all
         - "{{ true }}"
         - <action>

Javascript errors shown in your browser console/inspector

Uncaught (in promise) TypeError: WeakMap key must be an object, got e
    value https://my.home-assistant.io/frontend_latest/3664b061.js:1993
    value https://my.home-assistant.io/frontend_latest/3664b061.js:1943
    dt https://my.home-assistant.io/frontend_latest/4201eade.js:2
    update https://my.home-assistant.io/frontend_latest/4201eade.js:2
    _$AS https://my.home-assistant.io/frontend_latest/app.ef7cfda5.js:1249
    D https://my.home-assistant.io/frontend_latest/app.ef7cfda5.js:1249
    _$AI https://my.home-assistant.io/frontend_latest/app.ef7cfda5.js:1249
    m https://my.home-assistant.io/frontend_latest/app.ef7cfda5.js:1249
    T https://my.home-assistant.io/frontend_latest/app.ef7cfda5.js:1249
    _$AI https://my.home-assistant.io/frontend_latest/app.ef7cfda5.js:1249
    S https://my.home-assistant.io/frontend_latest/app.ef7cfda5.js:1249
    update https://my.home-assistant.io/frontend_latest/app.ef7cfda5.js:1249
    performUpdate https://my.home-assistant.io/frontend_latest/app.ef7cfda5.js:1249
    scheduleUpdate https://my.home-assistant.io/frontend_latest/app.ef7cfda5.js:1249
    _$EC https://my.home-assistant.io/frontend_latest/app.ef7cfda5.js:1249
6 3664b061.js:1993:697

Additional information

No response

kulmegil avatar Sep 07 '22 13:09 kulmegil

You are exposing your external HA url in the error message, you might want to remove that.

And I would say that if you want to use shorthand notations, it's best to split your config, and move them outside automations.yaml. The GUI uses the full notation when you create them there. But I'm not a HA dev, just my 2cents.

TheFes avatar Sep 13 '22 14:09 TheFes

@TheFes upsie, good thing it's behind vpn then. Agree however editor used to handle any notation, it just converted it into full notation. We have regressed.

kulmegil avatar Sep 14 '22 11:09 kulmegil

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[bot] avatar Dec 13 '22 12:12 github-actions[bot]