自动化

来自Domoticz
跳转到导航 跳转到搜索

编辑中

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


简介

自动化您日常生活中的某部分是Domoticz的核心。本页概述了不同的自动化方法和一些配置及使用资源。

脚本类型

我将讨论您可以配置脚本/事件触发的不同区域,以便您了解可以完成的任务。重要的是,这些脚本会经常运行,所以你想要启动你的脚本前请做一些检查,看看你是否需要运行它。我会尝试提供示例。

事件 Events

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.
UserVariable
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

Action Scripts

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

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.

Notifications

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.

Languages

Blockly

Blockly allows you to write basic automation via a gui and is a great way to get started however it's power is fairly limited.

In Domoticz if you click on Setup -> More Options -> Events you'll get to the blockly gui which will allow you to create

LUA

Using a common and well documented scripting language. Works in the exact same way that Blockly does

Bash

Perl

PHP

Python