Mi first automation

Hello all

I am new to HA and this is a very steep learning curve for me.

Currently I am running my limited house automation on Vera. I have decided to migrate to HA supervised on a debian 10 laptop. Installed and configured all works fine (until I break it)
This week I added an aeotec gen 7 zstick. I migrated to it a smart plug and a sensor to HA and they work fine. I finally got working the WOL switch.

So now I have a smart plug connecter to my amp (as a switch) nand configured the WOL to turn on the HTPC.

I can turn on the HTPC and the amplifier from HA

So yesterday i decided to create my first automation with these 2 switches

one is called McIntosh and the other HTPC.

I created a new automation called “turn stereo on”

In creating the automation

I added as an entity the WOL

I have Mode=single
enable/disable automation i switch to on

no triggers
no conditions

action type= call service
selected switch turn on
targets selected HTPC
delay 7 seconds
action type=call service
selected switch turn on
target selected Mcintosh

At the top right hand corner if i click run action the automation and the sequence works fine.

I restart HA

When I add this automation to the dashboard and try to run it it does not work

I go back to the edit the automation and see that the enable/disable automation i switch to off

I switch it on again and via the automation run action tab it runs.

I selected to he correct switches…

Am I missing a step?

Thank you for taking the time to respond to this simplistic and probably obvious question

For automations?

Yes. They must have triggers to be valid.

If you just want to execute a sequence of events without it being triggered, use a script.

1 Like

Thank you for responding so quickly this is greatly appreciated

If i understand you correctly I need to create in scripts
a script for called WOL and a script called HTPC (which I did)

I ran each script individually …and they ran excellent
I changed the integration and ketp the WOL identical and changed 2nd action type to device and selected McIntosh
and for action I selected turn on McIntosh from the dropdown menu

I clicked on run action and it worked yuppie

Now to the lovelace

I have a card called media

in there
Media with an on/off slide this turn on/off all components of the card
I HTPC with an on /off slide this turns on the HTPC via WAL and it works
McIntosh with an on/off slide this turn on/off the amplifier and it works
turn stereo on with an on/off slide (this is the automation) it does not turn on/of

However I i click on this entry “turn stereo on” a card pops up which gives me the option to run the action .

If i select this the automation runs perfectly

Why does it not run when i use the slider?

thank you for your patyience

I would highly recommend sharing some code with us.

You’re stating you have the new script for “turn stereo in there” but how?

A button card like this would work but only if the script is working properly:

type: button
tap_action:
  action: call-service
  service: script.your_script
show_name: true
icon: mdi:food-apple-outline

Hello Thank you for your very quick reply

here is a copy of the file for this automation
id: ‘1629134163492’
alias: turn Stereo on
description: try to turn on McIntosh plug
trigger: []
condition: []
action:

  • service: script.wake_on_lan
  • delay:
    hours: 0
    minutes: 0
    seconds: 7
    milliseconds: 0
  • type: turn_on
    device_id: a90188f4aa020764b6b551e7cbe1da05
    entity_id: switch.mcintosh
    domain: switch
    mode: single

I am also understanding that the outline you are sharing would look like this for me?
type: button
tap_action:
action: call-service
service: Automation: Turn on
target:turn stereo on
show_name: true
icon: mdi:amplifier

Is this correct?

The automation you created lacks a trigger. Without a trigger, it’s a useless automation.

What was suggested was to create a script, not an automation without a trigger.

Hard to say because you posted unformatted YAML. Proper indentation is important for YAML and that’s why it must be posted with formatting. It’s explained in Guideline 11 of the forum’s FAQ.

Please use image for your code to show properly to show if the indentation is right.

If you can confirm that you script is running when shot by image you’re half way there.

Check what the real name of your entity is, the provided code look like you choose the following:
image

Instead you should scroll all the way down the list entry that beging with “Script:” an choose the script you want to use so the code will look like what I posted the first comment.

Thank you for your quick reply

Sorry for the lack of indentation however in the yaml the text is properly formatted (because it was done automatically (not by myself))
I have a script to turn on the HTPC and a script to turn on/off the amplifier and they work beautifully.

The reason i chose the automation is because the amplifier MUST be started a few seconds later because during it’s start-up the htpc sends a distorted signal to the amplifier

The point is that you just posted a pile of unformatted YAML when the forum’s guidelines recommend you post it as formatted YAML. Reading unformatted YAML is no pleasure.

Thank you once again for the quick reply and for putting up with my ignorance.

I used the fields as shown in the above picture. and as for target i chose the mcintosh called script.turn_on_mcintosh

IMHO the automation works Because when i select run action the automation perform beautifully

This is why i am hung up on getting the button on Lovelace card to work

Just for your information :
For the moment i have 2 automation on vera turn stereo on for my multi media (and an off button for the amplifier)

and an automated HVAC system base upon time of day internal temperature and presences.

All of this is controlle3d automatically or by voice using alexa.

Is that how you always plan to execute this triggerless automation? By clicking its RUN ACTION button in the UI?

Do yourself a favor and compose it as a script, just like it was suggested by tom_l.

Then you can modify the Button Card to call the script. Done; easy-peasy.

1 Like

Hi all

I did build the scripts as was mentioned. I still need to learn how to change the button

what can i say i’m becoming lazy in my old age. Because HA is a st5eep learning curve for me I like to do things in baby steps.

Both the scenes that i have will that control the media environment and the HAVC will eventually have triggers such as time of day, temperature geofencing to name a few.

I hope to eventually build scenes that will control lights in the house based upon motion sensors and time of day.in addition to on/off i would include dimming function the media room and as night light.

Hello all

as an update

I did add a time trigger to my first automation (turn Stereo on) and it worked flawlessly.

However that same automation does not respond to the button in the overview page.

Will this be an issue when i integrate alexa?

In the same vane when building an integration there is a slider button enable/disable automation.

does this button run the automation or does it mean that the automation is active. Because when i slide this button to enable it also slides the button on the Lovelace dashboard
If the enable/disable automation button is to make available the automation it should not activate the the automation. (in vera this was a 3 step process create the scene - activate the scene and run the scene

Is this concept still applicable in HA?

Again thank you all for all your patience with me and teaching and guiding me through this process

RodgerDodger posted an example earlier showing how a Button Card can be configured to call a script.

That button is to enable/disable the automation. It isn’t used to execute the automation. The automation’s trigger determines if and when the automation’s action is executed.

@123 thank you very much

I tried to include the script for the button in the script.yaml. The config did not work I will deal with it tomorrow morning (it’s a matter of correct formatting and syntax).

And thank you for clarifying the e3xecute automation button

once again thank you