# Receive data over ssh?

**URL:** <https://discourse.nodered.org/t/receive-data-over-ssh/88679>\
**Category:** General\
**Created:** [13 June 2024 18:07 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679 "2024-06-13T18:07:50Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![lorccan](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@lorccan](https://discourse.nodered.org/u/lorccan)\
**Post date:** [13 June 2024 18:07 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/1 "2024-06-13T18:07:50Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [13 June 2024 18:23 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/2 "2024-06-13T18:23:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [13 June 2024 18:23 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/3 "2024-06-13T18:23:38Z")

</div>

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

or may be a TCP/UDP packet?

---

<div class="post-metadata">

**Author:** ![lorccan](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@lorccan](https://discourse.nodered.org/u/lorccan)\
**Post date:** [13 June 2024 18:39 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/4 "2024-06-13T18:39:47Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [13 June 2024 18:43 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/5 "2024-06-13T18:43:10Z")

</div>

> [@lorccan](#):
>
> 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.

You had me at Apple!! 🤓

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

---

<div class="post-metadata">

**Author:** ![lorccan](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@lorccan](https://discourse.nodered.org/u/lorccan)\
**Post date:** [13 June 2024 18:56 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/6 "2024-06-13T18:56:09Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [13 June 2024 18:58 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/7 "2024-06-13T18:58:56Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![lorccan](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@lorccan](https://discourse.nodered.org/u/lorccan)\
**Post date:** [13 June 2024 19:08 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/8 "2024-06-13T19:08:00Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [13 June 2024 19:29 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/9 "2024-06-13T19:29:37Z")

</div>

OK, now I understand...

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

```auto
`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`

---

<div class="post-metadata">

**Author:** ![lorccan](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@lorccan](https://discourse.nodered.org/u/lorccan)\
**Post date:** [13 June 2024 19:51 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/10 "2024-06-13T19:51:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [13 June 2024 19:53 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/11 "2024-06-13T19:53:38Z")

</div>

Its `Get Contents of URL`

That has a few options to play with 😃

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

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [13 June 2024 20:05 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/12 "2024-06-13T20:05:19Z")

</div>

Oh!

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

---

<div class="post-metadata">

**Author:** ![lorccan](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@lorccan](https://discourse.nodered.org/u/lorccan)\
**Post date:** [13 June 2024 20:52 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/13 "2024-06-13T20:52:48Z")

</div>

> [@marcus-j-davies](#):
>
> Its `Get Contents of URL`

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 😉

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.

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [13 June 2024 21:02 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/14 "2024-06-13T21:02:33Z")

</div>

it was sometime ago (NRCHKB server)

Hope it all works out!

---

<div class="post-metadata">

**Author:** ![lorccan](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@lorccan](https://discourse.nodered.org/u/lorccan)\
**Post date:** [13 June 2024 22:54 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/15 "2024-06-13T22:54:13Z")

</div>

> [@marcus-j-davies](#):
>
> NRCHKB server)

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

---

<div class="post-metadata">

**Author:** ![lorccan](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@lorccan](https://discourse.nodered.org/u/lorccan)\
**Post date:** [14 June 2024 08:24 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/16 "2024-06-14T08:24:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 September 2024 08:25 UTC](https://discourse.nodered.org/t/receive-data-over-ssh/88679/17 "2024-09-12T08:25:02Z")

</div>

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