Domoticz Part 1: Relays, Magnetic Sensors, Wake-on-lan And Z-wave – Domoticz With Imperi Home Serving Your House

This entry was initially about single and simple purpose: how to quickly develop a solution that would open gate or garadge door by simulating the remote’s operation mode – pressing a button – but using smartphone, tablet, web browser, app. Domoticz is such an overkill and also blessing for such project – that it evolved into a lot of small sub-projects – more or less andvanced.
Direct inspiration was another entry by colleague on MalinowePi Facebook group – Roman Kubat, who showed ImperiHome. This application has great interface but does not support press-type (dorbell) buttons. Hence the whole idea!

What will you need?

Hardware:

  • Rapberry Pi (A, B, B+, 2 or even Pi Zero)
  • relay – single or better dual version
  • micorSD card – 4GB or better
  • jumper cables – for interconnection

Software:

Installing Domoticz on Raspberry Pi OS (formerly Raspbian)

Domoticz ? This is out main software used to control the relay – very powerfull, but has nice basic function – allows control via web interface or application – and is not limited to relays – Z-Wave based devices, sensors etc. To properly install domoticz on our Raspbian system – I suggest the Jessie Light version – we need to update the system:

sudo apt-get update
sudo apt-get upgrade
sudo reboot

Last command reboots our device and the first will ask you to confirm the whole upgrade process. After the reboot – it’s time to upgrade the kernel – at the time of writting – we are at version 4.x:

sudo rpi-update
sudo reboot

Now – after the reboot, we should install additional packages needed for domoticz to work properly:

sudo apt-get install cmake make gcc g++ libboost-dev libboost-thread-dev libboost-system-dev libboost-python-dev libssl-dev subversion curl libcurl4-openssl-dev libusb-dev python-dev

This will spawn more packages to install since they relay on others – no worry – just confirm wait until they are installed, and now it’s time to build domoticz with these commands:

mkdir domoticz
cd domoticz
wget http://domoticz.sourceforge.net/domoticz_linux_armv7l.tgz
tar xvfz domoticz_linux_armv7l.tgz
rm domoticz_linux_armv7l.tgz

Which should give you this result:

