Architecture advice needed

I suggest you install mosquitto broker on your Pi. Keeps all of your automation in house with no need for an Internet connection to mess it up when it goes down.

Suggest you try this. Back up your Node-red flows (flows-raspberrypi.json in the .node-red directory assuming your host name is the default) and then build a brand new Debian image for the Pi.

Then go and grab this awesome script from Peter Scargill and create a file in your /home/pi directory called script.sh. Make it executable (chmod +x script.sh) and then run it with ./script.sh

https://bitbucket.org/snippets/scargill/oAkRK

This will give you a text menu to select the options you want. This will also include things like the Amazon HA Echo-Bridge for later use. It will install all of the Node-red stuff you need.

After this copy your old flows-raspberrypi.json file back to the node-red directory. Depending on the host name you gave to the script, you may need to change the name of the json file and change the raspberrypi part.

If you want to chat over Skype on any of this, give me a shout.

Finally, there is heaps of good automation stuff on this website.

http://tech.scargill.net

I’d say the opposite. I was reluctant many times to run a Linux HA system simply due to lack of knowledge of the OS but I can say for sure it was the best thing I did. I was constantly cheesed off with the Microsoft issue of forcing updates to the system that would always take it down and it would not reboot cleanly or it would have some issue with a driver. Since switching to using Debian and there being no forced upgrade I am much happier and I have a more stable system. It also ensures happier family as I no longer get the “it’s not working Dad” from the daughter or “I hate this system” from the wife now. :slight_smile:

In saying that, GUI development under Windows is streaks ahead of Linux. I am working on a development for a touch screen and using QT5 and it’s a steep learning curve. I just wish there was a VS setup for Linux that was as easy to use with debugging without the complex GDB setups etc.

Mono with forms works great on Raspbian. Compiling and debugging on PC, and then doing final testing on linux/Mono.

I also use Xojo, but if I said so, it might start a fire storm. Develop on Mac and remotely debug on Pi. Ok, I said it. I have been programming in BASIC.

I looked at Mono but the complexity to setup debugging wasn’t worth the hassle. I prefer to debug the code on the target as then you see things like speed issues etc.

Android and NETMF are excellent. You just plug in and go with real time stepping etc. QT5 on VS with VisualGDB works well too but you do need to create a new project when you swap boards as it needs to download the code to the target. Once done though, you are ready to test and debug in the target device.

i have also used monodevelop to debug on Pi. Had to fiddle with solution file, but it worked fine for debugging machine specific issues.

@ Dave,

I am thinking that by installing mosquiito on-prem, that might to cut off one of the avenues of control I was aiming at… I was aiming to trigger actions from a phone when on the internet, which I assumed meant I would need to publish to a topic that node-red was subscribed to. Is that still feasible in your config, or do I need to expose something else to the internet that’s then accessible?

And I have ZERO real configs in node-red so blowing it away isn’t a problem, starting again allows me to make sure I did write down all the steps I followed on the web.

If you really need external access there is other options in the library. I prefer to keep it all internal and just have a web interface via the dashboard with secure login that then only allows me limited control as I need it.

@ Dave McLaughlin - Dave those are all good points. For me, a .net developer / SQL server / asp.net kind of dev, doing this micro stuff is hard enough on a familiar windows platform…moving to Linux is just that much harder…but I hear you.

Well, I really want external access, is that the same? The use case really is to turn the AC on or off before we get home, and while it’s more likely that we’ll have a compatible mobile device soon, I’d also like to make something for now.

What are the other options in the library, that you’d suggest I dig into? How did you set up the dashboard, is that an OOB for Mosquitto?

Keeping all of the normal automation inhouse without any external access means it runs even if you internet is down. Response time is also greatly improved. I used to use IFTTT but it added anything from 5 to 10 seconds to switch something on. Now I get almost instant response.

This is done with the DASHBOARD nodes. Create a new flow TAB and drop these in there and they will appear at xxx.xxx.xxx.xxx:1880/ui/

You could make port 1880 visible externally. You still need to log in so this is secure. You can then access your controls from outside without having any external servers.

1 Like

yep I get the reasons for wanting to maintain this internally and not use external services (especially in the fickle internet world where you’re potentially subject to acquisitions and changing charging models). My goal is really to allow limited external access, so opening an inbound port, no matter how trivially, goes somewhat against that, and then dealing with the security that brings may be a step too far.

I have found some info on MQTT bridging, so have limited cross-publication of data from the internal broker out to an internet facing service, and that might just allow me enough to turn things on and off when needed… so right now that’s probably how I’ll approach it.

Dashboard. I’m guessing you added this dashboard module? GitHub - node-red/node-red-dashboard: A dashboard UI for Node-RED. Seems to match the UI path you mentioned.

Are there any other good modules you’ve added? I found the bigtimer one from Pete Scargill, and I’ve also added the Azure IoT Hub one. I haven’t tried out the Pi I/O pin one as of yet.

Do you have any kind of restart notification / alerting? I’d like to understand if/when the device restarts (I guess I could track uptime ticks from the OS and look for it going backwards) but I was more interested in a published status message reporting that and perhaps even emailing.

If you run that script I sent you a link to on a clean install of Debian it will install a bunch of useful nodes including the bigtimer etc.

Never had a re-start since I installed this with a small UPS about 6 months ago. Linux is awesome when it comes to stability likes this :slight_smile:

There is a flow that sends out a message once on startup so you could use that to trigger a function and do what you want. Copy this from the website and use IMPORT CLIPBOARD from the menu.

https://flows.nodered.org/flow/263919512c0df2da7eea

1 Like

@ Dave, where does emoncms fit into your picture, if at all? I see it mentioned a couple of times on your site…

I use this as a cloud display of the power and temperatures etc. I don’t use the energy part, just the part that allows me dials and graphs. Node-red handles the updates by using a limit node so only updates emoncms every minute.

1 Like

ok cool - so perhaps the dashboard in node-red is sufficient? At least I won’t bother with emoncms at this stage and see what capabilities I can get and what’s missing

If you don’t mind doing a bit of javascript coding, tech.scargill.net has a load of good stuff on adding graphs and dials to Node-red. You can update those much faster than a cloud based option.

1 Like

mind vs capable of… things are never what they seem with me :slight_smile: