Start Flow with .bat or .ps2 on "remote" NodeRed installation

Hi everyone!

What is in your opinion the easiest way to start a Flow with payload on a "remote" (=Raspberry Pi on same network) Node-Red server from my Windows PC that works with CMD or Powershell?

I always KISS (Keep it simple, stupid) my projects, so NO: PATH-variables, no package-managers (pip/choco/etc) - especially on windows they are a pain in the :sweat_smile:; No permanent skript running in background on my PC; No digging into the RasPi file structure or installing anything in addition to node-red; No putting things into autostart on either machine. For all those are things that will be hard to remember and replicate when I change my Pi or my PC in a few years time.

I found some CMD-tools that would require some of the above or which would store config-Data in the User-Folder; i found threads that ended in installing the full mosquitto package in order to get a single MQTT-command that can be run with .bat or .ps2-files. Of course without the proper documentation alongside on how to actually use this command. And mostly i found solutions for Node-RED installs on windows, which is not the situation I'm in.

I simply wan't to add a node and have a CMD or Powershell command to speak to it over the network. I refuse to believe that there isn't a stable, simple solution within mighty Node-Red and the mighty-er Windows Powershell. I probably just don't see it. I would also consider downloading a .exe into the same Folder as the .bat/.ps2 files and running it with different parameters. This is accaptable as i can leave the Folder on my NAS and it will just work once i change my PC or i add another one to my home.

Background/Goal:
My Onkyo AV-Reciever is controllable with the eiscp-node. I want to fully control the in- and outputs of my AVR with batch-files (listening to music over speakers -> a wild discord-call appears -> click -> sound now comes from headphones). This requires the PC to change its output and the AVR to change its input and output.
I have managed to control my AVR with the eiscp node, this project is just an expansion of already working stuff. I already have a DIY ESP8266 Repeater in the Kitchen that accepts IR-Commands from the AVR Remote and sends it to NodeRed via MQTT. NodeRed then uses eiscp.
I also have successfully written .bat-Files that allow me to choose the audio output of my PC. I would like to have those same batch-Files send a command to my Flow so that I can change the in- and output on my reciever as well. How am I to accomplish this? I don't care. As long as the solution "stays within one folder".

I hope I made clear what I'm trying to do, now that I have an account here I will try to help others as well, this forum is awesome!

Well, I would start by running Node-RED on the Pi and listening to 1 or more HTTP endpoints (URLs). You can connect to a URL from many tools. That would be the simplest but I think that you have hog-tied yourself with your other limitations and I'm not sure you have left any avenue open.

For starters, you don't want to leave anything running in the background? On the Pi? did I misunderstand? Not feasible. You need a server to connect to. In any case, the configuration on the pi is simple and repeatable so you can trivially reproduce it as long as you have the flow file and a few instructions on a note somewhere. But it does require installed software and a configuration - put that together in a set of instructions and the flow file on GitHub and call it a day or get a bit more creative and write a custom install script like my alternate installer repo, once done, easily remembered and re-run should you need to.

And on the PC side, you don't want any other software? Again not terribly friendly. The problem is that you will end up creating something more complex than what you are trying to avoid. Still, the standard PC (Win 10) will actually have everything you need if you really want to do it that way. IE or Edge libraries called from PowerShell will let you connect to a remote Pi/Node-RED over HTTP and pass data in either direction. Job done.

Thanks alot! Calling HTTP Endpoints with Powershell is exactly the kind of easy solution I could not see. It worked perfectly and is easy to set up!

Thanks!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.