Domoticz Server

The Unofficial SmartThings Blog
Jump to: navigation, search


Category: My Apps

Author: Martin Verbeek

ST Community handle: http://community.smartthings.com/users/dudz40/activity



Summary

This App acts as an integration tool to a Domoticz Server in your local network. Domoticz is Open home automation software that is frequently installed on a Raspberry Pi. Domoticz can be downloaded in combination with the Raspberry OS onto an SD card and used to start the Rapberry Pi, nothing complicated.

Zwave is supported through openzwave on the Pi.

You can use this setup at home in combination with a transceiver from RFXCOM. This enables a lot of legacy and proporietary protocols that use 433Mhz as a communications method. These devices that (most of the time) automatically will be discovered by Domoticz can now be integrated with normal Smartthings operation. Examples are X10, HomeEasy, DIO, Somfy, CoCo, LimitlessLed, Hue and many more. For a list of devices that are supported by RFXCOM: RFXCOM User Guide

Wiki Dudz40 RFXCOM.jpg Wiki Dudz40 Raspberry Pi.jpg

Supported Features

  • Any On/Off device in Domoticz can be added
  • Any Light (RGBW/RGB/Dimmable) in Domoticz can be added
  • Any Blind device in Domoticz can be added
  • Any Scene or Group in Domoticz can be added
  • Motion and Contact sensors can be added
  • Smoke Detectors can be added
  • Selector switches can be added

The App will look every hour for new devices in Domoticz. When a device in Domoticz is deleted it will be deleted in SmartThings as well. When you copy the code enable OAuth in the IDE for this app as well!


Code location: https://github.com/verbem/Domoticz-Server

Add new repository to IDE for convenient updating and publishing using My SmartApps -> Settings Owner : verbem Name  : Domoticz-Server Branch: master

Device Type Handlers

  • DomoticzOnOff - Device type for on/off type switches and Lights
  • DomoticzBlinds - Device type for screens, blinds, and roller shutters
  • DomoticzScene - Device type for Domoticz defined Groups and Scenes
  • DomoticzContact - Device type for Domoticz defined contact sensors
  • DomoticzMotion - Device type for Domoticz defined motion sensors
  • DomoticzSmokeDetector - Device type for Domoticz defined Smoke detectors
  • DomoticzSelector - Device type for Domoticz Selector, it is a multistate switch, this is a PARENT device
  • DomoticzSelectorState - ChildDevice type that belongs to domoticzSelector, it implements a single state and makes it independent of how many states there are
  • DomoticzSensor - Device type for Domoticz Sensors (temperature, humidity and pressure)
  • DomoticzPowerReport - Device type that will provide overview of Power usage or Gas usage that is reported through Domoticz utility devices
  • DomoticzThermostat - Device type for Domoticz devices that the SetPoint capability
  • DomoticzDuskSensor - Device type for Dusk sensors (day/night illuminance)

CAPABILITY Device Type Handlers - used by Domoticz Server

  • domoticzOnOffButton - currently used for Lightwaverf Mood
  • domoticzOnOffGraph - Used for displaying power usage graphs
  • domoticzSensor Air Quality
  • domoticzSensor Barometric Pressure
  • domoticzSensor Battery
  • domoticzSensor Gas Meter
  • domoticzSensor Illuminance Measurement
  • domoticzSensor Power Meter
  • domoticzSensor Relative Humidity Measurement
  • domoticzSensor Signal Strength
  • domoticzSensor Sound Sensor
  • domoticzSensor Tempertature Measurement

COMPONENT Device Type Handlers - used by Smart Screens

  • DomoticzBlindsSmart - ChildDevice for attributes needed by Smart Screens app (control based on sun and wind)

Setup

Before adding devices to Smartthings you should whitelist the local network you are using in Domoticz. If not, the sendHubCommands that are send locally from Smartthings to Domoticz will not be accepted by Domoticz.

Configure the APP

Wiki Dudz40 ST Setup.png
  • To initially setup the Domoticz Server tap the configure Domoticz Server menu item. It will open the next Menupage.
  • When this is completed, tap the Add all devices of a type menu item. It will execute the command to retreive the information from Domoticz.
  • To list the devices that are defined now within Smartthings tap the List installed devices menu item
  • To create a device that consists of multiple source devices from within Domoticz, Create Composit Devices. This can currently be used on the following base devices in SmartThings, Temperature Device, Thermostat Device, and a Motion Sensor.
  • For special cases where you experience problems with updating status within Smartthings you can get a new access Token. This is done with the Revoke/Recreate Token. It will execute the command immediatly!


Configure Domoticz Server

Wiki Dudz40 ST Configure.png
  • IP Address of the Domoticz Server in your local network
  • Port number of the Domoticz Server
The default is 8080
  • Device types you want to add.
You will have a choice of "Window Coverings", "On/Off/Dimmers/RGB", "Smoke Detectors", "Contact Sensors", "Dusk Sensors", "Motion Sensors", "(Virtual) Sensors"
  • Support Room Plans from Domoticz
  • Select the rooms
