# Shelly 1 get status

**URL:** <https://discourse.nodered.org/t/shelly-1-get-status/42128>\
**Category:** Hardware\
**Created:** [5 March 2021 22:14 UTC](https://discourse.nodered.org/t/shelly-1-get-status/42128 "2021-03-05T22:14:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![sfedo](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sfedo](https://discourse.nodered.org/u/sfedo)\
**Post date:** [5 March 2021 22:14 UTC](https://discourse.nodered.org/t/shelly-1-get-status/42128/1 "2021-03-05T22:14:25Z")

</div>

hello,  
I would like to use shelly1 but have not yet found the right communication for me.

Since I only have switches installed at home, I would like to query the switch with shelly1 and send the status to node-red and then use it to switch on the hue-phillips lamps.  
I go this way to not have to disconnect the lamps from the power supply.

I have connected the switch to pw input. It also works, the relay clicks. I use node-red-contrib-shelly from @windkh to control shelly from node-red, but this node can not output the status of sw.

so i use http-request and query the ip address for status. I have to do this with timestamp repeat every 1 sec.

I don't like this solution so much.  
Would this be a better solution with mqtt? At the moment I can't get mqqt connection established. I am using aede's mqtt broker and it also says connected and all my mqtt nodes are connected but the shelly is not connected when i query the status.

thanks for the help

---

<div class="post-metadata">

**Author:** ![windkh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/windkh/32/4713_2.png) [@windkh](https://discourse.nodered.org/u/windkh)\
**Post date:** [5 March 2021 22:30 UTC](https://discourse.nodered.org/t/shelly-1-get-status/42128/2 "2021-03-05T22:30:23Z")

</div>

You can get the status of the switch by just sending an empty message into the node e.g. using a timer or inject node.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [5 March 2021 23:03 UTC](https://discourse.nodered.org/t/shelly-1-get-status/42128/3 "2021-03-05T23:03:18Z")

</div>

MQTT seems to be the best option IMO.

> [@sfedo](#):
>
> but the shelly is not connected when i query the status

Have you enabled MQTT and entered your server details in the Shelly setup? - [Welcome to Shelly Technical Documentation | Shelly Technical Documentation](https://shelly-api-docs.shelly.cloud/#mqtt-support)  
_NOTE - enabling MQTT in the Shelly will disable the Shelly Cloud service._

If the Shelly is connected to your Aedes broker, just post an 'update' request to get the status - like this;

```auto
[{"id":"e37c1996.57d048","type":"mqtt in","z":"8e37609b.e7282","name":"Shelly","topic":"shellies/#","qos":"2","datatype":"auto","broker":"aa11e6d8.6cd088","x":120,"y":510,"wires":[["56a32b47.4eaa34"]]},{"id":"56a32b47.4eaa34","type":"debug","z":"8e37609b.e7282","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":360,"y":510,"wires":[]},{"id":"281208fe.235518","type":"inject","z":"8e37609b.e7282","name":"Report status","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"shellies/command","payload":"update","payloadType":"str","x":145,"y":570,"wires":[["93d7fdcf.70227"]]},{"id":"93d7fdcf.70227","type":"mqtt out","z":"8e37609b.e7282","name":"","topic":"","qos":"0","retain":"false","broker":"aa11e6d8.6cd088","x":335,"y":570,"wires":[]},{"id":"aa11e6d8.6cd088","type":"mqtt-broker","name":"Local server","broker":"192.168.1.8","port":"1883","clientid":"Local node-RED","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"admin","birthQos":"0","birthRetain":"false","birthPayload":"Hello from Local node-RED","closeTopic":"admin","closeQos":"0","closeRetain":"false","closePayload":"Local node-RED is about to exit","willTopic":"admin","willQos":"0","willRetain":"false","willPayload":"Local node-RED has now exited"}]

```

---

<div class="post-metadata">

**Author:** ![sfedo](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sfedo](https://discourse.nodered.org/u/sfedo)\
**Post date:** [5 March 2021 23:32 UTC](https://discourse.nodered.org/t/shelly-1-get-status/42128/4 "2021-03-05T23:32:24Z")

</div>

I'm so dumb. I've red it several times, but somehow didnt notice that as solution...thank you very much for quick response

---

<div class="post-metadata">

**Author:** ![sfedo](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sfedo](https://discourse.nodered.org/u/sfedo)\
**Post date:** [5 March 2021 23:48 UTC](https://discourse.nodered.org/t/shelly-1-get-status/42128/5 "2021-03-05T23:48:29Z")

</div>

I've found your 1&1 flow for shelly, and was trying to set it up for me working with your examples. the http request works without any problem, but mqqt doesnt.  
I've imported your flow, and my nodes show me "connected", when I deploy "report status", this is what I get back:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/f/bf7a5e9f431a2fcf49c00fc3737654b371dd049b.png)

---

<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:** [6 March 2021 02:19 UTC](https://discourse.nodered.org/t/shelly-1-get-status/42128/6 "2021-03-06T02:19:15Z")

</div>

Have you updated the Shelly firmware and turned on the MQTT setting? I got my Shelly's in last winter's black friday sale and the firmware they came with needed updating.

---

<div class="post-metadata">

**Author:** ![sfedo](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sfedo](https://discourse.nodered.org/u/sfedo)\
**Post date:** [6 March 2021 08:18 UTC](https://discourse.nodered.org/t/shelly-1-get-status/42128/7 "2021-03-06T08:18:05Z")

</div>

Yes, my firmware is up to date.  
I did turn the mqtt settings on. What I don't understand is wich ip i have to use. I've tried with localhost:1883.  
Currently I run node red in Windows VM threw hypervi. Today I will set up my new RPi and try it again.  
May this be the issue?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [6 March 2021 09:00 UTC](https://discourse.nodered.org/t/shelly-1-get-status/42128/8 "2021-03-06T09:00:05Z")

</div>

> [@sfedo](#):
>
> What I don't understand is wich ip i have to use. I've tried with localhost:1883.

Assuming you have not changed the default MQTT port, is should be 1883.

Is this eventually going to be controlled by the Pi?  
If so, let's get the Pi up and running first, and then we'll get the Shelly connected.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [6 March 2021 09:55 UTC](https://discourse.nodered.org/t/shelly-1-get-status/42128/9 "2021-03-06T09:55:22Z")

</div>

> [@sfedo](#):
>
> wich ip i have to use.

In the Shelley you have to give it the ip address of the device running the mqtt broker, which is presumably the pi.

---

<div class="post-metadata">

**Author:** ![sfedo](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sfedo](https://discourse.nodered.org/u/sfedo)\
**Post date:** [6 March 2021 15:13 UTC](https://discourse.nodered.org/t/shelly-1-get-status/42128/10 "2021-03-06T15:13:39Z")

</div>

got it now,  
after I've set up node red on pi today, I've used the pi ip for mqtt broker wth 1883 port and it just works.

What is actually my advantage to use mqtt instead of http request with interval?  
and 2nd question, do I have to secure my mqtt connections with user and password in local net?

---

<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:** [6 March 2021 15:34 UTC](https://discourse.nodered.org/t/shelly-1-get-status/42128/11 "2021-03-06T15:34:54Z")

</div>

> [@sfedo](#):
>
> What is actually my advantage to use mqtt instead of http request with interval?

[MQTT vs. HTTP: which one is the best for IoT? | by Marina Serozhenko | MQTT Buddy | Medium](https://medium.com/mqtt-buddy/mqtt-vs-http-which-one-is-the-best-for-iot-c868169b3105#:~:text=MQTT%20has%20a%20very%20short,needless%20for%20resource%2Dconstrained%20devices).

> [@sfedo](#):
>
> do I have to secure my mqtt connections with user and password in local net

No, you dont "have to". If the MQTT traffic was over the internet then it would be strongly recommended.  
Also, if your wifi is wide open then someone in the vicinity could connect and operate your IoT stuff (but TBH, if your wifi was wide open, there is far worse things that could happen). The answer is "up to you"

---

<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:** [20 March 2021 15:35 UTC](https://discourse.nodered.org/t/shelly-1-get-status/42128/12 "2021-03-20T15:35:50Z")

</div>

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