Using Python plugins

From Domoticz
Jump to: navigation, search

Overview

Page (still) under construction.

This page will get you started using plugins that have already been developed to extend the functionality of Domoticz.

Currently only in beta

Please note that the plugin functionality is still only in beta. (Current at Domoticz version 3.5877 released by gizmocuz on Thursday 10 November 2016)

If you want to using plugins you must:

  • upgrade to the beta version
  • install python3 runtime
    • you may need to install python3 development libraries for now - see this issue thread
  • restart your Domoticz service
  • check your logs

Example code for Raspberry Pi with Raspbian

This assumes you have a vanilla, production release Domoticz server installed on Raspbian Jesse


# install dependencies
sudo apt-get install -y python3
# Domoticz Beta versions since V3.6129 also require...
sudo apt-get install -y python3-dev
# credit [https://www.domoticz.com/forum/viewtopic.php?f=65&t=16116&p=119747]

# update to the latest beta version
cd ~/domoticz
./updatebeta

# restart the service
sudo systemctl restart domoticz.service

Now check the logs

Scripts

To use a plugin script:

  • place a copy of the script as plugin.py in domoticz/plugins/denon/
  • give the file execute permissions
  • restart the Domoticz service
  • Setup / Hardware / Add a device
    • you should now see a new option in the drop-down list of device types

Example code for Raspberry Pi with Raspbian


# credit https://www.domoticz.com/forum/viewtopic.php?t=15681

# Obtain plugin from github
mkdir -p domoticz/plugins/denon/
curl -L https://raw.githubusercontent.com/domoticz/domoticz/master/plugins/examples/Denon4306.py >  domoticz/plugins/denon/plugin.py 

# set execute permissions (default was 644 pi:pi)
chmod 755 domoticz/plugins/denon/plugin.py

# restart domoticz service
sudo systemctl restart domoticz.service


Troubleshooting

  • check the log via the web interface (Setup / Log)
  • you should see
PluginSystem: Started, Python version '3.x.y'
  • if there is no mention at all of plugins
    • check have set up plugins (see above)
  • if you see
PluginSystem: Failed dynamic library load
    • have you installed the pyhton3 development libraries
    • check article [1]