GET, POST Requests with C#

  • 163 Views
  • Last Post 01 February 2014
Rod posted this 07 January 2014

Okay,

I've added this to uservoice so those who are keen to see it comment and vote it up. I've added 3.

http://incontrolha.uservoice.com/forums/218427-general/suggestions/5390053-add-actions-to-incontrol-http-get-post-run-file

Any other suggestions post here.

This may be a bit more complex but I was also thinking about adding the the ability to Set Variables, like the Android App Tasker. This would allow better control of Conditions.

Josh

Order By: Standard | Newest | Votes
monkey-magic posted this 09 January 2014

This is about as far as I've gotten.

Now I'm no programmer, just a hack but this code works in Visual Studio Express 2013.

When saved via notepad as xxx.cs and put in pre or post script it doesn't seem to work so I'm not sure what I'm missing.
The http get request goes into sURL = "http"; that line.

Josh


[code]using System;
using System.Net;
using System.IO;

namespace MakeAGETRequest_charp
{
///


/// Summary description for Class1.
///

class Class1
{
static void Main(string[] args)
{
string sURL;
sURL = "http";

WebRequest wrGETURL;
wrGETURL = WebRequest.Create(sURL);

Stream objStream;
objStream = wrGETURL.GetResponse().GetResponseStream();

StreamReader objReader = new StreamReader(objStream);

}
}
}[/code]

Rod posted this 11 January 2014

I'm thinking that the UI should have native support for this instead of writing a script for it(drop down selector to pick type and then a field for information) . It's the backbone of communication to the Internet of things. Ryan, what are your thoughts? Plugins for other wifi devices aren't necessary with this as all(?) have web hooks of some kind.

monkey-magic posted this 11 January 2014

I'm thinking that the UI should have native support for this instead of writing a script for it(drop down selector to pick type and then a field for information) . It's the backbone of communication to the Internet of things. Ryan, what are your thoughts? Plugins for other wifi devices aren't necessary with this as all(?) have web hooks of some kind.


Looking around it appears that there is a chance WiFi makes the 'standard' of Internet of Things. Apparently a lot of home automation things at the CES this year.

I'd agree with a plugin of some sort built into the software to allow control of other items would expand the use of the software and help to mitigate if Z wave doesn't make it.

Josh

Ryan-Scott posted this 14 January 2014

I'm thinking that the UI should have native support for this instead of writing a script for it(drop down selector to pick type and then a field for information) . It's the backbone of communication to the Internet of things. Ryan, what are your thoughts? Plugins for other wifi devices aren't necessary with this as all(?) have web hooks of some kind.


Interesting idea... how do you envision it integrating into InControl?

Rod posted this 14 January 2014

So instead of the two options to insert a file for pre and post you have a tab called actions which you can add actions to the scene like tasker.

Ie. Tasks like tasker

So the options are:

Get
Post
Run file
Pre script
Post script
Etc

You can add as many as you like. Like your conditions. This way you have a nice GUI for scripts.

Rod posted this 14 January 2014

I also agree that Zwave might die off. I'm not sure we need it vs such an already available and secure infrastructure such as Wifi.

Ryan-Scott posted this 14 January 2014

So instead of the two options to insert a file for pre and post you have a tab called actions which you can add actions to the scene like tasker.

Ie. Tasks like tasker

So the options are:

Get
Post
Run file
Pre script
Post script
Etc

You can add as many as you like. Like your conditions. This way you have a nice GUI for scripts.



So you'd want to have the activation of a scene be able to execute HTTP commands? Or are you talking a new device that does an HTTP command to get the status of a device, or perform a POST to turn on/off, etc.?

Ryan-Scott posted this 14 January 2014

I also agree that Zwave might die off. I'm not sure we need it vs such an already available and secure infrastructure such as Wifi.


It's strange to hear these musings about z-wave not making it. Z-wave is strong right now... I just got back from CES and they had by far the largest amount of floor space and booths when compared to anything wifi in the home automation arena. Are there other articles that you guys have seen to suggest it's struggling?

Rod posted this 14 January 2014

"So you'd want to have the activation of a scene be able to execute HTTP commands? Or are you talking a new device that does an HTTP command to get the status of a device, or perform a POST to turn on/off, etc.?"

Could be HTTP commands, running files... etc. It's going to be almost impossible to keep up with the WIFI devices in a year creating plugins for each one when almost all support some sort of POST or GET command. Updating your plugins might be difficult too when they add new wifi devices (WeMo plugin) like the new Belkin Slow Cooker...

" from CES and they had by far the largest amount of floor space and booths when compared to anything wifi in the home automation arena. "

No, I haven't looked for any articles, this is just an extrapolation from my head Z-wave is definitely the widest used protocol with home automation products at the moment but you're creating two wireless communication networks in your house... Why not just create one (wifi) that's used for all your devices. AC dual band networks are eliminating a lot of the old issues of Wifi. Ie. Philips Hue and LimitlessLED are pretty awesome and the current Zwave solution doesn't really work with it (needs constant power) and that zwave dimmer becomes just a communication device to set the level of the LED's (not the colors).

This is obviously just IMHO and I'm just trying to come up with the best use of your development of this awesome product Ryan.

jonfrance posted this 14 January 2014

