Scripts

From Domoticz
Jump to: navigation, search

Please add your scripts to this library.


Wiki Page for Your Script

We highly encourage you to add your working scripts, guides to hardware, and any other information relevant to Domoticz 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.

Template

Please include these sections if relevant on your script page:

  1. Purpose
  2. Dependencies - hardware / software / operating system
  3. Domoticz Setup - switches, variables, version
  4. Installation instructions
  5. Script with comments
  6. Example of use (if relevant) i.e. output files / screen displays
  7. 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

Page Naming Convention

Please name your script wiki page in this sort of format: script language - short description i.e. "Lua - Automatic Garage Door Opening" / "Bash - Switch Lights Off When House Empty"

Categories

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!

Example

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]]

Scripts

Introduction

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

Blockly Scripts

Lua Scripts

Tutorial

Trigger

Library

Specific

Bash Scripts

Tutorial

Specific

Perl Scripts

Tutorial

  • Tutorial on Devices, Ping, Sqlite3, Xively, Sen.se, GPIO and Arduino

Specific

PHP Scripts

Tutorial

Specific

Python scripts

Tutorial

Specific