SmartThings Community

[BETA RELEASE] URI Switch -- Device Handler for controlling items via HTTP calls

(Denis Grabocka) #82

Enis thank you for your reply,
I have a mochad deployment already set up for my X10 devices using a raspberry pi and CM15A i am not using the HA bridge for that purpose i am using the older device type / handler smart app for ST approach.
I also have a HA bridge server running that automates my roomba vacuum cleaner with a Roowifi adapter through Alexa. I have not created any of these approaches i have merely followed steps that others have written LOL
I do have 2 UPB dimmer switches already installed that used to work really well with an older automation system and a usb UPB control interface that registers as a HID but i have no clue of what to look for as far as how the mochad can communicate with the usb UPB interface or how to find the addresses of the UPB devices that need to be controlled.
I guess i am going to do some more research and hopefully with your help or expertise we can get this figured out :slight_smile: do you have any upb switches of your own??
Please continue to point me to the right direction and any help is really appreciated.

By the way judging by your name / member id i think we might be of the same back ground :slight_smile: … maybe apo jo vella?

Thank you again

(Enis Hoca) #83

Unfortunately I learnt about UPB reading your post :slight_smile: If you are not a programmer start with - its a node based project, if you don’t have node installed on your Pi do that first then follow the instructions on the github page.

Probably not :slight_smile: this is just my online identity -

(P Grant) #84

Thanks for this, I have set up the URI switch and it works great when I use the switch in the smartthings app, however when I use Core or SmartRules for the URI switch the URL request is not sent, the switch does turn on/off but I cant see anything hitting my webserver logs. Any ideas why this is?


(Troy Guerena) #85

That is strange. I have not tried using the CORE to tie in to the URI
switch. Generally speaking, I would think that the switch and the switch’s
triggers would line up to each other 1:1. In other words it sounds like
it’s working right, but maybe the switch isn’t? I’ll have to try with mine
later and see if it works.

Troy Guerena

(Garry Gross) #86

I hope this thread is still active. I’m trying to use this Device Handler to control my Hunter Douglas blinds. I have a gen 1 hub and it doesn’t have native Alexa or SmartThings integrated. however I’m able to access the APIs through my browser. For example executing closes one of my blinds. I would expect this to work with the URI Switch, but for some reason I can’t get it to work.

Here’s the Log:

7:17:58 PM: info postEventToEndpoint: event successfully posted.

7:17:58 PM: debug Property Change Event switch: off (source: DEVICE)

7:17:58 PM: debug GET /api/scenes?sceneid=7974 HTTP/1.1
Accept: /
User-Agent: Linux UPnP/1.0 SmartThings
Content-Type: application/x-www-form-urlencoded
Content-Length: 4


7:17:58 PM: debug Executing OFF

What am I doing wrong? Seems so simple. Thanks for your help and for the development. This looks like it has a lot of potential.

(Troy Guerena) #87

Can you send a screenshot of the smartthings setup for the URI Handler?

(Troy Guerena) #88

Garry, you may be interested in this:

(Garry Gross) #89

You are correct…That’s exactly what I needed. Thank you!!

(Martin Leonard) #90

OK, I’m tired, don’t know whats wrong.
When I use a web browser to post:
My device turns on as expected.

When I use URI Switch, nothing happens. Log file shows:

**4:12:46 PM: debug GET /tools?cmd=event%2CTurnOn HTTP/1.1 **
**Accept: / **
User-Agent: Linux UPnP/1.0 SmartThings

What am I missing?

(Troy Guerena) #91

Need a little bit more info to help you. Just judging by your message, looks like the issue might be that doing a POST is working, but doing a GET is not. Maybe a screenshot of your settings in smartthings? And a little info as to what you’re trying to setup?

(Martin Leonard) #92

Thanks for getting back to me so quickly.
Yes, I’m trying to post to the message /tools?cmd=event,TurnOn.
So I set URI settings like this:
External - not set
Internal IP
Internal port - not set
Internal On Path: /tools?cmd=event,TurnOn
Internal Off Path: /tools?cmd=event,TurnOff

I see the default in URI Switch uses GET

I have a wifi relay on the local network at that can be turned on/off in this way. I can get it working using Webcore, but I would prefer something that’s not cloud based.

[RELEASE] Sonoff, Sonoff TH, S20, Dual, 4CH, POW, & Touch Device Handler & SmartApp ($5 & $10 Smart Switches)
(Troy Guerena) #93

Have you tried changing the method from GET to POST?

(Martin Leonard) #94

Yea I tried just changing the GET to a POST in your device handler.
It did not work.
Maybe I need to provide extra parameters for the POST?

(Troy Guerena) #95

Generally, with a POST request, a payload is needed. Usually a beater token for auth or some other kind of json payload like {action:“on”} or something. It depends on what the device expects. Usually noted in the API documentation.

(Martin Leonard) #96

So I changed
method: “GET”, to
method: “PUT”, and it WORKED.

Thanks for all your help!

(Troy Guerena) #97

Great! Glad it worked. :slight_smile:

(Reeso3000) #98

Just set this up to control my blinds and its working great! thank you very much :smiley:

1 Like