pi@raspberrypi ~ $ mkdir domoticz
pi@raspberrypi ~ $ cd domoticz
pi@raspberrypi ~/domoticz $ wget http://domoticz.sourceforge.net/domoticz_linux_armv7l.tgz
--2015-09-07 19:37:38--  http://domoticz.sourceforge.net/domoticz_linux_armv7l.tgz
Translacja domoticz.sourceforge.net (domoticz.sourceforge.net)... 216.34.181.96
Łączenie się z domoticz.sourceforge.net (domoticz.sourceforge.net)|216.34.181.96|:80... połączono.
Żądanie HTTP wysłano, oczekiwanie na odpowiedź... 200 OK
Długość: 8697173 (8,3M) [application/x-gzip]
Zapis do: `domoticz_linux_armv7l.tgz'
100%[============================================================================================================>] 8.697.173    212K/s   w  32s     
2015-09-07 19:38:10 (267 KB/s) - zapisano `domoticz_linux_armv7l.tgz' [8697173/8697173]
pi@raspberrypi ~/domoticz $ tar xvfz domoticz_linux_armv7l.tgz
domoticz
History.txt
License.txt
svnversion.h
domoticz.sh
server_cert.pem
www/
www/i18n/
www/i18n/domoticz-sv.json.gz
www/i18n/domoticz-bg.json.gz
www/i18n/domoticz-lt.json.gz
www/i18n/domoticz-tr.json.gz
www/i18n/domoticz-it.json.gz
www/i18n/domoticz-el.json.gz
www/i18n/domoticz-pl.json.gz
www/i18n/domoticz-de.json.gz
www/i18n/domoticz-fr.json.gz
www/i18n/domoticz-hu.json.gz
www/i18n/domoticz-en.json.gz
www/i18n/domoticz-es.json.gz
www/i18n/domoticz-cs.json.gz
www/i18n/domoticz-no.json.gz
www/i18n/domoticz-sk.json.gz
www/i18n/domoticz-nl.json.gz
www/i18n/domoticz-fi.json.gz
www/i18n/domoticz-pt.json.gz
www/i18n/domoticz-ru.json.gz
www/ozwcp/
www/ozwcp/cp.js
www/ozwcp/ozwcp.html
www/ozwcp/cp.html
www/index.html
www/views/
www/views/setup.html
www/views/lights.html
www/views/notification.html
www/views/uservariables.html
www/views/users.html
www/views/restoredatabase.html
www/views/login.html
www/views/temperature.html
www/views/update.html
www/views/logout.html
www/views/dphttp.html
www/views/scenes.html
www/views/events.html
www/views/dpfibaro.html
www/views/hardware.html
www/views/offline.html
www/views/customicons.html
www/views/utility.html
www/views/roomplan.html
www/views/history.html
www/views/dashboard.html
www/views/log.html
www/views/floorplans.html
www/views/cam.html
www/views/frontpage_example.html
www/views/frontpage.html
www/views/forecast.html
www/views/weather.html
www/views/devices.html
www/views/floorplanedit.html
www/images/
www/images/program_mini.png
www/images/Alert48_4.png
www/images/copy_hover.png
www/images/temp48.png
www/images/Generic48_On.png
www/images/logo192.png
www/images/sort_both.png
www/images/WindSSW.png
www/images/smoke.png
www/images/variables.png
www/images/devices.png
www/images/Alarm48_On.png
www/images/Fireplace48_Off.png
www/images/battery-ok.png
www/images/scenes.png
www/images/copy.png
www/images/events.png
www/images/spacer.gif
www/images/pushon48.png
www/images/Harddisk48_On.png
www/images/edit.png
www/images/Speaker48_Off.png
www/images/Harddisk.png
www/images/motion.png
www/images/Fireplace.png
www/images/back_disabled.png
www/images/current.png
www/images/on.png
www/images/add.png
www/images/restart.png
www/images/logout.png
www/images/overrule.png
www/images/current48.png
www/images/house.png
www/images/RGB.png
www/images/mode48.png
www/images/WindSW.png
www/images/security48.png
www/images/temp48.psd
www/images/temp-25-30.png
www/images/battery.png
www/images/Harddisk48_Off.png
www/images/blindsopen48sel.png
www/images/WindSSE.png
www/images/sort_asc_disabled.png
www/images/capture.png
www/images/text48.png
www/images/temp-10-15.png
www/images/background.png
www/images/baro48.png
www/images/WindW.png
www/images/air_signal.png
www/images/door48open.png
www/images/button.png
www/images/Computer48_On.png
www/images/up.png
www/images/xls.png
www/images/RGB48_On.png
www/images/siren.png
www/images/nodemand_mini.png
www/images/ChristmasTree.png
www/images/siren-on.png
www/images/push48.png
www/images/Up48.png
www/images/motion48-off.png
www/images/compass.psd
www/images/pbar-ani.gif
www/images/favorite.png
www/images/air48.png
www/images/gauge.png
www/images/smokeoff.png
www/images/Phone48_On.png
www/images/Water48_On.png
www/images/ComputerPC.png
www/images/lock_closed.png
www/images/Printer48_On.png
www/images/clock.png
www/images/remote48.png
www/images/security.png
www/images/insert.png
www/images/Cooling48_On.png
www/images/Amplifier48_Off.png
www/images/Alert48_1.png
www/images/WindESE.png
www/images/leaf.png
www/images/ChristmasTree48_On.png
www/images/Wind0.png
www/images/contact_open.png
www/images/forward_enabled.png
www/images/Generic48_Off.png
www/images/shutdown.png
www/images/log.png
www/images/Fireplace48_On.png
www/images/back_enabled_hover.png
www/images/Heating48_Off.png
www/images/Down48_2.png
www/images/WindNNE.png
www/images/print_hover.png
www/images/Heating.png
www/images/switch.png
www/images/override.png
www/images/Light48_Off.png
www/images/Alert.psd
www/images/blinds48.png
www/images/bbq.png
www/images/rename.png
www/images/Alarm48_Off.png
www/images/Kompas.psd
www/images/TV48_Off.png
www/images/sort_desc.png
www/images/Phone.png
www/images/demand.png
www/images/Media.png
www/images/blinds48sel.png
www/images/handle.png
www/images/scale.png
www/images/Generic.png
www/images/battery-low.png
www/images/overrule_mini.png
www/images/program.png
www/images/WallSocket.png
www/images/hold.png
www/images/WallSocket48_On.png
www/images/camera-web.png
www/images/WindNW.png
www/images/Up48_2.png
www/images/uvsunny.png
www/images/Amplifier.png
www/images/motion48-on.png
www/images/WindN.png
www/images/collection_hover.png
www/images/Water.png
www/images/Speaker.png
www/images/gauge48.png
www/images/nofavorite.png
www/images/forward_disabled.png
www/images/Printer48_Off.png
www/images/temp-15-20.png
www/images/nodemand.png
www/images/remote.png
www/images/sort_asc.png
www/images/Cooling48_Off.png
www/images/ok.png
www/images/ice.png
www/images/temp-5-10.png
www/images/users.png
www/images/details.png
www/images/RGB48_Off.png
www/images/Cooling.png
www/images/Fan48_Off.png
www/images/rain48.png
www/images/hold_mini.png
www/images/contact48.png
www/images/desktop.png
www/images/pdf.png
www/images/Down48.png
www/images/empty16.png
www/images/notification.png
www/images/WindSE.png
www/images/Phone48_Off.png
www/images/Alert48_3.png
www/images/logo.png
www/images/WindS.png
www/images/onoff48.png
www/images/print.png
www/images/Stop48.png
www/images/moisture48.png
www/images/demand_mini.png
www/images/counter.png
www/images/heal.png
www/images/WallSocket48_Off.png
www/images/next.png
www/images/lux48.png
www/images/door.png
www/images/csv_hover.png
www/images/WindNNW.png
www/images/Alert.png
www/images/leaf48.png
www/images/contact48_open.png
www/images/failed.png
www/images/moisture.png
www/images/blinds.png
www/images/wind.png
www/images/back_enabled.png
www/images/remove.png
www/images/ChristmasTree48_Off.png
www/images/equal.png
www/images/motionoff.png
www/images/Media48_On.png
www/images/Light48_On.png
www/images/Fan.png
www/images/temp-20-25.png
www/images/sleep.png
www/images/Computer.png
www/images/temperature.png
www/images/Alarm.png
www/images/WindNE.png
www/images/collection.png
www/images/Media48_Off.png
www/images/blindsopen48.png
www/images/Percentage48.png
www/images/startup/
www/images/startup/apple-touch-startup-image-768x1004.png
www/images/startup/apple-touch-startup-image-640x920.png
www/images/startup/apple-touch-startup-image-1024x748.png
www/images/startup/apple-touch-startup-image-640x1096.png
www/images/startup/apple-touch-startup-image-320x460.png
www/images/startup/apple-touch-startup-image-1536x2008.png
www/images/startup/apple-touch-startup-image-2048x1496.png
www/images/rainraining.png
www/images/Speaker48_On.png
www/images/glyphicons-halflings.png
www/images/radiation48.png
www/images/expand16.png
www/images/Dimmer48_On.png
www/images/evohome/
www/images/evohome/AutoWithEco.png
www/images/evohome/AwayInv.png
www/images/evohome/HeatingOffInv.png
www/images/evohome/Away.png
www/images/evohome/RemoteOverrideInv.png
www/images/evohome/Off.png
www/images/evohome/AutoWithEcoInv.png
www/images/evohome/On.png
www/images/evohome/PermanentOverride.png
www/images/evohome/TemporaryOverrideInv.png
www/images/evohome/Custom.png
www/images/evohome/DayOff.png
www/images/evohome/RemoteOverride.png
www/images/evohome/Auto.png
www/images/evohome/OpenWindow.png
www/images/evohome/DayOffInv.png
www/images/evohome/TemporaryOverride.png
www/images/evohome/PermanentOverrideInv.png
www/images/evohome/CustomInv.png
www/images/evohome/HeatingOff.png
www/images/delete.png
www/images/glyphicons-halflings-white.png
www/images/WindWSW.png
www/images/mode.png
www/images/temp-0-5.png
www/images/xls_hover.png
www/images/pushoff.png
www/images/ComputerPC48_Off.png
www/images/lock_open.png
www/images/Computer48_Off.png
www/images/override_mini.png
www/images/radiation.png
www/images/customicons.png
www/images/off.png
www/images/hardware.png
www/images/smoke48on.png
www/images/visibility48.png
www/images/wind48.png
www/images/lightbulb.png
www/images/adjust48.png
www/images/rain.png
www/images/iphone-icon.png
www/images/smoke48off.png
www/images/lux.png
www/images/Heating48_On.png
www/images/pushoff48.png
www/images/webcam.png
www/images/Amplifier48_On.png
www/images/WindENE.png
www/images/lightbulboff.png
www/images/door48.png
www/images/siren-off.png
www/images/contact.png
www/images/floorplans/
www/images/floorplans/example.jpg
www/images/WindE.png
www/images/pIkfp.gif
www/images/sort_desc_disabled.png
www/images/Water48_Off.png
www/images/push.png
www/images/Alert48_2.png
www/images/doorbell48.png
www/images/Alert48_0.png
www/images/pdf_hover.png
www/images/uv.png
www/images/setup.png
www/images/blindsstop.png
www/images/WindWNW.png
www/images/camera_default.png
www/images/Dimmer48_Off.png
www/images/doorbell.png
www/images/ComputerPC48_On.png
www/images/down.png
www/images/visibility.png
www/images/forward_enabled_hover.png
www/images/uv48.png
www/images/login-sprite.png
www/images/TV48_On.png
www/images/text.png
www/images/Fan48_On.png
www/images/clock48.png
www/images/unknown.png
www/images/TV.png
www/images/uvdark.png
www/images/csv.png
www/images/Printer.png
www/images/scale48.png
www/images/temp-gt-30.png
www/images/pushon.png
www/images/utility.png
www/images/air.png
www/media/
www/media/click.wav
www/media/trashbody.png
www/media/trashlid.png
www/media/1x1.gif
www/media/handopen.cur
www/media/quote0.png
www/media/delete.wav
www/media/quote1.png
www/media/swf/
www/media/swf/copy_csv_xls.swf
www/media/swf/copy_csv_xls_pdf.swf
www/media/handclosed.cur
www/media/tree.png
www/styles/
www/styles/element-dark/
www/styles/element-dark/images/
www/styles/element-dark/images/imgbg.jpg
www/styles/element-dark/custom.css
www/styles/element-dark/fonts/
www/styles/element-dark/fonts/DroidSans.ttf
www/styles/element-dark/fonts/OpenSans.ttf
www/styles/default/
www/styles/default/custom.css
www/styles/simple-gray/
www/styles/simple-gray/custom.css
www/styles/simple-blue/
www/styles/simple-blue/custom.css
www/styles/element-light/
www/styles/element-light/images/
www/styles/element-light/images/imgbg.jpg
www/styles/element-light/custom.css
www/styles/element-light/fonts/
www/styles/element-light/fonts/DroidSans.ttf
www/styles/element-light/fonts/OpenSans.ttf
www/switch_icons.txt
www/favicon.ico
www/secpanel/
www/secpanel/sounds/
www/secpanel/sounds/disarmed.ogg
www/secpanel/sounds/bleep.mp3
www/secpanel/sounds/armed.mp3
www/secpanel/sounds/disarmed.mp3
www/secpanel/sounds/wrong.ogg
www/secpanel/sounds/armed.ogg
www/secpanel/sounds/wrong.mp3
www/secpanel/sounds/bleep.ogg
www/secpanel/font/
www/secpanel/font/Audiowide.woff
www/secpanel/font/Audiowide.ttf
www/secpanel/font/Digital.eot
www/secpanel/font/Audiowide.svg
www/secpanel/font/Digital.ttf
www/secpanel/font/Digital.svg
www/secpanel/font/Digital.woff
www/secpanel/font/Audiowide.eot
www/secpanel/index.html
www/secpanel/bg.jpg
www/secpanel/css/
www/secpanel/css/font.less
www/secpanel/css/style.less
www/secpanel/css/reset.less
www/secpanel/js/
www/secpanel/js/less.js.gz
www/secpanel/js/ion.sound.js.gz
www/app/
www/app/RoomplanController.js
www/app/DPFibaroController.js
www/app/UsersController.js
www/app/SetupController.js
www/app/FloorplanController.js
www/app/DevicesController.js
www/app/LogoutController.js
www/app/HardwareController.js
www/app/WeatherController.js
www/app/CustomIconsController.js
www/app/NotificationController.js
www/app/OfflineController.js
www/app/LoginController.js
www/app/main.js
www/app/LightsController.js
www/app/UtilityController.js
www/app/EventsController.js
www/app/ZWaveTopologyController.js
www/app/TemperatureController.js
www/app/CamController.js
www/app/DashboardController.js
www/app/FloorplanEditController.js
www/app/ScenesController.js
www/app/UserVariablesController.js
www/app/HistoryController.js
www/app/LogController.js
www/app/app.js
www/app/DPHttpController.js
www/app/UpdateController.js
www/app/ForecastController.js
www/app/RestoreDatabaseController.js
www/app/FrontpageController.js
www/css/
www/css/ui-darkness/
www/css/ui-darkness/images/
www/css/ui-darkness/images/ui-icons_a83300_256x240.png
www/css/ui-darkness/images/ui-icons_222222_256x240.png
www/css/ui-darkness/images/ui-icons_cccccc_256x240.png
www/css/ui-darkness/images/ui-bg_inset-soft_25_000000_1x100.png
www/css/ui-darkness/images/ui-icons_4b8e0b_256x240.png
www/css/ui-darkness/images/ui-bg_inset-soft_30_f58400_1x100.png
www/css/ui-darkness/images/ui-bg_gloss-wave_25_333333_500x100.png
www/css/ui-darkness/images/ui-bg_glass_40_0078a3_1x400.png
www/css/ui-darkness/images/ui-bg_flat_50_5c5c5c_40x100.png
www/css/ui-darkness/images/ui-bg_glass_40_ffc73d_1x400.png
www/css/ui-darkness/images/ui-bg_glass_20_555555_1x400.png
www/css/ui-darkness/images/ui-bg_flat_30_cccccc_40x100.png
www/css/ui-darkness/images/ui-bg_highlight-soft_80_eeeeee_1x100.png
www/css/ui-darkness/images/animated-overlay.gif
www/css/ui-darkness/images/ui-icons_ffffff_256x240.png
www/css/ui-darkness/jquery-ui-1.10.3.custom.min.css
www/css/images/
www/css/images/img12.jpg
www/css/images/spacer.gif
www/css/images/img07.png
www/css/images/img01.jpg
www/css/images/img03r.jpg
www/css/images/img03bs.jpg
www/css/images/img03b.jpg
www/css/images/img02.jpg
www/css/images/img06.png
www/css/images/img04.png
www/css/images/img03bd.png
www/css/images/handle.png
www/css/images/img05.png
www/css/images/img11.jpg
www/css/images/img01a.jpg
www/css/images/img03.jpg
www/css/images/img13.jpg
www/css/images/img03s.jpg
www/css/images/close.png
www/css/images/img12.png
www/css/images/img09.png
www/css/images/img08.jpg
www/css/images/img10.png
www/css/images/bg-track.png
www/css/jquery-ui-timepicker-addon.css
www/css/colpick.css
www/css/bootstrap.css
www/css/bootstrap-responsive.css
www/css/jquery.dataTables.min.css
www/css/jquery.uix.multiselect.css
www/css/style.css
www/css/demo_table_jui.css
www/css/fonts/
www/css/fonts/Oswald-Light.ttf
www/css/fonts/Satisfy.ttf
www/css/fonts/Oswald-Light.eot
www/css/fonts/Oswald-Regular.eot
www/css/fonts/Satisfy.eot
www/css/fonts/Oswald-Regular.ttf
www/html5.appcache
www/templates/
www/templates/readme.txt
www/templates/custom.example
www/eventsframe.html
www/js/
www/js/jquery.dataTables.min.js.gz
www/js/jquery.ddslick.min.js.gz
www/js/bootstrap.min.js.gz
www/js/jquery.isotope.min.js.gz
www/js/colpick.js.gz
www/js/modules/
www/js/modules/exporting.js.gz
www/js/blockly_compressed.js.gz
www/js/angular-animate.min.js.gz
www/js/jquery-ui.min.js.gz
www/js/d3.min.js.gz
www/js/date.format.js.gz
www/js/md5.js.gz
www/js/bootbox.min.js.gz
www/js/domoticzblocks_messages_en.js.gz
www/js/en_compressed.js.gz
www/js/jquery-ui-timepicker-addon.js.gz
www/js/highcharts-more.js.gz
www/js/ngDraggable.js.gz
www/js/jquery-ui-1.10.3.custom.min.js.gz
www/js/highcharts.js.gz
www/js/respond.min.js.gz
www/js/angular-tree-control.js.gz
www/js/domoticz.js.gz
www/js/highcharts-ng.min.js.gz
www/js/wow.min.js.gz
www/js/jquery.jeditable.mini.js.gz
www/js/angular.min.js.gz
www/js/dataTables.tableTools.min.js.gz
www/js/jquery-1.11.2.min.js.gz
www/js/ngload.min.js.gz
www/js/FileSaver.js.gz
www/js/angular-sanitize.min.js.gz
www/js/ng-grid-flexible-height.js.gz
www/js/jquery.ui.touch-punch.min.js.gz
www/js/ZeroClipboard.js.gz
www/js/noty/
www/js/noty/jquery.noty.js.gz
www/js/noty/layouts/
www/js/noty/layouts/center.js.gz
www/js/noty/layouts/topCenter.js.gz
www/js/noty/layouts/topRight.js.gz
www/js/noty/layouts/bottomLeft.js.gz
www/js/noty/layouts/centerRight.js.gz
www/js/noty/layouts/centerLeft.js.gz
www/js/noty/layouts/bottomCenter.js.gz
www/js/noty/layouts/bottomRight.js.gz
www/js/noty/layouts/bottom.js.gz
www/js/noty/layouts/topLeft.js.gz
www/js/noty/layouts/top.js.gz
www/js/noty/layouts/inline.js.gz
www/js/noty/promise.js.gz
www/js/noty/themes/
www/js/noty/themes/default.js.gz
www/js/domoticzblocks.js.gz
www/js/require.js.gz
www/js/angular-md5-min.js.gz
www/js/domoticzdevices.js.gz
www/js/ng-grid.min.js.gz
www/js/angularAMD.min.js.gz
www/js/i18next-1.8.0.min.js.gz
www/js/export-csv.js.gz
www/js/jquery.uix.multiselect.min.js.gz
www/js/html5shiv.js.gz
www/js/themes/
www/js/themes/dark-blue.js.gz
www/js/themes/gray.js.gz
www/js/themes/skies.js.gz
www/js/themes/dark-green.js.gz
www/js/themes/grid.js.gz
www/js/angular-route.min.js.gz
www/js/jquery-migrate-1.2.1.min.js.gz
www/zwavetopology.html
scripts/
scripts/readme.txt
scripts/lua/
scripts/lua/script_time_demo.lua
scripts/lua/script_device_demo.lua
scripts/restart_domoticz
scripts/_domoticz_main
scripts/update_domoticz
scripts/python/
scripts/python/script_device_PIRsmarter.py
scripts/python/reloader.py
scripts/python/domoticz.py
scripts/_domoticz_main.bat
Config/
Config/options.xsd
Config/widom/
Config/widom/UBS104.xml
Config/vision/
Config/vision/zp3102.xml
Config/vision/zs5101eu.xml
Config/vision/zm1601eu.xml
Config/vision/zd2102.xml
Config/aeotec/
Config/aeotec/recessed_doorsensor.xml
Config/aeotec/watersensor.xml
Config/aeotec/doorwindow.xml
Config/aeotec/hdss_gen5.xml
Config/aeotec/hem.xml
Config/aeotec/msesv2.xml
Config/aeotec/minimote.xml
Config/aeotec/keyfob.xml
Config/aeotec/multisensor_gen5.xml
Config/aeotec/dsd31.xml
Config/aeotec/ses2.xml
Config/aeotec/recessed_doorsensor_gen5.xml
Config/aeotec/panicbtn.xml
Config/aeotec/alms.xml
Config/aeotec/hemg2.xml
Config/aeotec/keyfob2.xml
Config/aeotec/ses.xml
Config/honeywell/
Config/honeywell/th8320zw1000.xml
Config/popp/
Config/popp/123601.xml
Config/popp/zweather.xml
Config/popp/123658.xml
Config/popp/123580.xml
Config/manufacturer_specific.xml
Config/northq/
Config/northq/nq92021.xml
Config/northq/nq9121.xml
Config/2gig/
Config/2gig/ct100.xml
Config/2gig/ct30.xml
Config/2gig/ct101.xml
Config/frostdale/
Config/frostdale/fdn2nxx.xml
Config/homeseer/
Config/homeseer/hsm100.xml
Config/homeseer/ztroller.xml
Config/assa_abloy/
Config/assa_abloy/RealLivingCapTouch.xml
Config/horstmann/
Config/horstmann/hrt4zw.xml
Config/zipato/
Config/zipato/RGBBulb.xml
Config/zipato/MiniKeypad.xml
Config/zwave.me/
Config/zwave.me/kfob.xml
Config/zwave.me/ZME_06433.xml
Config/zwave.me/ZME_06436.xml
Config/zwave.me/ZME_WCD2.xml
Config/zwave.me/ZME_WALLC-S.xml
Config/zwave.me/ZME_064435.xml
Config/zwave.me/ZME_05431.xml
Config/zwave.me/iTemp.xml
Config/swiid/
Config/swiid/swiidplug.xml
Config/swiid/swiidinter.xml
Config/device_classes.xsd
Config/fibaro/
Config/fibaro/fgsd002.xml
Config/fibaro/fgk001.xml
Config/fibaro/fgss101.xml
Config/fibaro/fgs211.xml
Config/fibaro/fgs221.xml
Config/fibaro/fgd211.xml
Config/fibaro/fgfs101.xml
Config/fibaro/fgrm222.xml
Config/fibaro/fgbs001.xml
Config/fibaro/fgms.xml
Config/fibaro/fgr221.xml
Config/fibaro/fgwpe.xml
Config/fibaro/fgrgbwm441.xml
Config/qubino/
Config/qubino/ZMNHAA2.xml
Config/qubino/ZMNHJA2.xml
Config/qubino/ZMNHCA2.xml
Config/qubino/ZMNHIA2.xml
Config/qubino/ZMNHDA2.xml
Config/qubino/ZMNHBA2.xml
Config/zwscene.xsd
Config/duwi/
Config/duwi/ZWES1000.xml
Config/duwi/ZWESJ300.xml
Config/schlagelink/
Config/schlagelink/itemp.xml
Config/schlagelink/minikeypad.xml
Config/everspring/
Config/everspring/an145.xml
Config/everspring/se812.xml
Config/everspring/st814.xml
Config/everspring/sp814.xml
Config/everspring/sm103.xml
Config/everspring/st815.xml
Config/everspring/sf812.xml
Config/everspring/an158.xml
Config/everspring/tse03.xml
Config/everspring/sp103.xml
Config/intermatic/
Config/intermatic/ca8900.xml
Config/nodon/
Config/nodon/asp3100SmartPlug.xml
Config/rcs/
Config/rcs/therm0009.xml
Config/rcs/pm12-zw.xml
Config/rcs/em52-zw.xml
Config/rcs/therm0007.xml
Config/rcs/therm0005.xml
Config/polycontrol/
Config/polycontrol/doorlock.xml
Config/polycontrol/keypad.xml
Config/cooper/
Config/cooper/RF9540-N.xml
Config/cooper/RF9505-T.xml
Config/iris/
Config/iris/rangeextender.xml
Config/waynedalton/
Config/waynedalton/WDTC-20.xml
Config/wenzhou/
Config/wenzhou/tsp01.xml
Config/wenzhou/tz67.xml
Config/wenzhou/sm103.xml
Config/wenzhou/tz65d.xml
Config/wenzhou/tz88.xml
Config/wenzhou/tz66d.xml
Config/act/
Config/act/lfm20.xml
Config/act/zdw103.xml
Config/act/zdm230.xml
Config/act/zdw232.xml
Config/act/zrp110.xml
Config/act/zrw103.xml
Config/act/zir010.xml
Config/philio/
Config/philio/pst02-b.xml
Config/philio/pst02-1c.xml
Config/philio/pst02.xml
Config/philio/psm02.xml
Config/philio/pan04.xml
Config/qees/
Config/qees/reto-plugin-switch.xml
Config/ge/
Config/ge/dimmer.xml
Config/ge/dimmer_module.xml
Config/ge/relay.xml
Config/zwcfg.xsd
Config/everspringct/
Config/everspringct/hsm02.xml
Config/greenwave/
Config/greenwave/powernode6.xml
Config/greenwave/powernode1.xml
Config/trane/
Config/trane/TZEMT400BB32MAA.xml
Config/trane/TZEMT400AB32MAA.xml
Config/remotec/
Config/remotec/zfm-80.xml
Config/remotec/zxt-120.xml
Config/remotec/zurc.xml
Config/device_configuration.xsd
Config/leviton/
Config/leviton/vri10.xml
Config/leviton/vri06.xml
Config/leviton/rzi10.xml
Config/leviton/vrf01.xml
Config/leviton/vrcpg.xml
Config/eurotronic/
Config/eurotronic/eur_stellaz.xml
Config/dragontech/
Config/dragontech/wd-100.xml
Config/device_classes.xml
Config/danfoss/
Config/danfoss/living.xml
Config/danfoss/z.xml
Config/BeNext/
Config/BeNext/Molite.xml
Config/BeNext/EnergySwitch.xml
Config/BeNext/2poleswitch.xml
Config/BeNext/PluginDimmer.xml
Config/BeNext/1poleswitch.xml
Config/BeNext/BuiltinDimmer.xml
Config/BeNext/AlarmSound.xml
Config/BeNext/HeatingControl.xml
Config/BeNext/SceneController.xml
Config/BeNext/DoorSensor.xml
Config/BeNext/TagReader.xml
Config/options.xml
Config/vitrum/
Config/vitrum/vitrumBS.xml
Config/manufacturer_specific.xsd
Config/evolve/
Config/evolve/ltm-5.xml
Config/evolve/lsm-15.xml
Config/evolve/lrm-as.xml
pi@raspberrypi ~/domoticz $ rm domoticz_linux_armv7l.tgz

