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

Issue with multiple Selector types when using "Add Field" in Script Editor. #21997

Open
4 tasks done
Didgeridrew opened this issue Sep 16, 2024 · 8 comments
Open
4 tasks done

Comments

@Didgeridrew
Copy link

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.
  • I have tried reproducing the issue in safe mode to rule out problems with unsupported custom resources.

Describe the issue you are experiencing

When adding Fields using the Visual Editor for Script, an {} is inserted after the selector type key instead of null.

Example:

image

This causes the script to error and become unavailable. Many Selector types require further configuration using the YAML editor, but some do not require it and a few do not have any options beyond their key, so switching the the YAML editor to delete the {} should not be required.

Describe the behavior you expected

If additional configuration is not required by the Selector, just choosing the selector type should be sufficient to have a working field variable.

Steps to reproduce the issue

  1. Start a new script in the script editor.
  2. Add a Field using the "Add Field" button or Menu item
  3. Pick a selector from the Selector drop down menu. Most will work... but the 12 key-only types, like Template, Action, or Date definitely will.
  4. Add any action in the sequence.
  5. Save the script.

What version of Home Assistant Core has the issue?

2024.9.1

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Firefox 130.0, Google Chrome 128.0.6613.137

Which operating system are you using to run this browser?

Pop!_OS 22.04 LTS

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

@karwosts
Copy link
Contributor

What exactly is the script error you are seeing?

I'm trying this but I don't see any errors, don't see any problem with having empty brackets there.

alias: Entity Selector
sequence:
  - action: logbook.log
    metadata: {}
    data:
      message: Test Message
      name: test
fields:
  example:
    selector:
      entity: {}
    name: Example
    description: Example Description
description: ""

@AdarshPandey-07
Copy link

@Didgeridrew check again is the issue still persisting, if yes I would like to contribute.

@Didgeridrew
Copy link
Author

Didgeridrew commented Sep 18, 2024

What exactly is the script error you are seeing?

The script setup fails with the following:

The script "zTest data field" (script.ztest_data_field) is not active because the configuration has errors.

Error:Only one type can be specified. Found for dictionary value @ data['fields']['testent']['selector']. Got OrderedDict().

To fix this error, [edit the script](https://johns*****.***/config/script/edit/ztest_data_field) to correct it, then save and reload the script configuration.

And the system logs show:

Logger: homeassistant.components.script
Source: components/script/config.py:147
integration: Script (documentation, issues)
First occurred: 11:50:31 PM (1 occurrences)
Last logged: 11:50:31 PM

Script with alias 'zTest data field' could not be validated and has been disabled: Only one type can be specified. Found for dictionary value @ data['fields']['testent']['selector']. Got OrderedDict()

Updated to 2024.9.2, and the issue persists.

@karwosts
Copy link
Contributor

Can you post the entire complete script that has this error (yaml not screenshot?)

@Didgeridrew
Copy link
Author

alias: zTest data field
sequence:
  - action: persistent_notification.create
    metadata: {}
    data:
      message: "{{testent}}"
      title: This is a Test
fields:
  testent:
    selector:
      entity: {}
    name: TestEnt
description: ""

@karwosts
Copy link
Contributor

karwosts commented Sep 18, 2024

Hmm strange that works perfectly for me. It says the same in safe mode?

image

image

@Didgeridrew
Copy link
Author

Yes, I get the same repair message and error in the system log in Safe Mode.

@karwosts
Copy link
Contributor

Hm sorry I'm stumped then, can't reproduce. 🤷

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

No branches or pull requests

3 participants