WORK IN PROGRESS
I'm going to attempt to make this page more useful by adding details on configuration and use of each automation method. The details about the script library have already been moved to the "scripting" section and have been removed from here. I will say I don't fully know all of these topics so I will do the best i can but would love feedback/corrections. I will will mark anything I am uncertain about with (validation)
Also I randomly came across this page, which has a lot of the info that will end up in here. It just seems to be buried since it's the first time i've seen it! https://www.domoticz.com/wiki/Domoticz_and_Scripting
Automating small parts of your daily life is the core of what Domoticz is about. This page gives an overview of different methods of automation and some resources for configuration and using.
I'm going to break this down by the type of script.
I'm going to talk about the different areas where you can configure scripts/events to trigger so you have an idea of what can be done. It is important to note that these scripts run OFTEN so you'll want to start your scripts with some checks to see if you should run. I will attempt to provide examples.
Domoticz allows you to write simple Blockly or LUA scripts right in the gui and can be access by going to:
Setup -> More Options -> Events
You have a couple of options here that have a rather large impact on how the script runs. I'll walk through those options starting in the top right.
- Event Name
- This is just the title of the event, give it something useful such as "Fan Timer"
- Script Method
- Here you have a choice of Blockly or LUA, basically gui vs text. You'll get more power with LUA but blockly is a great place to start!
- Event Type
- This one is really important, it determines what triggers the event
- All - This script is triggered on all event types, be careful with this one since it's triggered so often it could have an impact on system performance
- Device - This is triggered when a device is changed and will probably be your most commonly used type
- Security - When a user triggers a security event such as arming or disarming the system. Also it's important to note that it's triggered after the timer has finished counting down.
- Time - An event is triggered every minute on the minute.
- Event Active
- This is just used to enable or disable the script.
Please see the language details on how to use either of these scripting methods.
Devices (Switches) have an On Action and Off Action option that allows you to run a script either via a URL or via the script folder. This will be discussed in the language section. To get to these you need to edit a switch.
Timers dont allow you to do anything complex but they are helpful for a handy on/off timer and I over looked them to start so I'll mention them here! As it stands you don't have an option for using LUA or Blockly with these types of scripts (Validation) This option is available on the Switches screen when you select a switch to work with.
There are a great selection of notification types so it's possible to do some interesting things with this but chances are any of those interesting things should go under the action scripts. This option is available on the Switches screen when you select a switch to work with.
Getting started with Blockly
Using a common and well documented scripting language. Works in the exact same way that Blockly does