Done? Great, now lets have domoticz started at boot:

sudo cp domoticz.sh /etc/init.d
sudo chmod +x /etc/init.d/domoticz.sh
sudo update-rc.d domoticz.sh defaults

Let’s complete the configuration by setting correct options for domoticz: uses user pi, port 8080 (we can use the classic port 80 fro something else):, so using the edtior:

sudo nano /etc/init.d/domoticz.sh

change the values to the following and press CTRL+x,confirm with y to save&exit:

USERNAME=pi
DAEMON=/home/$USERNAME/domoticz/$NAME
DAEMON_ARGS="-daemon -www 8080"

Teraz testujemy poprawność ustawień i praw dostępu, jesteśmy nadal w katalogu /home/pi/domoticz:

./domoticz

Finally – we need to test if our domoticz starts with those values, please go to /home/pi/domoticz and run:

pi@raspberrypi ~/domoticz $ ./domoticz
2015-09-07 19:53:21.792  Domoticz V2.2563 (c)2012-2015 GizMoCuz
2015-09-07 19:53:21.793  System: Raspberry Pi
2015-09-07 19:53:21.794  Startup Path: /home/pi/domoticz/
2015-09-07 19:53:23.579  Active notification subsystems: http (1/8)
2015-09-07 19:53:23.592  Webserver started on port: 8080
2015-09-07 19:53:54.553  Hardware Monitor: Fetching data (System sensors)