I don’t think that the home automation market has decided on a single communication protocol, and probably won’t for a long time if it does. I’m not even sure if I could say that I’ve read that it is even leaning one way or another.
I agree that zwave is around to stay for a long while, which is why I decided to start my investment in those products. With large company names manufacturing zwave products and other companies like ADT using them in their systems etc. I don’t see it going anyway anytime soon.

That being said, it is not going to be the only device that I will want to use, and the market is starting to respond to this with things like the Staples Connect System which appears to support multiple protocols (including zwave).
I recently ordered some of the LimitlessLED bulbs to try out as they looked to be the best solution for where I want to put them.
The best thing about InControl software, the company and its developers; and the main reason that I choice this software in the first place, is because of the flexibility. LimitlessLED offer an API (another reason I’m trying them), so I know that I will be able to integrate them into InControl. If I had invested in nearly any other zwave controller software, or dedicated hardware hub, I’m sure that it would be a struggle to do anything not out-the-box zwave specific.

Ryan-Scott posted this 14 January 2014


I recently ordered some of the LimitlessLED bulbs to try out as they looked to be the best solution for where I want to put them.
The best thing about InControl software, the company and its developers; and the main reason that I choice this software in the first place, is because of the flexibility. LimitlessLED offer an API (another reason I’m trying them), so I know that I will be able to integrate them into InControl. If I had invested in nearly any other zwave controller software, or dedicated hardware hub, I’m sure that it would be a struggle to do anything not out-the-box zwave specific.


Those look cool. I picked up some of the Phillips HUE bulbs and have started on a plugin for them as well. These LimitlessLED's are much cheaper though - let me know how they work and I'll gladly help contribute to a plugin for them as well.

Do they require a bridge of some type or do they work as stand-alone devices?

Rod posted this 14 January 2014

I agree with you, Zwave is here to stay for some time to come but as a manufacturer (say a Kickstarter campaign) of a new product my options are:

1. Build a product that works with WifI or Zwave? Why would I build a product to Zwave when everyone already has wifi and a phone in their hand. I understand there are some security benefits but there is a larger potential audience available with Wifi. Building an API can have much more features with wifi.

Sorry about this post going sideways. I just think that easy WIfi device support could easily be integrated. C# scripts are giving me an ulcer .

jonfrance posted this 14 January 2014


Do they require a bridge of some type or do they work as stand-alone devices?


Yes, they require a bridge....but at the moment it's on sale for $17, can't really go wrong for that price.

FYI - API details are here.
http://www.limitlessled.com/dev/

Rod posted this 14 January 2014



Do they require a bridge of some type or do they work as stand-alone devices?


Yes. They communicate rf to the wifi bridge. The downside is that they don't have any par30 or mr16 replacement like the HUE

Ryan-Scott posted this 14 January 2014



The downside is that they don't have any par30 or mr16 replacement like the HUE


What's par30/mr16?

Rod posted this 14 January 2014

Ceiling / pot lights.

monkey-magic posted this 14 January 2014

So instead of the two options to insert a file for pre and post you have a tab called actions which you can add actions to the scene like tasker.

Ie. Tasks like tasker

So the options are:

Get
Post
Run file
Pre script
Post script
Etc

You can add as many as you like. Like your conditions. This way you have a nice GUI for scripts.


I like Rod's idea, in the activate scene a drop down box to select, if you see two pre scripts you like you can add them both in and not be limited to just one.

I also think it would increase the usability of InControl as it would make adding a plugin for every web connected device less necessary as most will have HTTP support.

I mentioned the article (although it was more someone's opinion) that mentioned that WiFi is likely to be the internet of things. I'll try and find it if I can but I read it on Flipboard.

I think the gist of his thoughts was that WiFi is the most recognised by the average person and most people already have a WiFi router. Early adopters, who most people here are, know z wave.
Personally Z wave in Australia is a lot more expensive (possibly due to licensing of the the Z wave chips, being on a different MHz and size of market) but the main reason I'm on it currently is the in wall controls of lights. I can already get WiFi control plug in power points for about a third of the Z wave costs.

If you want the idea added to the uservoice I'll happily move some of my votes to Rod's ideas.

Josh

monkey-magic posted this 14 January 2014

Here it is:

http://gigaom.com/2014/01/07/heres-why-smart-devices-without-wi-fi-face-an-uphill-battle-in-the-home/

http://gigaom.com/2013/12/31/whats-ahead-for-the-internet-of-things-our-ces-preview-podcast/

This was an older one I read:

http://gigaom.com/2013/05/29/zigbee-and-z-wave-are-out-broadcoms-new-chips-bet-on-bluetooth-and-wi-fi-for-iot/

I really like InControl, esp with Ryan on here and the feedback that gets taken on board and I'd really like it to succeed.

If I had the option to add multiple HTTP get requests in the activate scenes, I'd have IR control, squeezebox control all done. If there was a wiki, I'd be more than happy to add how to's in as well.

It just really expands what the software is capable of and would get it out to a larger audience.

Josh

Rod posted this 14 January 2014

I was thinking having a tab like at the bottom where you have conditions have another called actions. Here you have a add or delete button to add as many scripts/gets/posts etc and either attach it to "pre" or "post".

Rod posted this 14 January 2014

Josh

Which one is this "get WiFi control plug in power points for about a third of the Z wave costs."

?

Show More Posts
Close