Trying to send commands via MQTT

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
alwashe
New user
Posts: 4
Joined: 10 Dec 2018, 14:32

Trying to send commands via MQTT

#1 Post by alwashe » 11 Dec 2018, 13:13

Hi, I am trying to send commands via MQTT

Controller Settings:

Code: Select all

cmnd/%sysname%/#
Unit Name:

Code: Select all

aussen/li/garage/torsec
in my case it should be:

Code: Select all

cmnd/aussen/li/garage/torsec
by the Command Reference Help Page:

Code: Select all

<MQTT subscribe template>/cmd with payload: <command>
in this case i have to add cmd to the topic:

Code: Select all

cmnd/aussen/li/garage/torsec/cmd
in both cases nothing happens, no state changes or reboot on reboot command.

i tried as payload:

Code: Select all

reboot
Reboot
gpio,4,1
gpio,4,0
GPIO,4,1
GPIO,4,0
this is working:

Code: Select all

http://192.168.178.65/tools?cmd=GPIO%2C4%2C0
http://192.168.178.65/tools?cmd=GPIO%2C4%2C1
http://192.168.178.65/tools?cmd=reboot
Firmware:

Code: Select all

Firmware
Build:⋄	20103 - Mega
Libraries:⋄	ESP82xx Core 2_4_2, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.0.3 PUYA support
GIT version:⋄	mega-20181208
Plugins:⋄	75 [Normal] [Testing] [Development]
Build Md5:	ba4e73f94c85d8389c626efc777a7a5
Md5 check:	passed.
Build time:⋄	Dec 8 2018 03:17:30
Binary filename:⋄	ESP_Easy_mega-20181208_dev_ESP8266_4096.bin
What did I wrong?

Edit: Is there a Discord Server for small questions?

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Trying to send commands via MQTT

#2 Post by grovkillen » 11 Dec 2018, 13:19

cmnd/%sysname%/# is your controller setting?

If so (given that your unit is named UNITNAME you should invoke the command using MQTT this way:

Code: Select all

cmnd/UNITNAME/cmd
With the commands in the payload. More is found on the wiki.

PS. Are you really naming your units with / in the name? That would be considered bad practise in terms of MQTT communication.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

alwashe
New user
Posts: 4
Joined: 10 Dec 2018, 14:32

Re: Trying to send commands via MQTT

#3 Post by alwashe » 11 Dec 2018, 14:16

You are right with the unitname, until now this was not an issue for my sensors.

I tried a simple unitname without "/", it did not help.

I tried a Factory Reset and did only minor changes:
Added wifi credentials and mqtt credentials (OpenHAB MQTT, Controller IP, Controller User, Controller Password), still did not work:

Code: Select all

/ESP_Easy/cmd

Code: Select all

gpio,4,1
gpio,4,0

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Trying to send commands via MQTT

#4 Post by grovkillen » 11 Dec 2018, 15:18

If you're running this last weeks releasea the GPIO command is not working.

Try a week old (20181204) version instead.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

rmhoutz
Normal user
Posts: 36
Joined: 08 Sep 2017, 14:09

Re: Trying to send commands via MQTT

#5 Post by rmhoutz » 25 Mar 2019, 21:42

I know this topic has some age on it but I was struggling to send a command from MQTT.fx and it was driving me crazy so I'm hoping this will help anyone else with this problem.
I removed the first / from the %sysname%/# in controller subscribe on the ESP_Easy setup. So to send a command from MQTT.fx just publish the topic ESP_Name/cmd
And put gpio,5,0 or gpio,5,1 as the payload.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Trying to send commands via MQTT

#6 Post by grovkillen » 25 Mar 2019, 21:49

Given that your name is ESP_Name and that the controller is active and connected it should work.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests