SmartThings Community

Connection to Domoticz defined devices like Blinds and On/Off switches

somfy
x10
rgbw
project_shades

(Martin Verbeek) #1

As my first groovy and ST experience I have created a SmartApp that connects to a Domoticz server and will define some of the Domoticz connected devices into ST as Switches and Blinds. Status changes on these devices (using native remotes or something similar) will be routed back into ST using REST endpoint.

The first setup is with a SmartApp called Domoticz Server and two device types domoticzOnOff and domoticzBlinds. I am running Domoticz on a Raspberry pi with an RFXCOM device attached. This way you are able to define all kinds of legacy devices like Somfy, X10, CoCo and all ather stuff that is supported by this RF device (rfxcom.com) and integrate them into ST without individual ST device integration for all those protocols. You now can do things like open a blind when a door opens, close at sunset etc…

For feedback of status changes outside of ST you need to add notifications to Domoticz and enable oAuth.

Feedback and suggestions very much appreciated. Files are in public github, go to the Wiki for the link.

Made a start with the how-to of the setup in Wiki : http://thingsthataresmart.wiki/index.php?title=Domoticz_Server


SmartThings Controls X10 Switch -- Demo
Since the Somfy ZRTSI isn't available in Europe
LightwaveRF?
Smarthings with Visonic Powermax
Poll or subscribe example (to network events)
[RELEASE] HousePanel Dashboard for SmartThings and Hubitat
Xiaomi Zigbee Door/Window Sensor, Motion Sensor, & Smart Button Device Type [beta]
Domoticz + rfxcom + z-wave + zigbee
Rooms Manager: Smarter Rooms: Personalized home automation with Occupancy
[ON HOLD] Netatmo Thermostat Device Handler & Connect App
Smartthings, Europe and Brexit
(Arnoud) #2

Cool, I will have a look at it.

I am currently running Domoticz on a RPi2 with the RFXcom USB tranceiver to control my Somfy blinds in Europe, and recently purchased a Rev2 ST hub, so I would love to check it out to hook them up together.

A nice project for a rainy autumn day :wink:


Blinds/Shades/Curtain Control - No solutions for us EU Smartthings owners?
(Martin Verbeek) #3

I am from Europe as well :grin:. Took this a bit further, created a smartapp that looks at sun position and what cloudcover and it will determine if the blinds need to go down or at somfy stop position…nice playing with this…


#4

Where is the link? I’d like to try this.

thanks


(Martin Verbeek) #5

Link to the github

https://github.com/verbem/SmartThingsPublic.git for the Domotics Server and devices.


#6

Thanks for the link.

I have Domoticz and HomeGenie installed on a Pi.
I thought my CM15a was working with Domoticz but it’s actually only working HomeGenie so I haven’t been able to try this.


(Vagelis F ) #7

I have created the smart app and generated the token.
Then I go to Domiticz server and enable Custom HTTP/Action.

Then I go to URL/Action and input sth like this:
https://graph.api.smartthings.com/api/smartapps/installations/put the ST App id here/EventDomoticz?access_token=put the oAuth token here&message=#MESSAGE

put the ST App id here = the id that I have at the end of the url when I see the code of your smart app or sth else?
access token = is it the oauth client id or not?

I did the above and while I can see the app and setup my Domoticz server ip and port then it does nothing.
What it is supposed to do?To show new devices so that I can add them or what?

Please elaborate on that so that I/we can check and deploy correctly.

Thank you.


(Vagelis F ) #8

I also went inside the code in https://graph.api.smartthings.com/ in the simulation.
At the bottom it says:
-API token
:API endpoint

so I re-arranged the url and when i put it in my browser I get no Apache error.
But after that what am I supposed to do/expect?New devices?


(Vagelis F ) #9

I was missing the device type.i searched and found it in github.After installing the device type on/off, the smart app has listed the 4 new device.Then i press Done but am not actually seeing any new devices.

Now what?


(Martin Verbeek) #10

Could you uninstall the smartapp and redo. Might be that the devicetype was not in place upfront of smartapp discovery. Your devices should show up under devices with a device id of ipnumber:idx.
Just had to do it again when i went to hub v2.


(Martin Verbeek) #11

I will post some screenshots tomorrow of the http action and oauth url in domoticz


(Martin Verbeek) #12

If you go in the ide and look at the smartapps properties you will see url, which is the first part of url/action in domoticz settings. The oauth goes after accesstoken. You will end up with someting like this.

https://graph.api.smartthings.com/api/smartapps/installations/3f72cb43-e31a-44e8-bea2-8ad7169b9c24/EventDomoticz?access_token=4ca2d199-a2b5-432e-9e2e-acc432e5a589&message=#MESSAGE

Than you have to specify the on and off notification for http on your 4 switches in domoticz. You do that in switches pages with notifications button on the switch.

The reason for this is that if you switch on or off outside of smartthings it now gets communicated from domoticz to the ST endpoint and update the status in ST.


#13

Good morning, Thank you for your work on this.

I am having a bit of trouble setting this up. I am based in the UK with a v2 hub - do I need to change the token URL to use https://graph-eu01-euwest1.api.smartthings.com ?

Many thanks,
Barry


