Receive data over ssh?

I am trying to act on events generated by another platform on the same LAN as my node red server.

I can’t access the remote data directly, but I can use an event to trigger a script over ssh.

I could write something to a directory on the node red server and check this periodically, but is there a ready-made node that can receive such data directly?

Instead of jeopardizing security - could the other server sent events to mqtt (for example) ?

1 Like

What is the other system capable of?
could it send a HTTP request for instance?

or may be a TCP/UDP packet?

I'm using Apple's Shortcuts app to "run script over ssh". Therefore, I can within reason produce any output at the node red server side. I might struggle with passing arguments unless I have multiple scripts.

Starting with something simple, a device turns ON. The script could simply be echo "on" > ~/state and I could then periodically interrogate the contents of ~/state.

@bakman2 I'm not too worried about security as it's all contained in my secure LAN. Whilst I couldn't send mqtt from the remote, I could publish it on the NR server. Perhaps that's the way I should go?

You had me at Apple!! :nerd_face:

You can in shortcuts, send a HTTP request, and include a body or even headers.
setup a HTTP IN node in Node RED and get your Shortcut to send to it via the HTTP action in Shortcuts.

You then act on that in Node RED - and Evan consume its body/headers

Unfortunately, I'm limited AFAIK to the ssh script option as I am calling from within HomeKit. (Sorry, I should've said this at the outset.)

is this is Genuine HomeKIt device, or an emulated one?
You know that you can get Node RED to emulate a HomeKit device?

maybe some info on your setup/what the goal is might help?

It's a native device. I could create a shadow device in NR and trigger state to match that of the real one, but that seems a little cumbersome.

More specifically: I have five windows that are controlled by Velux Active as native HomeKit devices. Clearly, if I have opened or closed a window myself I know what state it's in; but Active uses its own sensors to 'decide' when to operate them. I have a degree of control over what it does, but the algorithm is proprietary.

(BTW there are various attempts at integrating Velux with node red and/or homebridge using yet another piece of Velux hardware. None of these is reliable and the developers seem to have abandoned them.)

OK, now I understand...

I don't think you are limited to SSH however.

`Shortcuts` ->
`Automation` -> 
`+`  -> 
`Create Home Automation`-> 
`An Accessory Is Controlled` ->  (Choose Accessory + State Change)
`Convert to Shortcut`->

Then In that shortcut, you can query the state off the device, then use its value in any action (i.e HTTP Request (value as the body)

For this however, you will need a Hub (ATV4K, HomePod) that the automation lives.

Apologies if I'm not on the right path.
Question is, if Velux causes the state change of An Accessory Is Controlled

I can use the Velux window opening or closing as a trigger. However - and this is probably me being stupid - I can’t see HTTP request option in Shortcuts.

BTW I do have HomeKit hubs.

Its Get Contents of URL

That has a few options to play with :smiley:

You don't have to consume the response in Shortcuts, as long as Node RED is triggered for the request.

But at least respond with 200 - to keep shortcuts happy

Oh!

And we have spoken before on Discord if i'm not mistaken :smiley:

Ah! OK. ISTR something about that now. It sounds like the opposite of what I want (to me) - so that confirms it was me being stupid :wink:

So far as Discord goes, very probably. I can’t honestly say I recall speaking to you, but I tend to think up something I’d like to do and pursue as many options as necessary - until I jump to the next one.

I’ll let you know how far I get with my plans!

Thanks.

1 Like

it was sometime ago (NRCHKB server)

Hope it all works out!

Ah yes! I use it to this day. Thank you!

Foiled again!

When the window opens (from being closed) the open trigger fires and I get the POST in Node RED. The same is true for the reverse, but what I can't capture is the extent to which the window is opened once it stops moving. (Often it will do something like moving from 70% to 7% so that the room is sealed from rain, but is still being trickle ventilated. As this is moving from one open state to another, there is no trigger.)

Anyway, thanks for your help @marcus-j-davies

1 Like

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