mqtt cant receive gpio command

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
randytsuch
Normal user
Posts: 33
Joined: 05 Jun 2017, 05:32

Re: mqtt cant receive gpio command

#11 Post by randytsuch » 06 Aug 2018, 16:56

Update in case someone finds this in a search looking for help.

I changed out the wemos d1 pro with a wemos d1, and loaded it via my macbook with a mid july verion of esp easy.

This worked, when sending via mqtt:
topic: /ESP00/gpio/12
payload of 0 or 1

But if I tried something like pulse or pcfgpio instead of gpio, it did not work

But if you use
topic: /ESP_EASY/cmd
payload: gpio,12,1

Then you can change out gpio with pulse, pcfgpio and it works fine.

So using cmd is safer as it seems to support any valid command you would want to use.

Randy

Quart
Normal user
Posts: 45
Joined: 16 Jul 2019, 10:08
Location: Sweden
Contact:

Re: mqtt cant receive gpio command

#12 Post by Quart » 22 Aug 2019, 18:09

Got it working now !!!

The missing part for me was just this
Topic:
ESP_Easy/gpio/15

Message:
1


So now my Homey can post when a motion sensor is active and switch the diods on and when the zone is not active its turn the led off.

Here is how i looks in Homey and also a test it, when doorbell is pressed turn led on
mqtt.JPG
mqtt.JPG (20.26 KiB) Viewed 16807 times
Attachments
mqtt_1.JPG
mqtt_1.JPG (33.86 KiB) Viewed 16807 times

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

Re: mqtt cant receive gpio command

#13 Post by TD-er » 23 Aug 2019, 12:54

If crucial information is missing in the documentation, please let me know, or create a pull request with the suggested improvements :)

See https://espeasy.readthedocs.io/en/lates ... #c014-page

HarpieC
Normal user
Posts: 22
Joined: 20 Mar 2016, 20:33

Re: mqtt cant receive gpio command

#14 Post by HarpieC » 17 Sep 2019, 15:23

The docs page referes to the homie convention controller. The mqtt topic for gpio here is defined as:

Code: Select all

homie/%unitName%/SYSTEM/gpio#/set
The GPIO port must be set to default low or default high in the hardware tab to be included during auto-discover.

Changes on the gpio port are sent from ESPEasy to

Code: Select all

homie/%unitName%/SYSTEM/gpio#
Please use true/false instead of 1/0 as defined in the convention!

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

Re: mqtt cant receive gpio command

#15 Post by TD-er » 17 Sep 2019, 15:36

Is that something that has to be changed in the software or in the documentation? (I'm not the author of the Homie controller)

HarpieC
Normal user
Posts: 22
Joined: 20 Mar 2016, 20:33

Re: mqtt cant receive gpio command

#16 Post by HarpieC » 17 Sep 2019, 17:06

I am ;)

Nothing to be changed. If somebody uses the homie controller they have to stick with the homie convention. As described. It can do the Job and I use it in several devices - even without a homie compatible controller. You just have to stay with the naming convention like starting with home/ and the prefix /set for altering parameters.

I was wondering why you mentioned C014 because above the Mqtt-import plugin was mentioned. I just wanted to make sure to point out the difference. Sorry for the misunderstanding.
Chris.

BTW the ? Button on the configuration page is not referring to the correct documentation page ... have to find out why.

HarpieC
Normal user
Posts: 22
Joined: 20 Mar 2016, 20:33

Re: mqtt cant receive gpio command

#17 Post by HarpieC » 17 Sep 2019, 17:11

And he couldn’t use C014 because it is in the develop build and not in the normal one (I think)

gregoinc
Normal user
Posts: 65
Joined: 21 Jan 2019, 06:08
Location: Australia

Re: mqtt cant receive gpio command

#18 Post by gregoinc » 13 May 2020, 08:22

Feels like I am forever asking questions on old threads... apology if this has been answered elsewhere.

My situation... I have several NodeMCU units running Mega and communicating with Mosquito MQTT, with Node Red capturing information and forwarding to Blynk app. A one way information transfer.

I want to make it a two way, but for the life of me I cannot work out how to have Node Red send a MQTT message to tell one of my NodeMCU units to start the air conditioner. Here's my rules code...

On StartHP Do
If [counter#status]=0
heatpumpir,daikin,1,3,0,24,4,2
TaskValueSet 4,1,1
EndIf
EndOn

As you can see I have an event that transmits the IR commands to my air conditioner. What I would like to do is have Node Red send a message via MQTT to the NodeMCU to execute the StartHP event i.e. turn on the AC.

I read this thread and others, but am still in the dark about where to put the topic info and which string to use... Here's what I have been trying to use:

I create an inject in Node Red with the topic as the payload... ESP_EASY/event/StartHP
espeasyevent.jpg
espeasyevent.jpg (17.69 KiB) Viewed 12469 times
Node Red gave me back the error "Invalid topic specified" which tells me I am not entering the data in the right format? Any advice greatly appreciated, I have no doubt it will be my lack of knowledge getting in the way.

Thanks, Grego

gregoinc
Normal user
Posts: 65
Joined: 21 Jan 2019, 06:08
Location: Australia

Re: mqtt cant receive gpio command

#19 Post by gregoinc » 15 May 2020, 05:26

In an effort to tie this off, I managed to find a solution... which once found appeared embarrassingly simple. In an effort to share information for those of you that are stuck like me here is what I found.

Here is the NodeRed inject node I created to simulate a command to start the air conditioner...
NodeRedStartHPInject.jpg
NodeRedStartHPInject.jpg (31.66 KiB) Viewed 12409 times
You will see the Payload contains the word "event" and the command to "StartHP" which starts the air conditioner. The Topic line contains the ESPEasy hostname (GregoInc1) followed by a forward slash and "cmd" which signifies the use of a command.

And here is the NodeRed MQTT out node, which as you will see is really simple.
NodeRedMQTTOutNode.jpg
NodeRedMQTTOutNode.jpg (37.81 KiB) Viewed 12409 times
Hope this helps.

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests