Controll a relay using cmd and gpio from Node Red

Moderators: Voyager, BertB, grovkillen, Stuntteam, LisaM

Post Reply
Message
Author
ulfh2018
Normal user
Posts: 39
Joined: 19 Feb 2018, 06:11
Location: Oslo Norway

Controll a relay using cmd and gpio from Node Red

#1 Post by ulfh2018 » 14 Jul 2021, 20:22

I have configured EspEasy on a generic ESP8266 card, and want to use Node Red and MQTT to switch a relay of an on.

I have set up the following in EspEasy:

Unit Name: Realy_Meaco
Unit Number 1

Controller Domoticz MQTT

Controller Subscribe: Relay_Meaco_1/#
Controller Publsih: Relay_Meaco_in

Devices: Input Switch at GPIO 12

Running GPIO,12,1 and GPIO,12,0 from the command line in EspEasy turns the swithc of an on, and sends information about this back to Node Red via RalayMeaco/in

In Node red I use Mqtt in and Mqtt out to comunicate with EspEasy:

Mqtt in: Topic: Relay_Meaco_1/in

Mqtt out: Topic: Relay_Meaco_1/cmd

I have two injection nodes trying to send the following: gpio,12,1 and gpio,12,0 to Mqtt out, but nothing happens. If I manually run the commands from the comman consoll in EspEasy, Mqtt in will report back the result.

I am sure there is something I have missed, because I had this up and running two weeks ago, but I blew the Esp8266, so I am no using another, and I cannot remember exactly how I didi it.

All the best from

Ulf

TD-er
Core team member
Posts: 5538
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Controll a relay using cmd and gpio from Node Red

#2 Post by TD-er » 14 Jul 2021, 23:27

Domoticz MQTT + switch...
So my Pavlov reply is to link to this part of the documentation: https://espeasy.readthedocs.io/en/lates ... #p029-page

Have you followed those steps?

ulfh2018
Normal user
Posts: 39
Joined: 19 Feb 2018, 06:11
Location: Oslo Norway

Re: Controll a relay using cmd and gpio from Node Red

#3 Post by ulfh2018 » 15 Jul 2021, 01:06

Thank you so much for the suggestion, but this is not the way I made it work a few weeks ago, and the solution you provide is much more complicated. I did not use rules, I just sent the command GPIO,12,1 but there must be something wrong with my syntax, since nothing happens.

Best regards

Ulf

TD-er
Core team member
Posts: 5538
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Controll a relay using cmd and gpio from Node Red

#4 Post by TD-er » 15 Jul 2021, 11:02

Are you sure you used the Domoticz MQTT controller?
When using the "cmd" syntax in topics, I think you used the OpenHAB controller.

ulfh2018
Normal user
Posts: 39
Joined: 19 Feb 2018, 06:11
Location: Oslo Norway

Re: Controll a relay using cmd and gpio from Node Red

#5 Post by ulfh2018 » 15 Jul 2021, 12:05

Yes, absolutely sure. Recon there is something wrong with the settings on the ESP8266, since I had no problems making it work using Tasmota, but I would rather use EspEasy

TD-er
Core team member
Posts: 5538
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Controll a relay using cmd and gpio from Node Red

#6 Post by TD-er » 15 Jul 2021, 12:29

The Domoticz MQTT controller does not look at the topic ending with "cmd"
That's the OpenHAB MQTT controller.

If you don't use Domoticz, I guess using the OpenHAB MQTT controller is a bit more flexible as it does allow for some more (not very elaborate though) commands via MQTT.

What is configured in Node Red to publish to that topic?
Maybe depending on the syntax of the exact message we can determine which controller you probably used and also if you're missing something.

ulfh2018
Normal user
Posts: 39
Joined: 19 Feb 2018, 06:11
Location: Oslo Norway

Re: Controll a relay using cmd and gpio from Node Red

#7 Post by ulfh2018 » 15 Jul 2021, 16:17

I think we might be talking past each other.

My MQTT broker is Mosquitto, running on a Raspberry pi, and I am chosing Domoticz Mosquitto on ESPEasy. I will try to use one of the other options, and see if that changes the result.

ulfh2018
Normal user
Posts: 39
Joined: 19 Feb 2018, 06:11
Location: Oslo Norway

Re: Controll a relay using cmd and gpio from Node Red

#8 Post by ulfh2018 » 15 Jul 2021, 16:43

I owe TD-er a beer! Changed to OpenHAB, and worked stright out of the box!

Thank you so much!

All the best from

Ulf

TD-er
Core team member
Posts: 5538
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Controll a relay using cmd and gpio from Node Red

#9 Post by TD-er » 15 Jul 2021, 21:55

Cheers! ;)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest