Architecture advice needed

I need some advice - and while netmf doesn’t need to be part of the solution (and in fact, most likely won’t) I know there’s a lot of people here who have experience in this area and can provide input.

I have a commercial device on my home network that has a web server that has a number of simple HTTP POST REST interfaces to control the device (my AC unit). There’s a proprietary method for controlling the device from an app on the internet, but it only supports iOS and android, and I want a more general (but still secure) way to control this so I can use it from my Windows PC and Windows Phone.

This seems like a “standard” home automation setup, of which I have nil real exposure. Like all HA systems, I can see this expanding to more than just the AC control (at least monitoring of temperatures, door states from reed switches via Fez devices, solar inverter status/output etc), so thinking that a more “robust” solution than a one-off might be longer term beneficial.

So I’m thinking about options. I don’t want to just open a port through the router - in fact that’s probably something I don’t want to do, I’d prefer to use a command-and-control channel like Azure IoT Hub does, that needs no inbound network access. I like solutions that are secure out of the box (I know, that’s a relative measure and probably a pipe dream, but I’m not a Linux security expert for example and I don’t want to become one, just to secure something - yes, I’m looking at you node-red). I don’t want to have to spend lots of time writing an app, so a pre-canned, simple to modify mobile web site would be a good starting point.

Anyone with suggestions? Anyone recently embarked on this and can describe their findings?

NT 4.0

1 Like

Lol, Classic Bill.

I don’t think I understand your problem set well enough; so let me see. You are aware of the HTTP Rest interface. But that interface requires something on the internet to work? There is a local way of controlling the device, however it’s hidden behind some propriety piece of software. So you are trying to find a way of controlling the device from…? A remote control, a wifi button etc?

there’s a “local network” way of controlling the device through REST. Technically with port forwarding you could extend that to the internet - but it’s HTTP only, and the UID and Pwd are in unencoded form in the URI. The proprietary app on iOS or android sits behind a play-store or Apple API call so you get security there (but the device registers with a cloud service with a HTTP call - but that’s a different problem, one I can’t control). The cloud service has no public interfaces so nothing I could “shadow” to create an equivalent. So really all I want is to create a proxy on my local network that I can relay commands via.

As a simple example, I could have a Fez Cobra on the local network, that issues HTTP requests to the AC. The cobra has a display, so I could have push buttons to show status and to control the AC. I could also have a webserver running on the Cobra, with HTTPS, that had simple authentication and offered a simple web display to show status and control the AC. I could set up port forwarding on my home router, to allow incoming traffic to the Cobra - at this point I would have an internet accessible “secured” version of the AC control. But I know I don’t really want to do just the AC control over time…

I expect I can do this with a home automation framework - something like node-red or OpenHAB, although I don’t know about the “extend to the internet” aspect - but it could also be done from Windows 10 IoT Core and Azure IoT hub. Just wanting to solicit thoughts because like EDA tools, I expect once you spend time with one of these options you don’t tend to go back and re-do the solution, you stick with what you have…

And just to be clear, the device is pretty simple - on/off toggle, heat/cool toggle, fan level (cycle thru low/med/high), zone on/off toggle for 3x zones, and temperature adjustment +/- (altho the API is set temp to a specific number). From a UI perspective, a web page with several buttons making AJAX-type calls is as simple as needed.

Ok I think i understand, You want to control it from outside the home network, with HTTP REST commands. Have you considered a VPN from your android device to your home network so that the app on your IOS or android device can talk to the A/C?

Sound like Home Automation to me and after 8+ months with Node-red I would say run with that. It’s super reliable so far. Not a single reboot or failure in that time.

You can do lots of HTTP stuff from that and there is Azure plugins for it too.

It looks daunting when you first look at it but I can assure you, as a programmer yourself, you will quickly pick it up in no time.

PLUS, you can add all of your home automation to it as you expand the system. I just added a NodeMCU based gesture sensor to my office that spits out to MQTT so that with the wave of a hand on entering of leaving, the lights go on and off. Added a second one to my daughters room next to her bed. She thinks it’s cool to wave her hand before she sleeps to put the light off without getting out of bed to do so :slight_smile:

@ Dave is node-red the complete solution to this? How would you approach it with Node Red ?

It’s not the complete solution but part of it. You want something that can send HTTP REST commands to the device and using Node-red this is as simple as writing a simple script that create the REST API. What Node-red allows over and above this is to link these requests with other inputs, be it a time (BIG TIMER) or trigger inputs from the dashboard. The dashboard allows you to create a browser interface for your control inputs or display values etc.

By tacking on MQTT you can control everything with a simple APP that sends MQTT messages and or receives them.

If you have time and have a Raspberry Pi or any other Linux based board lying around, grab it and try it out. You can use an inject node to test your HTTP output.

This a few screen grabs of the setup I have here. It looks complicated but is easy enough to follow. :slight_smile:

finally have a bit of time to start tinkering here.

Have a RPi with node-red running. Tested with the dummy event they talk about, via the node-red web interface on the local network, seems like I have it working :slight_smile:

Now thinking about MQTT. Briefly looking I am guessing I need to decide on an internet hosted broker - suggestions on who to use? At the moment I’m interested in tests more than actual sources (since I have none :slight_smile: )

How do you visualise your environment? Do you have a dashboard that can show you status of things? I’ve got in mind some data from the solar inverter and temperature sensors etc, nothing too fancy to start, how would you approach that?

Very interesting discussion you have going on here. Following along, as I have similar interests.

Brett did you setup Node-Red on Win IOT?

Connecting Raspberry Pi with Windows IoT Core as a Device to Watson IoT using Node-RED
https://developer.ibm.com/recipes/tutorials/connecting-raspberry-pi-with-windows-iot-core-as-a-device-to-watson-iot-using-node-red/

Dave, your Node-Red development is off the charts!

1 Like

[quote=“Terrence”]Brett did you setup Node-Red on Win IOT?

Connecting Raspberry Pi with Windows IoT Core as a Device to Watson IoT using Node-RED
https://developer.ibm.com/recipes/tutorials/connecting-raspberry-pi-with-windows-iot-core-as-a-device-to-watson-iot-using-node-red/[/quote]

Oooh! Thank you. I’ve been wondering about that. :smiley:

Keep us posted.

1 Like

I used Raspbian Jessie (I used Lite). I haven’t tried with Win10IoTCore, but now you’ve surfaced that I may well give that a try

I have not either, but I am interested in your and Ian’s experience.

1 Like

TBH I’d be more comfortable running a Win10 IoT build as well, certainly gives me more confidence from a security perspective, not knowing really how best to secure a Linux box…

I’m with you. The Linux quagmire is a beast I can’t afford to conquer.

1 Like

[quote=“Terrence”]
I’m with you. The Linux quagmire is a beast I can’t afford to conquer.
[/quote]or afford NOT to conquer correctly!

:smiley:

@ Dave, I’m struggling to get node-red to show connected status to an MQTT broker - I have an app on my PC that I can connect to adafruit’s broker and subscribe and publish to, but using the same creds on node-red and same topics, can’t seem to get it to work. Do you recall if there was any additional config you needed to do to make that work?