Select one or more Room Plans. It will enable you to have just one room with all the devices that you want to appear in SmartThings
  • Add Groups from Domoticz
If you have define Groups in Domoticz it will add these as a switch device in Smartthings.
  • Add Scenes from Domoticz
If you have define Scenes in Domoticz it will add these as a switch device in Smartthings. Be aware that only ON commands are executed against Scenes.
  • Debug trace output in IDE live logging
This will output extensive debug information into the IDE Live Logging.



Add All Devices of a Type

Wiki Dudz40 ST Add.png


List Devices

Wiki Dudz40 ST List.png


there is a section for swith type devices, sensor type devices and Thermostats


Create Composite Devices

Screenshot 20180303-193420.png

The first page will show the device that eligible for selection to be a composite device. When you click on Add Capabilities it will show the next page where you can add the different capabilities that are available to this device. The source devices and sensors are in Domoticz and include all devices including devices that are set as UNUSED in Domoticz.

You will see an image that represents the type of base device you are adding capabilities to. Temperature devices, Motion Sensors and Thermostat devices.


Dudz40 ST Composite Motion.png

MOTION BASE. This is an example for a composite device that add other capabilities, in this case it was originally a Hue Motion Sensor, this sensor is split up in different devices in Domoticz, a Lux and a Temp component. As you can see it is reassembled into one device again in SmartThings. You can also add a capability that report Power Usage.


Dudz40 ST Composite Thermostat.png

THERMOSTAT BASE. This is an example for a composite device that add other capabilities, in this case it was originally a Nefit Thermostat. You can add Humidity, Power Usage and Gas Usage devices to the Thermostat base. You can select Domoticz Selector Switches as a source for allowed Fan Modes and Thermostat Modes. This is based on the Daikin implementation in Domoticz. If you need you can define virtual selector devices yourself in Domoticz to define these modes for Fan and Thermostat. The selector device will be defined by the app as a MultiState button device in SmartThings. When you assign this switch in this screen you are able to automate and control the modes of the Thermostat. Below you will see an example of the Selector device in SmartThings and and Example of the Thermostat Device.


Dudz40 ST Composite Temperature.png

TEMPERATURE SENSOR BASE. This is an example for a multisensor device. Select the type of other sensors you want to add. You can also add two types of custom sensors (type=general) from Domoticz.



Setup of the Domoticz Software for Smartthings use

When you have clicked DONE in the SmartApp and it has defined and installed the devices you need to make some modifications to the Domoticz setup to have status updates flowing from Domoticz to Smartthings. These notifications are send to a Smartthings Endpoint that will react to this event with a request for status to Domoticz. These notifications will be send when you change the status in Smartthings and also when you change the status in Domoticz or by using a remote. The RFXCOM transceiver will communicate these signals normally to Domoticz if a remote is used. There is an exception to this and that is the Somfy remote, these are not recognized by RFXCOM.

Making sure that local networks are white listed

Domoticz Whitelisted Local Networks

To define the local networks that can access Domoticz whithout using a username you should go to SETUP -> SETTINGS and add your network segment to Local Networks (no username/password):


Enable Domoticz Notifications

Wiki Dudz40 IDE urlCustomActionHttp.JPG

To define to Domoticz how it can access the Smartthings endpoint you need to copy the content of state.urlCustomActionHttp to Domoticz. You find the content by going into the IDE and click My Locations -> Installed SmartApps -> Domoticz Server. Paste the content by going to Domoticz Setup -> Notifications and enter it into URL/Action: of Custom HTTP/Action. Also check enabled.


Wiki Dudz40 Domoticz Action.JPG


Troubleshooting

1. I don't know how to create a custom smartapp


See the explanations of a fellow community member here:

http://community.smartthings.com/t/faq-an-overview-of-using-custom-code-in-smartthings/16772


2. I created the smartapp in the IDE, but I don't know where to execute it


For the initial setup, under the ST app, click on the Marketspace? item in the bottom menu, and then, on the smartapps link and finally, MyApps (last item in the list).

If you still do not see your smartapp, please make sure that you have published it in the IDE!


For any subs?equent execution, under the ST mobile app, click on automations>smartapps in the bottom menu. The list of installed smartapps will then appear.


3. Status updates are not being displayed in Smartthings

  • You have not enabled Notifications in Domoticz, either on the device itself or as a system setting.
  • You have an invalid access token. This can be checked by pasting the urlCustomActionHttp in your browser and hit enter, it will show the error
  • The urlCustomActionHttp value has not been correctly pasted into Domoticz, you will see http Failed in the Domoticz Log

Smart Screens - A related smart app

Features

This app is aiming to control different type of window coverings that must have the windowShade capability. Controls can be based on weather conditions like Sun, Cloud cover, Wind and Temperature. Control can also be based on Airco operating mode. The app will get your country based on the location of the hub and will apply the metric system in use for that country.

It defines 3 types of coverings:

  • Screens - Type of covering used outside, can either be horizontal or vertical, both are prone to wind damage if the wind is too high
  • Inhouse Screen - Type of covering used inside the house, as such no problems with wind
  • (roller) Shutter - Type of covering used outside, can offer protection against wind besides sun protection