Assuming that Pi’s IP address is 10.20.30.40- type in your browser: http://10.20.30.40:8080 and this is what we should get:

domoticz-clean

For our last test – let’s ask domoticz to close by pressing CTRL+c:

^C2015-09-07 19:55:57.481  Closing application!...
2015-09-07 19:55:57.482  Stopping worker...
2015-09-07 19:55:57.483  Stopping all hardware...
2015-09-07 19:55:57.484  WebServer stopped...
2015-09-07 19:55:57.591  Scheduler stopped...
2015-09-07 19:55:58.156  Hardware Monitor: Stopped...
2015-09-07 19:55:58.342  Mainworker Stopped...

At this point we should reboot out Pi to ckeck if domoticz starts up correctly.

Wiring Pi Installation

WiringPi is an important additional software (library), that allows smooth control over our relay using the Pi’s GPIO ports.

Just as with domoticz – WiringPi needs to be built – meaning that we need to download current software using git command ( if you still don’t have git – install it by sudo apt-get install git-core):

git clone git://git.drogon.net/wiringPi

This should give us:

pi@raspberrypi ~ $ git clone git://git.drogon.net/wiringPi
Cloning into 'wiringPi'...
remote: Counting objects: 742, done.
remote: Compressing objects: 100% (676/676), done.
remote: Total 742 (delta 538), reused 94 (delta 58)
Receiving objects: 100% (742/742), 262.41 KiB | 190 KiB/s, done.
Resolving deltas: 100% (538/538), done.

