This page offers an overview of scripts and programming snippets that help you get data in and out of Domoticz.
Once you have the data, you can use of to automate things. Scripts and logic to do that can be found under the automation part of this Wiki.
- 1 Adding your script to this list
- 2 Scripts
- 2.1 Introduction
- 2.2 Batch Scripts (MSWindows)
- 2.3 Blockly Scripts
- 2.4 Lua Scripts
- 2.5 Bash Scripts
- 2.6 Perl Scripts
- 2.7 PHP Scripts
- 2.8 Python scripts
Adding your script to this list
We highly encourage you to add your working scripts to our Wiki! You can login the Wiki with the same name and password as the forum. Remember your brilliant script or guide on a forum page is difficult to find even with a good search engine.
Please follow the page naming convention,and name your script wiki page in this format: script language - short description i.e. "Lua - Automatic Garage Door Opening" / "Bash - Switch Lights Off When House Empty"
By placing double square brackets around the title the Wiki will automatically turn it into a link to a new empty wiki page.
On your new script page please include these sections if relevant:
- Dependencies - hardware / software / operating system
- Domoticz Setup - switches, variables, version
- Installation instructions
- Script with comments
- Example of use (if relevant) i.e. output files / screen displays
- Link to forum posts
You can use the tag <syntaxhighlight lang="python"> CODE_HERE </syntaxhighlight> for colored highlighting of your code.
A list of all of the available languages can be found here: https://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Supported_languages
To make it easier for others to find your scripts use the following category conventions.
Pick the right items from the following trees, if you choose a lower item in the tree, like "TV" also include the categories higher up in the tree. And add them to the end of your Wiki page.
For example is you create a Wiki page on TV's thus adding the "TV" category, you also add the higher categories "Media" and "Hardware" .
Domotics: [[Category:Domoticz]] (pick one, or more) [[Category:Manual]] [[Category:Install]] [[Category:Setup]] Hardware: [[Category:Hardware]] [[Category:Appliance]] [[Category:Kitchen]] [[Category:Lighting]] [[Category:Media]] [[Category:AV]] [[Category:TV]] [[Cetegory:CEC]] [[Category:Audio]] [[Category:Security]] [[Category:Alarm]] [[Category:Camera]] [[Category:Keypad]] [[Category:Motion]] [[Category:Utility]] [[Category:Gas]] [[Category:Heating]] [[Category:Power]] [[Category:Water]] [[CategoryEnvironment]] [[Category:Indoor]] [[Category:Weather]] Protocols: [[Category:MQTT]] [[Category:Bluetooth]] [[Category:HTTP]] Scripting: [[Category:Scripting]] [[Category:Bash]] [[Category:Batch]] [[Category:Blocky]] [[Category:PHP]] [[Category:Perl]] [[Category:C]] [[Category:JSON]] [[Category:Lua]] [[Category:Python]] Operating Systems (leave empty if all) [[Category:Linux]] [[Category:Raspberry Pi]] [[Category:OSX]] [[Category:Windows]]
This list is incomplete! Please add your new categories here! And add missing categories to Wiki pages when you visit and notice them missing, it will help a lot for new users to navigate through the mountain of information hidden in this Wik!
For example the Philips HUE page has as category syntax at the end of the Wiki page:
[[Category:Domoticz]] [[Category:Setup]] [[Category:Hardware]] [[Category:Lighting]] [[Category:Scripting]] [[Category:JSON]] [[Category:Lua]] [[Category:Bash]]
Batch Scripts (MSWindows)
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).
- 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)
- 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
- 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
- Tutorial on Devices, Ping, Sqlite3, Xively, Sen.se, GPIO and Arduino
- 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
- 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