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

Script field defaults are not used in frontend #20182

Open
4 tasks done
thomluther opened this issue Mar 25, 2024 · 1 comment · May be fixed by #20747
Open
4 tasks done

Script field defaults are not used in frontend #20182

thomluther opened this issue Mar 25, 2024 · 1 comment · May be fixed by #20747

Comments

@thomluther
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 Field descriptions with selectors are used for service or blueprints, the default: value is typically pre-filled in the field when the field is selected (in case its optional).
However, the script fields in the More Info dialog does not seem to get populated with with the default value in case defaults are defined.

Describe the behavior you expected

I think that is a usefull feature to allow defining defaults for the script input fields and reduce the fields that must be filled in by user.
This should work the same way as for blueprint and service forms

Steps to reproduce the issue

1 script with field definition. UI also supports setting the default value:
fields:
service:
required: true
name: Service
default: anker_solix.update_solarbank_schedule
selector:
select:
mode: dropdown
options:
- label: Set schedule
value: anker_solix.set_solarbank_schedule
- label: Update schedule
value: anker_solix.update_solarbank_schedule

  1. When creating a lovelace entity card with the script as entity, the More Info Dialog does not pre-fill the field with the default value

What version of Home Assistant Core has the issue?

2024.3.3

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Firefox 124.0.1 (64-bit)

Which operating system are you using to run this browser?

Windows 11

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

@zhudhjen
Copy link

zhudhjen commented Apr 9, 2024

I encountered the same issue about that the default values are not populated for script fields. Especially for numbers with sliders, it appears that the field is populated with value 0, but the field would be undefined when running.

What it looks like:
script_fields

The error message:

Failed to call service script/announce_tts. Error rendering data template: UndefinedError: 'volume_adjustment' is undefined

The script is here.

@karwosts karwosts linked a pull request May 7, 2024 that will close this issue
9 tasks
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 a pull request may close this issue.

2 participants