Let’s make sure we have the latest version:

pi@raspberrypi ~ $ cd wiringPi
pi@raspberrypi ~/wiringPi $ git pull origin
Already up-to-date.

Build it:

cd wiringPi
./build

The output should similar to this:

pi@raspberrypi ~/wiringPi $ ./build

wiringPi Build script

=====================
WiringPi Library
[UnInstall]
[Compile] wiringPi.c
[Compile] piHiPri.c
[Compile] wiringShift.c
[Compile] wiringSerial.c
[Compile] piThread.c
[Compile] wiringPiSPI.c
[Compile] wiringPiI2C.c
[Compile] softPwm.c
[Compile] softTone.c
[Compile] mcp23008.c
[Compile] mcp23016.c
[Compile] mcp23017.c
[Compile] mcp23s08.c
[Compile] mcp23s17.c
[Compile] sr595.c
[Compile] pcf8574.c
[Compile] pcf8591.c
[Compile] mcp3002.c
[Compile] mcp3004.c
[Compile] mcp4802.c
[Compile] mcp3422.c
[Compile] max31855.c
[Compile] max5322.c
[Compile] sn3218.c
[Compile] drcSerial.c
[Compile] wpiExtensions.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]
WiringPi Devices Library
[UnInstall]
[Compile] ds1302.c
[Compile] maxdetect.c
[Compile] piNes.c
[Compile] piFace.c
[Compile] gertboard.c
[Compile] lcd128x64.c
[Compile] lcd.c
[Compile] piGlow.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]
GPIO Utility
[Compile] readall.c
[Compile] gpio.c
[Compile] pins.c
[Link]
[Install]                                                                                                                                                                   

