Scripts
本页提供了有助于您获取和使用Domoticz数据的脚本和代码段。
一旦你有了数据,你可以实现自动化处理。具体脚本和逻辑可以在自动化部分找到。
将你的脚本添加到此页面
我们强烈建议你将你写的脚本添加到此页面!登录论坛后会自动登录到Wiki,当然你也可以直接在论坛中发布脚本或教程。
请按一下格式发布你的脚本: 脚本语言 - 简短介绍 例如 "Lua - 自动打开车库门" 或 "Bash - 没有人在家时关掉灯"
通过在标题周围放置双方括号[],Wiki会自动将其转换为指向新的空wiki页面的链接。
模板
在新的脚本页面中,请写入以下相关内容:
- 目的
- 依赖 - 硬件、软件、操作系统等
- Domoticz设置 - 开关、变量、版本要求等
- 安装说明
- 带注释的脚本
- 使用说明
- 相关论坛帖子连接
你可以使用<syntaxhighlight lang="python"> 代码 </syntaxhighlight>标签来高亮显示你的代码。
所支持的语言请查看: https://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Supported_languages
分类
为了使其他人更容易找到您的脚本,请使用以下类别约定。
从以下树中选择正确的分类,如果您在树中选择较低的项目,如“电视”也包括树中较高的类别。 将他们放到wiki页面底部。
例如,你在电视分类中创建Wiki页面,从而添加“电视”类别,您还可以添加更高的类别“媒体”和“硬件”。
Domotics:
[[Category:Domoticz]] (选择一个或更多)
[[Category:手册]]
[[Category:安装]]
[[Category:设置]]
硬件:
[[Category:硬件]]
[[Category:家用电器]]
[[Category:厨房]]
[[Category:灯光]]
[[Category:媒体]]
[[Category:AV]]
[[Category:TV]]
[[Cetegory:CEC]]
[[Category:Audio]]
[[Category:安全]]
[[Category:Alarm]]
[[Category:Camera]]
[[Category:Keypad]]
[[Category:Motion]]
[[Category:Utility]]
[[Category:Gas]]
[[Category:Heating]]
[[Category:Power]]
[[Category:Water]]
[[Category:环境]]
[[Category:室内]]
[[Category:天气]]
协议:
[[Category:MQTT]]
[[Category:Bluetooth]]
[[Category:HTTP]]
脚本:
[[Category:脚本]]
[[Category:Bash]]
[[Category:Batch]]
[[Category:Blocky]]
[[Category:PHP]]
[[Category:Perl]]
[[Category:C]]
[[Category:JSON]]
[[Category:Lua]]
[[Category:Python]]
操作系统(通用脚本请留空):
[[Category:Linux]]
[[Category:树莓派]]
[[Category:OSX]]
[[Category:Windows]]
此列表不完整! 如果发现有分类缺失,你可以在此添加新分类!这可以帮助大家快速查找脚本。
例子
例如 Philips HUE页面底部有如下分类:
[[Category:Domoticz]]
[[Category:设置]]
[[Category:硬件]]
[[Category:灯光]]
[[Category:脚本]]
[[Category:JSON]]
[[Category:Lua]]
[[Category:Bash]]
脚本
介绍
Batch脚本 (微软Windows系统)
Use the Edit button of a switch on the Switches tab. Use in the "On Action" or "Off Action" field: script://Domoticz\scripts\soundplay.bat to execute a batch file in the directory Domoticz/scripts on the same disk as the Domoticz installation. To play tada.wav the soundplay.bat file can contain: c:\PROGRA~1\VIDEOLAN\VLC\vlc.exe --play-and-exit %WINDIR%\media\tada.wav (assumed VLC is installed).
Blockly脚本
Lua脚本
Tutorial
Trigger
Library
Specific
- Lua - Electric meter pulse counter
- Lua - Oil Tank Monitor
- Lua - Powermonitor with Ping Using Telegram
- Event Examples (To be formatted to new wiki standard AND split in different pages)
- Smart Lua Examples (To be formatted to new wiki standard AND split in different pages)
- Get Weather Prediction
- Get Doors Status
- Thermostat Control (To be translated)
- Alarm
- Capturing Energy Usage with Lua Scripts (To be formatted to new wiki standard)
- Lua - Upload energy data to PVOutput
- Interacting with Google Calendar (To be formatted to new wiki standard)
- Automate sunscreen, blinds, shades (To be formatted to new wiki standard)
- Battery Level Check
- Get Sensors Status
- Lua - Dusk Sensor
- Lua - TI SensorTag
- Lua - Humidity control
- Lua - Battery level check
- Lua - Garden Irrigation
- Presence detection through mobile phone and PC presence on the network
- Controlling a Onkyo home cinema receiver through a Lua-script
- Lua - Real-time solar data without any hardware sensor : azimuth, Altitude, Lux sensor...
- Simple script to update Philips Hue Status
Bash脚本
Tutorial
Specific
- Post Gas Reading to the Mindergas.nl site
- Use Google Translate for Voice Notifications
- Play a streaming radio
- Limitless/AppLamp LED Control (To be formatted to new wiki standard)
- Daily Backup to External Hdd (To be formatted to new wiki standard)
- Automatic Weather Tweets (To be formatted to new wiki standard)
- http://www.domoticz.com/wiki/Monitoring_domoticz#Alternative_script Monitoring & auto restart of Domoticz service
- Monitor memory usage of a process and log inside domoticz
- Bash - Control Daikin wifi heatpump
- Bash - Status Hombot in Domoticz
- Batch - Domoticz backup script for Windows
- Use VoiceRSS for Voice notifications
- Installation Telegram Notification System - Telegram-Cli Method
- Use Slack as an alternative logging mechanism and upload images
- Bash - Speedtest.net Download/Upload/Ping monitoring
- Rsync raspberry bash script
- Raspberry pi fan control and monitoring with bash
Perl脚本
Tutorial
- Tutorial on Devices, Ping, Sqlite3, Xively, Sen.se, GPIO and Arduino
Specific
PHP脚本
Tutorial
Specific
- Extracting status and measuring values (To be formatted to new wiki standard)
- Automatic Weather Forecast Tweet (To be formatted to new wiki standard)
- Controlling a Onkyo home cinema receiver through a PHP-script
- Controlling a Ziggo Horizon (SMT-G7400) receiver through a PHP-script
- PHP: Store switch states and values in variables
- PHP: Functions to control Domoticz
- PHP: Send notifications
- PHP: Google Calendar to control Domoticz
Python脚本
Tutorial
Specific
- Presence detection by pinging a user's smartphone
- Presence detection by checking connected devices via SNMP
- Python & Bash - Posting gasreading to mindergas.nl
- Python - Read data from netduino-DAL
- Python - Control LG Smart TV (2012)
- Python - Notifications to PC with Snarl
- Python - Omnik Solar Inverter
- Python - Pushover notification first day of month with smartmeter meter values
- Prowl notification for energy measuring device
- Python Let a device blink
- Connect your doorbell to Domoticz (through GPIO)
- Get current state from Eneco Toon and save it as a uservariable in Domoticz
- UPS Pico (pimodules) integration with Domoticz
- Python - Monitor Domoticz IP address
- Python - Read-out of DDS238 kWh-meter and upload to Domoticz and to PVOutput