The first time I attempted to use a duration selector in a script, it worked. Then I made some changes to the script, and it no longer works, even why I try to undo my changes. Is there anything special one needs to do? I’m just trying to create a momentary pushbutton script like this:
alias: Momentary Switch
fields:
entity:
name: Target entity
description: The switch to activate momentarily
selector:
entity:
domain: switch
required: true
duration:
name: Duration
description: Time for which to activate the switch
required: false
default: 0.25
example: 0.25
selector:
duration:
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: "{{entity}}"
- delay: "{{ duration | default(0.25) }}"
- service: switch.turn_off
data: {}
target:
entity_id: "{{entity}}"
mode: parallel
icon: mdi:gesture-tap-button
description: Momentarily activate a switch
max: 10
It got the point that I was wondering if there was a bug in homeassistant, but I even restarted homeassistant and restarted my browser, also tried my phone. No matter what I do I can no longer get the duration selector to come up in the services screen when I try to invoke my script. Sometimes homeassistant seems to add a null on the selector line, as in duration: null, but whether I leave that or try something else, I never get the ability to enter a duration in UI mode, only a checkmark for whether I want to include it.
I cut and pasted your exact code into my script editor, and it still didn’t work. Then I restarted homeassistant and logged in using private-mode browsing, just in case something weird was cached. Still I don’t get any inputs!
What’s crazy is that the first time I did this, I did get an input field. And then just by editing that script inside homeassistant’s web editor (I wasn’t even editing the raw scripts.yaml file), I did something that seemed to permanently break my homeassistant. I don’t know what else to try.
Okay, if I go to the script editor and save my script, then immediately navigate to developer tools and services, it works. But, if I then re-load the web page, or visit it in another tab or browser profile, it no longer works. So this seems to be some sort of bug in homeassistant that was driving me crazy!
I’ve seen the same thing, but it seems to be limited to the Services tool. In the automation or script editors the duration selector shows up every time.