All Done.                                                                                                                                                                   

NOTE: To compile programs with wiringPi, you need to add:                                                                                                                   
    -lwiringPi
  to your compile line(s) To use the Gertboard, MaxDetect, etc.
  code (the devLib), you need to also add:
    -lwiringPiDev
  to your compile line(s).

So – all installed – let’s test if we now have control over GPIO ports:

pi@raspberrypi ~ $ gpio -v
gpio version: 2.26
Copyright (c) 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty
Raspberry Pi Details:
  Type: Model B+, Revision: 1.2, Memory: 512MB, Maker: Sony 
pi@raspberrypi ~ $ gpio readall
 +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 |   IN | 1 |  3 || 4  |   |      | 5V      |     |     |
 |   3 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+

Relay installation

It’s high time to explain we do we need relay here. Well the idea behind it is simpe: simulate one second of button press on the remote. This is exactly how most of the radio controlled units work (but hey this is my experience). So we will use Pi with relay controlled GPIO to simulate short circuit for one second, then release it. Relay gives us galvanic separation and ability to have a long wire to the actual garage door motor/controller – extending the GPIO might cause some instability. As you’ve noticed – Pi has quite a lot of pins and we will use the one that is showing up all over the internet as GPIO4.
Let’s get back to domoticz and create virtual button – so virtual – doesn’t do anything – it’s not related to hardware that domoticz is supporting. Choose Setup and then Hardware – and add:

