Morning all
I’ve created a script test.yaml which will send a test pushover message. How can I either run that from CLI or even better add to the UI Lovelace so I can trigger on/off each time
Many Thanks
Morning all
I’ve created a script test.yaml which will send a test pushover message. How can I either run that from CLI or even better add to the UI Lovelace so I can trigger on/off each time
Many Thanks
What have you tried?
Add an entities card. Add your script tot he entities card.
Hiya
I’ve created the script below
script:
test_pushover:
alias: 'test_pushover'
sequence:
- service: notify.notify
data:
title: TEST ALERT!
message: This is a test message!
data:
url: https://i.pinimg.com/originals/c1/55/a1/c155a1b393899ffd7c36ff01090ce8f5.jpg
The question is how do I run this via the UI with a toggle switch. I’m trying to learn more about HA and running scripts like this which I can quickly test.
I’ve created a new Entitie card but not sure where I paste the code into it. I have the toggle switch but can work out how to call my script “test.yaml”
Thanks
You don’t.
Edit your entity card, use the drop down list to select your script (script.test_pushover).
Save the card and exit the UI edit mode.
You now have a card with your script and the word EXECUTE next to it. Clicking on the EXECUTE text runs your script.
Hi Tom
I’m still not getting it. I was using the drop down list but my script isn’t there
Its saved in /config directory is that the right place to save them
Did you do a configuration check and reload scripts after writing your script?
Yes
If I create a .sh script I can see it listed but I’ve created a .yaml file and these don’t appear to be listed
You need to either write your script yaml in configuration.yaml or use !include to include a scripts.yaml file (or files).
If it is a seperate file in a folder add:
script: !include_dir_merge_list {foldername}
If its only one file add:
script: !include includes/test.yaml
That’s correct.