Ok,
Sick of waiting for a response from Smartthings on supporting raw sockets from a local hubaction.
So I started developing a simple .NET application to relay the request via HTTP and then send it via a raw socket request and then return the response from the raw socket to the response to the hub.
Before I get too far, wanted to poll the community for need and some answers.
-
Is .NET 4.0 acceptable to most people? It comes pre-installed on Windows 8.x now and is a quick download.
-
Would you want an application running, or have it installed as a service?
-
Do you want on screen logging, or a text file or xml file outputted? All?
-
Will this request format work for most cases? http://ipofserver:port/?ip=xxx.xxx.xxx.xxx&port=xxxx&cmd=xxx&type=(udp/tcp)
What this .NET app will do is listen for web requests and split out the query string and then open a socket connection of type (udp/tcp) on port xxxx to ip xxx.xxx.xxx.xxx and send the cmd xxx and wait for a response for a few seconds and then close the connection.
It would then respond back to the request with any response from the socket or an error code. Either as a webpage, xml, or json.
-
what error handling would you like to see returned, ie timeout, no response,
-
how would you like to see the response, html, xml, json, other?
I already have the .NET app listening on a port / ip for a query string and have it echoing the request.
The next piece would be to relay the request to the raw socket and that requires a lot of devices to test.
I have the following devices I can test with:
-JVC Projector
-HTPC Remote Software (custom developed code to control mouse and keyboard commands)
-Pioneer AVR
-Sony AVR
-Sony TV
-HDMI Matrix Switch (using IP to serial adapter)
-Wattbox Power Strip
-Control4 16channel Amp
If anyone has any input, let me know. I’ll be unable to finish this project until next week, so this should give plenty of time to get thoughts.
Having socket relay would open the options to automate a lot of devices with smartthings and check the status of simple IP devices.
The one use case I have right now is I have a SONOS connect plugged into my 16 channel amp serving 8 rooms. I want to be able to turn that amp on, announce a Sonos action via Smartthings and then turn it back off.
It is as simple as sending to port 8080 on the IP of the amp, the raw command of a range of inputs and outputs and on or off. So to turn on room 3 to input 3 it is in3,out3 or to turn on all rooms to input 4 it is in3,out1-8. To turn off any output, its offX where X is the output.
Another example is I have a home theater and my kids occasionly leave the projector on. So I want to do a simple action to check for motion, check for projector status pwr on the ip of the projector and if pwr = on, then issue the command pwr off.
Hopefully Smartthings will implement socket support, but in the mean time this .NET app shouldn’t be too hard to implement, but I want to make sure I create something that is flexible enough to serve all the use cases.
Thanks!