add-dummy-port

But why complicate it ? This is because we want the following control:

  • The button should have the same functionality whenever it is pressed to be ON or OFF. So works just like a dorbell but is not a dorbell button
  • If we press ON or OFF it should switch from open state to short stat for one second and go back to open state.

To get this we should create the button in Destkop menu (the star in Switches) and use LUA (language used by domoticz to do more under the hood). This script will do exactly what we said previoulsy – short for one second, but otherwise keep it open:
So, having the dummy switch “hardware” let’s choose Create Virtual Sensors and choose “Switch”:

add-dummy-switch

Go to Setup, then Devices – find our Dummy and use the green arrow to add it to Switches tab:

add-switch-from-hardware

Now let’s name it “Garage” – notice it’s bit different on the screenshot:

add-switch-and-change-icon

The actual script that will emulate our button should be put in: ~/domoticz/scripts/lua, and the name has to be exactly with the Garage name we created the switch: script_device_Garage.lua
Here’s the script contents:

-- script_device_Garaz.lua

local sensor = 'Garaz'

commandArray = {}

if (devicechanged[sensor] == 'On') then
print ("Wlaczam sterowanie garazem przez pin 4")
os.execute ("/usr/local/bin/gpio export 4 in")
os.execute ("/usr/local/bin/gpio export 4 out")
os.execute ("sleep 1")
os.execute ("/usr/local/bin/gpio export 4 in")
end

if (devicechanged[sensor] == 'Off') then
print ("Wlaczam sterowanie garazem przez pin 4")
os.execute ("/usr/local/bin/gpio export 4 in")
os.execute ("/usr/local/bin/gpio export 4 out")
os.execute ("sleep 1")
os.execute ("/usr/local/bin/gpio export 4 in")
end

return commandArray

Now the hardware part – set-up the power for relay, connect the GPIO4 and … test!
You can use +5V from Pi, GND and GPIO4 – press the button on domoticz webpage and the relay should click for one second:

blog-relay-and-pi

So all this just because we will later use ImperiHome that doesn’t do dorbells. So this can be done much easier, but it’ll get easier later.

Previous Post Next Post


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License (c) 2014-2024 Łukasz C. Jokiel, [CC BY-NC-SA 4.0 DEED](https://creativecommons.org/licenses/by-nc-sa/4.0/)