# Shelly 1 relay in nodered?

**URL:** <https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943>\
**Category:** General\
**Created:** [19 May 2021 18:37 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943 "2021-05-19T18:37:41Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![pivert](https://avatars.discourse-cdn.com/v4/letter/p/ed655f/32.png) [@pivert](https://discourse.nodered.org/u/pivert)\
**Post date:** [19 May 2021 18:37 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/1 "2021-05-19T18:37:41Z")

</div>

Hello I need your help, I want to install a Shelly 1 relay in nodered which is controllable with homekit, but I can't, look at my screenshots of my flow, can you tell me what I need to modify ?

 ![Capture d’écran 2021-05-19 à 19.37.45](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/8/88b642810eb22c74828cd6d29f4367bd4f235d4f.png)  
 ![Capture d’écran 2021-05-19 à 19.37.36](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/0/805b9786a3b8e12784c0c126f6fbaae8371c24d4.png)  
 ![Capture d’écran 2021-05-19 à 19.37.27](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/3/e373b73e0697b9c12b68d502b0aff2294fe3e2c0.png)  
 ![Capture d’écran 2021-05-19 à 19.37.17](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/5/c52e90a05fab51d0ccb61a3371ff4e779bf71692.png)  
 ![Capture d’écran 2021-05-19 à 19.36.37](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/2/d21dccf22a8fe3f491e76c9fdb3197ee5c011973.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 May 2021 18:54 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/2 "2021-05-19T18:54:26Z")

</div>

Hi & welcome to the forum.

First things first with node-red - use debug nodes to see what message is travelling down the wires & verify what is coming out of / going into each node is what you expect.

Second thing - read the built in help for a node (there is often sample code)...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/e/4e96dcb8ca35acf0fcdff9db087729d541928022.png)

Third tip, start small. E.g. use inject nodes to get things going before you try to hook up 2 systems.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/8/f8cf982e94280eb532ae9e5a36879cd6a3c10dd5.png)

Demo flow (used CTRL+I to import)

```auto
[{"id":"d4c4c1dd.3a07c","type":"inject","z":"5e6c8b.7f38b374","name":"turn on","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{ \"relay\" : 0, \"on\" : true }","payloadType":"json","x":98,"y":544,"wires":[["53d5e208.3502ac"]]},{"id":"22373c66.a0eb74","type":"inject","z":"5e6c8b.7f38b374","name":"turn off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{ \"relay\" : 0, \"on\" : false }","payloadType":"json","x":98,"y":576,"wires":[["53d5e208.3502ac"]]},{"id":"4bed432d.addeec","type":"inject","z":"5e6c8b.7f38b374","name":"status","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":98,"y":608,"wires":[["53d5e208.3502ac"]]},{"id":"53d5e208.3502ac","type":"shelly-switch","z":"5e6c8b.7f38b374","hostname":"192.168.1.58","description":"","x":342,"y":608,"wires":[["9d407f28.db5ad"]]},{"id":"9d407f28.db5ad","type":"debug","z":"5e6c8b.7f38b374","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":514,"y":608,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [19 May 2021 19:04 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/3 "2021-05-19T19:04:19Z")

</div>

And a 4th tip, if you are happy not to use Shelly Cloud, turn on MQTT support and then it all is a lot easier.

Bonus tip: You don't really seem to gain much if anything from the Shelly node, you could do everything just about as easily using the core http-request node.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 May 2021 19:06 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/4 "2021-05-19T19:06:01Z")

</div>

> [@TotallyInformation](#):
>
> if you are happy not to use Shelly Cloud

I was under the impression that node uses the built in http API (not cloud services)

---

<div class="post-metadata">

**Author:** ![pivert](https://avatars.discourse-cdn.com/v4/letter/p/ed655f/32.png) [@pivert](https://discourse.nodered.org/u/pivert)\
**Post date:** [19 May 2021 19:07 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/5 "2021-05-19T19:07:03Z")

</div>

It's a good idea but I don't want to lose the cloud function of the shelly app

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [19 May 2021 19:07 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/6 "2021-05-19T19:07:59Z")

</div>

Misunderstanding. The HTTP API is available directly, you don't really need the node. But to use MQTT with the Shelly, you have to turn off Shelly cloud.

---

<div class="post-metadata">

**Author:** ![pivert](https://avatars.discourse-cdn.com/v4/letter/p/ed655f/32.png) [@pivert](https://discourse.nodered.org/u/pivert)\
**Post date:** [19 May 2021 19:20 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/7 "2021-05-19T19:20:17Z")

</div>

How should I proceed then and with what mqtt or node red? ?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [19 May 2021 19:25 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/8 "2021-05-19T19:25:03Z")

</div>

As you want to retain Shelly cloud, you cannot use MQTT.

Follow Steve's guide and let us know what output you are getting.

---

<div class="post-metadata">

**Author:** ![pivert](https://avatars.discourse-cdn.com/v4/letter/p/ed655f/32.png) [@pivert](https://discourse.nodered.org/u/pivert)\
**Post date:** [19 May 2021 19:31 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/9 "2021-05-19T19:31:15Z")

</div>

Yes great it works thank you very much my light turns on and off on the other hand how now I can add homekit?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 May 2021 19:35 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/10 "2021-05-19T19:35:51Z")

</div>

So attach debug nodes to every output and look at what is in the msg for the working flow & make your flow send a similar message. Clue... Use a switch node to direct your on/off commands. Use a change node to generate the correct command (which is essentially copying what I put in the inject nodes).

---

<div class="post-metadata">

**Author:** ![pivert](https://avatars.discourse-cdn.com/v4/letter/p/ed655f/32.png) [@pivert](https://discourse.nodered.org/u/pivert)\
**Post date:** [19 May 2021 19:37 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/11 "2021-05-19T19:37:51Z")

</div>

it's too complicated for me, I would just like to add the homekit node to your example which works

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 May 2021 19:46 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/12 "2021-05-19T19:46:45Z")

</div>

Show me what comes out of this homekit node & explain what would make the light come on & what would make it go off.

---

<div class="post-metadata">

**Author:** ![pivert](https://avatars.discourse-cdn.com/v4/letter/p/ed655f/32.png) [@pivert](https://discourse.nodered.org/u/pivert)\
**Post date:** [19 May 2021 19:56 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/13 "2021-05-19T19:56:44Z")

</div>

I don't know where to place homekit in the flow of node red

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 May 2021 19:59 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/14 "2021-05-19T19:59:51Z")

</div>

I have no idea. I don't own any Apple products.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 May 2021 20:01 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/15 "2021-05-19T20:01:34Z")

</div>

There seems to be a huge amount of info on their [wiki](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/wiki). I would start there.

---

<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:** [18 July 2021 20:02 UTC](https://discourse.nodered.org/t/shelly-1-relay-in-nodered/45943/16 "2021-07-18T20:02:04Z")

</div>

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