It allows you to choose a specific weather API provider, DarkSky, OpenWeatherMap or WeatherUndergound (including PWS or exclude PWS) it will find the nearest for your Hub location. As an add on it allows for selction of a Netatmo device to provide wind data for the app.

  • The App will calculate the position of the Sun, it will be used to see if your coverings need to be operated when the sun is shining (actually it looks at the amount of clouds that is forecasted). This will be evaluated every 30 minutes.
  • The App will reverse the operation if the cloud cover is above your defined percentage this will evaluated every hour, this will prevent shades reversing the operation too many times.
  • The App will check for wind speed and direction every 10 minutes and reverse operation if you have outside screens that can be damaged if wind is above a certain speed. If wind direction is not window covering direction no action is taken. The opposite is also true for roller shutters, that can provide protection when winds are high.
  • The app can operate based on outside and inside temperature to keep things cooler inside. This will only work if you enable it and define outside temperature limit. You can also define inside temperature limits by selecting temperature and sensor that provides the data. Control will only be done when cloud cover is below a predefined percentage.
  • The app can control coverings based on a selected Airco going into an operating state of "cool", when it happens all other controls are bypassed (apart from wind protection). This behaviour is cancelled when the mode is changed to something else as cool.
  • Coverings can be protected against windows or door opening, select the related contact and control will not be done when it is open.

Setup

Dudz40 SmartScreens Setup Weather.jpeg

Forecast Weather You can make a selection out of WeatherUndergroup (with or without Personal Weather Stations- PWS), without PWS usually gives a professional weather station nearby. Alternatives are DarkSky and OpenWeatherMap. You need to obtain an API key to connect to these services. By tapping on the field below the API key you will be brought to the page you need. When registered, copy paste the requested key in the app field. For increased safety you can select to have the next hour of forecasted wind data interpreted as well, when you do the app bases its wind decisions on speeds from both current and the forecasted data, the highest wins.

Netatmo Interface When selected you will see all devices with a capability of sensor, this can be many devices, select the ones are the windmeter devices from Netatmo. You can select multiple, the wind speed and direction are being used as the data to decide upon.

Dudz40 SmartScreens Setup Coverings.jpeg

Select Window Shades Here you select the devices you want to control using this app.

Configure Window Shades These are the devices currently under control of the app, when you tap it, a page will be shown where individual definitions can be made.

Dudz40 SmartScreens Setup TempControl.jpeg

Enable Temperature Protection When selected, the app will also take temperature into account when operating the shades.

Act above Outside temperature Provide a number, when the temperature outside rises above this the app will execute control defined on the individual blinds. When no control is defined, no action takes place for temperature.

Act above Inside temperature (default) Provide a number, when the temperature inside rises above this the app will execute control defined on the individual blinds. When no control is defined, no action takes place for temperature.

Act on inside AND/OR (default) Default logic when both temperatures are selected

Cloud Cover The current forecasted cloud cover needs to be below this to have temperature control kick in.


Dudz40 SmartScreens Setup OffSeason.jpeg

Off Season definitions Scheduling of the operations will be suspended during the defined period.

Environment Info See a page internal definitions for forecasted conditions. Also you will see under temperature how temperature conditions are being evaluated.


Configure individual blinds

Dudz40 SmartScreens Configure General.jpeg
General settings

'Types' Define the type of window Shade. Inhouse screen is not affected by wind, same goes for outside roller shutter. Screen type (outside) is affected by wind and could be damaged by high winds. Roller shuuter can provide protection against high winds.

'Select Orientation' This is the orientation the window is facing, looking out to.

'Related door or window contact' Is there a contact sensor that will report open/closed. If open it would interfere with the operations of the shades. So if you define one, the operations are halted for this window shade until closed.


Dudz40 SmartScreens Configure Sun1.jpeg
Sun Protection

'Action to take' What operation to carry out for protection against sun.

'Below Cloud Cover' Operation until what forecasted cloud cover, if above the action will be reversed. This will be checked hourly.

'Below wind speed' Operations will only be caried out when wind is not above this value. Only for Screen type window shades

'Wind Protection' Perform the operation entered when window shade type is shutter when the wind speed is above the value entered.

'When Airco starts cooling' Perform the operation entered when the selected Airco (Thermostat) goes into cool mode

Dudz40 SmartScreens Configure Temp.jpeg
Keep it Cool

'Action to take when outside temp' What operation to carry out for protection against outside temperature.

'Logic AND/OR' Operation until what forecasted cloud cover, if above the action will be reversed. This will be checked hourly.

'Above inside temperature' Operations will only be caried out when wind is not above this value. Only for Screen type window shades

'Select inside temperature sensor' Perform the operation entered when window shade type is shutter when the wind speed is above the value entered.



End Of Day Processing

'EOD Action' Operation that will be performed at Sunset plus or minus the offset below

'Sunset +/-' offset in minutes before or after Sunset


Start Of Day Processing

'SOD Action' Operation that will be performed at Sunrise plus or minus the offset below

'Sunrise +/-' offset in minutes before or after Sunrise