(Martin Verbeek) #14

I guess so, i have not tested it for europe, you should see the url for app in the ide under my locations and list smartapps, select domoticz server, you will see url. Use that one in Domoticz setup for notifications.


(Vagelis F ) #15

In you app in the “List devices” it shows my switches (I added some RF 433Mhz) with an idx.
They don’t show up in graph.api devices or in the smartthings app.

Should I add them manually and use that idx code somewhere? (maybe in network id??)

Can you please make a tutorial especially for the notification part?

Thank you!

PS1:I updated your app and I have an unexpected error.
in live log: java.util.ConcurrentModificationException @ line 453

PS2" I got it working!Even if it throws the error,the devices were created and function flawlessly!
So the only thing that I want is the notification path explained.
In the Domoticz switch it would be sth like:https://graph.api.smartthings.com/api/smartapps/installations/OAUTH/EventDomoticz?access_token=ACCESSTOKEN&message=#MESSAGE ?

So for my EasyBulb Left I should put as Message: #left on for ON and #leftoff for OFF , for example?

By the way,many ,many thanks!!!


(Erik V) #16

I’m running into some problems setting this up.

My Domoticz is sending notifications to SmartThings (I can see in the ST logs that notifications are received from Domoticz switches or tests).

However it seems that the communication from ST towards Domoticz does not work. I installed both device types and the smart app as above. When installing the app, I set the IP address of my Domoticz server and the default port 8080. I don’t get any devices showing up anywhere from here… I see in the logs that the IDX remains 0 and I get 0 child devices. Funny thing is that when I change the IP address to any other IP, I get the same messages.

What am I missing here? Is there some firewall on the Domoticz server that I’m not aware of or should I use a different port? Do I need to set something in Domoticz to make the switches I have installed recognisable by the ST SmartApp? Any help would be appreciated here…


(Martin Verbeek) #17

After defining the ip, port and type of devices you want to have from domoticz. Do you also have executed the add devices? It is a seperate step. After that you should have some devices. If not could you post a domoticz screenshot of one of your devices from the devices screen in domoticz? Or better output from this command to your domoticz server ip:8080/json.htm?type=devices&filter=all&used=true&order=Name


(Martin Verbeek) #18

You will have two places in domoticz that you need to do something to make it work.

In the setup/settings/notifications part and in the devices part. In the custom HTTP/Action part do the following url/action:

https://graph.api.smartthings.com/api/smartapps/installations/13d9119a-ca69-4029-9a0d-6b3340bd24d0/EventDomoticz?access_token=f6998c17-b588-4f35-8223-03963ba36e8f&message=#MESSAGE

The second part is on the switches screen of domoticz, for every device you want to report back you need to tap the notifications button. In that screen add switch on for http and switch off for http. Http is under active systems. So no strange custom messages in this screen, the url above is only in the setup of notifications…


(Erik V) #19

After defining the IP, port and type of devices, I’ve clicked “Add All Devices of a type”. In here I first get “Add Domiticz Devices” (which doesn’t mention any devices) and then “Adding Devices” (which also doesn’t mention any devices).

If I go to the link (server ip:8080/json.htm?type=devices&filter=all&used=true&order=Name) I do get a list of all my devices. I’ll just post a virtual switch I created to test down here (as the whole list is quite long).

  {
     "AddjMulti" : 1.0,
     "AddjMulti2" : 1.0,
     "AddjValue" : 0.0,
     "AddjValue2" : 0.0,
     "BatteryLevel" : 255,
     "CustomImage" : 13,
     "Data" : "On",
     "Description" : "",
     "Favorite" : 0,
     "HardwareID" : 4,
     "HardwareName" : "Domoticz Dummy",
     "HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
     "HardwareTypeVal" : 15,
     "HaveDimmer" : true,
     "HaveGroupCmd" : true,
     "HaveTimeout" : false,
     "ID" : "001407D",
     "Image" : "Alarm",
     "IsSubDevice" : false,
     "LastUpdate" : "2015-11-01 13:16:24",
     "Level" : 0,
     "LevelInt" : 0,
     "MaxDimLevel" : 15,
     "Name" : "People Present",
     "Notifications" : "false",
     "PlanID" : "0",
     "PlanIDs" : [ 0 ],
     "Protected" : false,
     "ShowNotifications" : true,
     "SignalLevel" : 7,
     "Status" : "On",
     "StrParam1" : "",
     "StrParam2" : "",
     "SubType" : "AC",
     "SwitchType" : "On/Off",
     "SwitchTypeVal" : 0,
     "Timers" : "false",
     "Type" : "Lighting 2",
     "TypeImg" : "lightbulb",
     "Unit" : 1,
     "Used" : 1,
     "UsedByCamera" : false,
     "XOffset" : "0",
     "YOffset" : "0",
     "idx" : "46"
  }

The settings in Domoticz (custom HTTP/Action and switch notification) I did already set-up. If I click the test-button or change the switch status, I can see this showing up in my SmartThings logging (in the IDE) without issue.

It seems that Domoticz is doing everything as it should, but the SmartApp doesn’t pick up on the list of switches


#20

I am having the same problem. No switches show up from Domoticz into SmartThings but I do get a result from the URL as above.