How To Use SCRIPTS In Home Assistant - TUTORIAL

preview_player
Показать описание
Using SCRIPTS in Home Assistant can be very powerful. With scripts you can combine multiple actions in one script so that you can execute all these actions at once. Scripts look a lot like automations, but come in handy when you want to execute the same commands from a button, multiple automations, or other scripts. A script is different than an automation in Home Asisstant, but helps in getting repetitive tasks done more easily.
This tutorial explains how scripts work and how you can create your own script from scratch. Furthermore, it gives you more insight into how Home Assistant works and how you can develop your own scripts.

I created an update of this video here: Mastering Scripts in Home Assistant: A Comprehensive Guide

⭐⭐⭐
I cannot do this without your support!
If my videos save you time, you can support me in the following ways:

⭐⭐⭐

See the list of Smart Home devices that I use and recommend here:

If you got enthusiastic about Home Assistant, you can watch these videos too:

Background music composed and produced by Smart Home Junkie

Contents:
0:00 Introduction
0:20 General description
0:59 Create first script
3:59 Create lovelace button to trigger the script
5:46 Create automation for the script

#homeassistant #homeautomation #iot #smarthome
Рекомендации по теме
Комментарии
Автор

I created an update for this video here: Mastering Scripts in Home Assistant: A Comprehensive Guide

SmartHomeJunkie
Автор

Where have you been hiding???? I've searched hi and low for simple instructions to HA and all of the other U-Tubers only seam to show how smart they think they are. You video is a very precise, educational and perfect instructional you!

CB
Автор

Very useful, thanks for doing the video.

newportmeister
Автор

Nice, now I have to make scripts for some automations I made that aren't actually automations.

JasperTielen
Автор

Nice tutorial. Do you have realized something more related to how to write a script? I mean, from the documentation, they seem like a straightforward programming language. It could be interesting having a quick view of their possible functionalities.

LucaMannella
Автор

Imho are the examples shown here more like scenes. They are static without control structures like if-then-else or loops. I want a lightbulb in my garden act like a lighthouse (blink in a certain way) and have no idea, how to program that. In general it's something like "loop: - turn on light - wait 3 sek - turn off light - wait 2 sek - end of loop"

JottyHB
Автор

Great tutorial, keep up the good work!

bertbruinsma
Автор

Thanks for your videos. But as a newbie on this I still dont see the need for scrips? Seems easier to just go for Automations all along. For light off just use service "Light Turn Off" and then at the bottom at Targets select either what Areas, Devices or entitys you want to include in the automation. And I guess Buttons can trigger automations as well? But still thanks for your video, have always been wondering what Scrips are :) Btw, do you have a video where you go trough all your automations? Would be cool for inspiration :)

Gladers.
Автор

Thanks a lot for all your great Videos!

sebastian
Автор

A great video. I create scripts and save them but it doesn't show any scripts in the list. It is located in the directory /cofig/scripts.yaml file editor. Please help. Thanks!

ngoctaiquach
Автор

Do you have any examples about using Scripps with the Harmony hub? I’m trying to get an activity to run at a specific time thanks

arizonaniceguy
Автор

Can I follow this vid to the T and be able to do this stuff? If I have different smart products?

InSaiyan-Shinobi
Автор

What version of HA was this taught on. It appears that in the latest version (Synology Docker version) I can create the Scipts and Automation within the same entity. I’m not familiar with the command line editing and boxed myself into a failed corner. Had to delete HA within the Docker platform and start all over ( once again “cockpit error)😡. But, I love the learning process.😜

CB
Автор

Excellent introduction to scripts, thanks.
If meant as a tutorial, I do wonder why you use a 'fully loaded' system, rather than a simpler (student view) one?
Are you just showing off your setup?

DavePawson
Автор

I'm trying to create a script that receives an entity_id as a parameter to the script to be used in conditions etc. However, I can't get this to work. It would be great if you could do some advanced scripting tutorials?

My script ends up with an error
Message malformed: Entity {{ climate_entity }} is neither a valid entity ID
when trying to save it...

dietherdeconinck
Автор

Can you make a script that plays a video on a Chromecast device ?

TwanJaarsveld
Автор

Great tutorial! In minute 4:20 you have a group of light bulbs in the lovelace on right upper corner called "office back" . It seemts you can dim three entities at the same time...How can I do this? I can only dim one dimmable entity at one time. That`s not what I want.... I want to control more than one dimmable entities with one dimmable button like your "office back".

timow
Автор

Is there a way to run a script when homeassistant restarts or is restarted

ianrobson
Автор

I have a *nix background and my idea of a script is that it fulfills a prescribed task but can take different arguments to operate . Would that be possible?
E.g. at 8h00 I want to do a certain set of actions for switch 1, at 12h00 the same actions for switch 2 and at 16h00 again the same action but now for switch 3 .

gerardschepers