Basic tutorial on automation (scripting, templates, blueprints, ...)

I’m migrating from Homeseer, which uses VB as their scripting language. I’m pretty computer sophisticated, but having problems getting started in HA. I’ve looked at the HA Help section, and found a few youtube tutorials (but unfortunately, HA must have changed enough in the last year that the steps don’t really match anymore).

Is there someplace with a tutorial that covers the various tools for automation and how to create them in the current version of HA?

Hi Dan, there is not really an official tutorial but have you looked at the documentation → Automating Home Assistant - Home Assistant

I have never used Homeseer so I have no clue how that works.
Automations in HA are quite simple IMHO but maybe your problem is to think differently from your current knowledge.
From Settings (side bar, cogwheel) → Automations & scenes, you can create automations through the webUI without any programming knowledge.
If your familiar with computers, this shouldn’t be difficult.

For simple automations, that’s true. But I want to do more complicated things. For instance, one of the things I want to do is have a script that increases the current set point of my z-wave thermostat in one direction is it’s set to cooling, and in the opposite direction if it’s set to heating. It appears I can create a template to query the device for the current cooling/heating state, but then wiring that into my script isn’t obvious.

And yes, I spent time with the doc, but I really need a 10,000 foot view of the various automation/script/scene/blueprint/template architecture.

Keep in mind that HA works with tens of thousands of devices and more than 2500 different integrations, so it can be hard to provide a general tutorial. If your thermostat breaks out the set point as a number entity (or you do it yourself by setting up a Template Number) you can do that without any templating in the automation/script, just an If/Then action that calls the number.increment or number.decrement actions based on the thermostat’s state.

That being said, gaining a solid understanding of how templates work in HA is one of the best ways to get to the point where you can create complex and flexible automations.

1 Like

The problem is more general than what integrations are supported. In Homeseer, there was a pretty simple model, if you just wanted to do a simple thing (control a device based on a condition) you could do that directly. For more complicated scenarios, you wrote a script.

In HA, there are automations, scenes, scripts, blueprints and templates, and you can create them via a UI or by modifying the YAML directly. What I’m looking for is how are these various items related. When can you use one versus the other, how can you wire up the various items, when can you use the UI and when do you need to edit the YAML.

I understand that Homeseer is a much more mature product, and is a commercial product with support staff, but there were a lot more samples of ways to do things.

I guess there really isn’t what I’m looking for, a higher level description of the various forms of automations, how they’re related, how they can be connected, etc. Or a body of samples of how to do various things.

But a boy can dream.

  • A blueprint allows its author to share an automation with end-users that can be easily configured by the end-user (a blueprint includes a form that, when completed by the end-user, produces a customized version of the original automation).

  • A template isn’t in the same category as scenes, scripts, automations or blueprints. It’s a means of dynamically computing a value, using Jinja2, and is optionally employed within a script, automation or blueprint.


If you want something to happen when an event occurs, you use an automation. Its triggers section is where you define what it should monitor/detect, its optional conditions section lets you provide additional constraints (i.e. like within a specific time period) and its actions section is for what should happen (additional logic can be added here, like do this action only if whatever is true).

If multiple automations perform similar actions (i.e. code duplication), those actions can be centralized in a script and then the automations can call the script. The automations can pass variables to the script.

If you have something like a Button Card and, when tapped, you want a series of actions to be performed, you put them in a script that’s called by the button.

1 Like

You may also want to check out the Cookbook Index where we have been building and collecting subject-specific write-ups and collections of examples.

Thanks for much for this! I think this will give me a good start on doing what I want to do.