Page 1 of 1

How can I reboot ESPEasy using MQTT?

Posted: 19 Jan 2018, 00:25
by sheppy
I have several ESP8266's running ESPEasy Build 132 and Build 147. I would like to reboot them using MQTT.

If I have a device subscribed to topic "MyDevice" with an ip of "192.168.123.123"

I can send "curl 192.168.123.123/?cmd=reboot" and it reboots

How can I get this to work with MQTT. I have tried

Publishing "reboot" to topic "MyDevice"
Publishing "reboot" to topic "MyDevice/cmd"
Publishing "cmd=reboot" to both topics

Is there an easy way of getting an MQTT reboot? If I need to update to later firmware is there a stable version that I can send over the air?

Thanks

Re: How can I reboot ESPEasy using MQTT?

Posted: 19 Jan 2018, 06:03
by grovkillen
I use mqtt import and rules for that.

Code: Select all

on System#Boot do
 Publish %sysname%/status,Booted
 Publish %sysname%/IP,%ip%
endon

on sniff#cmdMQTT=1 do
  Publish %sysname%/IP,%ip%
endon

on sniff#cmdMQTT=2 do
  Publish %sysname%/Time,%systime%
endon

on sniff#cmdMQTT=3 do
 Publish %sysname%/status,Rebooting
 Reboot
endon
So I just publish a number to the topic

Code: Select all

cmdMQTT
and all my units will respond.

Re: How can I reboot ESPEasy using MQTT?

Posted: 24 Jan 2018, 20:24
by sheppy
Thanks for the reply, which version do I need to upgrade to for this to work? The builds I have look totally different and don't have MQTT import as an option.

Re: How can I reboot ESPEasy using MQTT?

Posted: 24 Jan 2018, 20:50
by grovkillen
2.0.0+

You find the links on the wiki https://www.letscontrolit.com/wiki/index.php/ESPEasy

Re: How can I reboot ESPEasy using MQTT?

Posted: 24 Jan 2018, 21:04
by sheppy
Thanks, I'll keep an eye out for when the V2 release arrives as I have a lot of these to update.

Re: How can I reboot ESPEasy using MQTT?

Posted: 25 Jan 2018, 15:04
by mattlward
So, I am trying to make this work and can't even make it work with MQTTfx. I am subscribing to my HA server with # as my subsciption. I am publishing cmdMQTT/1, /cmdMQTT/1 and never see a response in MQTTfx nor do I see the value change in the devices list on the ESPEasy Wemos D1. I am seeing the above as published in MQTTfx. What am I doing wrong?

Re: How can I reboot ESPEasy using MQTT?

Posted: 25 Jan 2018, 15:04
by mattlward
BTW, I am running v2.0-20180121

Re: How can I reboot ESPEasy using MQTT?

Posted: 25 Jan 2018, 17:40
by grovkillen
Topic: "cmdMQTT"
Payload/message : "1"

You try to send a blank message to topic "cmdMQTT/1"

Re: How can I reboot ESPEasy using MQTT?

Posted: 25 Jan 2018, 18:53
by mattlward
That did it! Now, need to find out if I can set up a topic collector in home assistant to grab the responses to verify the IP to name and set a button to reboot in the interface when I want to.