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

0.114 Beta - Script and Automation Editors - Entire Choose section switches to YAML mode when typing data for service call #6577

Closed
3 tasks done
gadgetchnnel opened this issue Aug 9, 2020 · 7 comments
Labels
Bug Current Bug in UI - Extra Attention

Comments

@gadgetchnnel
Copy link

gadgetchnnel commented Aug 9, 2020

Checklist

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

The problem

When adding service data to a Call service which has no data, the entire Choose section switches to YAML mode as soon as the first letter of the option name is typed:

image

Expected behavior

Only the action should switch to YAML mode, looking similar to the mockup below:

image

Steps to reproduce

  1. Create a script, like the example below:
choose_test:
  alias: Choose Test
  mode: single
  sequence:
  - choose:
    - conditions:
      - after: sunrise
        before: sunset
        condition: sun
      sequence:
      - entity_id: light.bedside_light
        service: light.turn_on
    default: []
  1. Edit the script in the UI.
  2. Add brightness_pct: 20 to the service data for the light.turn_on call.
  3. As soon as "b" is typed the entire Choose section will show as the second screenshot, with the error message: The value of "data" is not supported by the UI editor, we support "Object" but received ""b"".You can still edit your config in yaml.

Environment

  • Home Assistant release with the issue: 0.114.0b3
  • Last working Home Assistant release (if known):
  • Browser and browser version: Google Chrome 84.0.4147.105
  • Operating system: macOS Mojave 10.14.6

State of relevant entities

Problem-relevant configuration

Javascript errors shown in your browser console/inspector

Additional information

@gadgetchnnel gadgetchnnel added the Bug Current Bug in UI - Extra Attention label Aug 9, 2020
@gadgetchnnel gadgetchnnel changed the title 0.114 Beta - Script and Automation Entire Choose section switches to YAML mode when typing data for service call 0.114 Beta - Script and Automation Editors - Entire Choose section switches to YAML mode when typing data for service call Aug 9, 2020
@Skeletorjus
Copy link

I get this in all actions, not limited to choose.

An example is a Call service action with light.turn_on.
As soon as a letter is entered in the Service data-field, the editor switches to yaml mode with the error message shown in OP.
Funny thing is that if the correct values are entered in yaml-mode, it is possible to switch back to UI-mode and everything is fine again and editable in UI.

@gadgetchnnel
Copy link
Author

Yes, it is similar in other actions but with those it is only the individual action which changes to YAML mode. With Choose, typing service data in any of of the nested actions within the Choose causes the whole Choose section to switch to YAML mode (not just the individual action).

For example, I have an automation with a Choose which has 4 options each with a condition and an action. Typing service data for any of those caused the whole Choose section to turn to YAML mode and not just the individual action.

The only workaround is to switch that action to YAML mode before entering the service data - you can manually switch an individual action to YAML mode, it's just that the error doesn't do this.

@asystentka-jolka
Copy link

I have the same in 0.114.3 (in 0.113.3 it works OK)
looks like regresion bug after #6436

@ZuluWhiskey
Copy link

I get this error also, as already said the scripts aspect is irrelevant.
To replicate all I need to do is create a new automation in the UI, create an action to call a service, for example media_player.volume_set and then in the "Service data" section if I attempt to type volume_level: I get the error as soon as I type the first letter (ie. "v")

Service and entity selected, all that's left to do is type in volume_level: x into the circled Service Data section
image

This image then shows the error as soon as the first letter has been typed: image

I can get around this issue by pasting the data into the "Service Data" box (I'm assuming some validation is done and by doing it this way, all text is there instantly so no error can occur). This can also technically be "fixed" by formatting the data in the UI with correct YAML and then selecting the three dots in the corner and selecting "Edit with UI" so that the error doesn't persist.

@DanielWinks
Copy link

DanielWinks commented Sep 2, 2020

I came here to make sure this issue has been reported, and also I can confirm a second work-around exists, for those who might prefer it:

If you're trying to type message: "My message here" into the service data box, you'll run into this issue the moment you type "m". However, if you instead type {message: "My message here"} it'll work just fine. If you need multiple items in that dictionary, you can just separate them via comma, {message: "My message here", title: "My title here"}

Apparently this issue isn't triggered if you use JSON instead of trying to type YAML.

And as soon as you save this JSON, it'll reformat it back to YAML, too.

@ZuluWhiskey
Copy link

I came here to make sure this issue has been reported, and also I can confirm a second work-around exists, for those who might prefer it:

If you're trying to type message: "My message here" into the service data box, you'll run into this issue the moment you type "m". However, if you instead type {message: "My message here"} it'll work just fine. If you need multiple items in that dictionary, you can just separate them via comma, {message: "My message here", title: "My title here"}

Apparently this issue isn't triggered if you use JSON instead of trying to type YAML.

And as soon as you save this JSON, it'll reformat it back to YAML, too.

This really helps, I don't leave the curly brackets in but instead I write {message: and then delete the { as message: is valid. Obviously not a fix but a very useful work around until it is fixed!

@bramkragten
Copy link
Member

This is fixed in 0.115

@github-actions github-actions bot locked and limited conversation to collaborators Jul 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Current Bug in UI - Extra Attention
Projects
None yet
Development

No branches or pull requests

6 participants