ESPeasy 2.0 MQTT Broadcast

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
nigelbe
Normal user
Posts: 12
Joined: 16 Jun 2017, 12:37

ESPeasy 2.0 MQTT Broadcast

#1 Post by nigelbe » 16 Jun 2017, 12:59

Hello,

I just discovered ESPeasy and it is wonderful: But there is one thing missing and that is the ability to subscribe to any random MQTT topic that does NOT use %sysname%.

I already have quite a few Wemos D1 Mini devices around my home, each one using software I developed myself. All these subscribe to "LED" and each returns a ACK to the controller.
I use the payload (ON or OFF) to turn the BUILTIN_LED on or off. The ACKs allow me to see that the device is alive. Alternating commands are sent every 30 seconds from my home automation.

My home automation is "Premise SYS" http://cocoontech.com/forums/forum/51-p ... e-control/ which is 20 years old, Free, but not open source.

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

Re: ESPeasy 2.0 MQTT Broadcast

#2 Post by grovkillen » 16 Jun 2017, 13:41

nigelbe wrote: 16 Jun 2017, 12:59 Hello,

I just discovered ESPeasy and it is wonderful: But there is one thing missing and that is the ability to subscribe to any random MQTT topic that does NOT use %sysname%.

I already have quite a few Wemos D1 Mini devices around my home, each one using software I developed myself. All these subscribe to "LED" and each returns a ACK to the controller.
I use the payload (ON or OFF) to turn the BUILTIN_LED on or off. The ACKs allow me to see that the device is alive. Alternating commands are sent every 30 seconds from my home automation.

My home automation is "Premise SYS" http://cocoontech.com/forums/forum/51-p ... e-control/ which is 20 years old, Free, but not open source.
MQTT Import is the answer... You can import any topic. To publish any topic you should use rules. More is found on the wiki:

https://www.letscontrolit.com/wiki/inde ... rial_Rules
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:

nigelbe
Normal user
Posts: 12
Joined: 16 Jun 2017, 12:37

Re: ESPeasy 2.0 MQTT Broadcast

#3 Post by nigelbe » 16 Jun 2017, 14:10

Hello,

I have looked at MQTT but I don't understand it. So I tried this:
Screenshot 2017-06-16 12.58.36.png
Screenshot 2017-06-16 12.58.36.png (37.04 KiB) Viewed 9448 times
and I ended up with this:
Screenshot 2017-06-16 12.58.57.png
Screenshot 2017-06-16 12.58.57.png (9.84 KiB) Viewed 9448 times
What's all the 4 values about and why ADC(TOUT)?

I am bemused by it all.

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

Re: ESPeasy 2.0 MQTT Broadcast

#4 Post by grovkillen » 16 Jun 2017, 14:40

The MQTT Import plugin work as such:

You can have up to 4 imported values per device/task. This doesn't mean that you HAVE to use them all.

The name is the name you use in rules etc. internally within ESP Easy.
MQTT Topic 1-4 is the topics you want to listen to, one per imported value.
Value Name 1-4 is the name of the VALUE that you use internally within ESP Easy.
In general you wont need to use formula, and if no formula is needed you do not need to add any information to that box. So %value% is not necessary.

You may use the MQTT Import together with Rules as this:
MQTT Import settings
MQTT Import settings
Screenshot_1.png (48.55 KiB) Viewed 9445 times
For the rules you could use the imported value as such:

Code: Select all

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
I hope this gives you an idea of how to use the MQTT Import plugin.
Last edited by grovkillen on 16 Jun 2017, 14:42, edited 1 time in total.
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:

nigelbe
Normal user
Posts: 12
Joined: 16 Jun 2017, 12:37

Re: ESPeasy 2.0 MQTT Broadcast

#5 Post by nigelbe » 16 Jun 2017, 14:41

Further to this:

I see IMPT : BAD Import MQTT Command LED in the Log
also IMPT : Illegal Payload OFF LED

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

Re: ESPeasy 2.0 MQTT Broadcast

#6 Post by grovkillen » 16 Jun 2017, 14:45

nigelbe wrote: 16 Jun 2017, 14:41 Further to this:

I see IMPT : BAD Import MQTT Command LED in the Log
also IMPT : Illegal Payload OFF LED
You should not give both the task and the value same name. You call the task/device LED, and the value LED. You should use something like "sniff" (I personally like to call the MQTT Importer , a sniffer), and then I generally use the same value name as the topic that I'm sniffing for .
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:

nigelbe
Normal user
Posts: 12
Joined: 16 Jun 2017, 12:37

Re: ESPeasy 2.0 MQTT Broadcast

#7 Post by nigelbe » 16 Jun 2017, 14:46

Code: Select all

I hope this gives you an idea of how to use the MQTT Import plugin.
I don't have the OPTIONAL section of LED import :?

Which build should I be using?

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

Re: ESPeasy 2.0 MQTT Broadcast

#8 Post by grovkillen » 16 Jun 2017, 14:46

Also forgot. As of now ONLY NUMBERS are allowed to be imported. Thus my use of only integer.
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:

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

Re: ESPeasy 2.0 MQTT Broadcast

#9 Post by grovkillen » 16 Jun 2017, 14:47

nigelbe wrote: 16 Jun 2017, 14:46

Code: Select all

I hope this gives you an idea of how to use the MQTT Import plugin.
I don't have the OPTIONAL section of LED import :?

Which build should I be using?
I've use this both for R147 and the new 2.0.0-devXX versions. No problem what so ever. Your problem is probably the use of non-integer payload (message content of MQTT topic LED should be 0 and not OFF).
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:

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

Re: ESPeasy 2.0 MQTT Broadcast

#10 Post by grovkillen » 16 Jun 2017, 15:09

I made a wikipage for this plugin: https://www.letscontrolit.com/wiki/inde ... QTT_Import

More information will probably follow...
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:

nigelbe
Normal user
Posts: 12
Joined: 16 Jun 2017, 12:37

Re: ESPeasy 2.0 MQTT Broadcast

#11 Post by nigelbe » 16 Jun 2017, 15:12

Thanks a lot

nigelbe
Normal user
Posts: 12
Joined: 16 Jun 2017, 12:37

Re: ESPeasy 2.0 MQTT Broadcast

#12 Post by nigelbe » 16 Jun 2017, 16:21

Thanks a lot, I got it working just by changing to another topic name and numeric payload as you suggested.

I've tried to compile it but I'm in Library Hell :roll:

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

Re: ESPeasy 2.0 MQTT Broadcast

#13 Post by grovkillen » 16 Jun 2017, 16:39

You got official test versions here:

https://github.com/letscontrolit/ESPEasy/releases
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:

nigelbe
Normal user
Posts: 12
Joined: 16 Jun 2017, 12:37

Re: ESPeasy 2.0 MQTT Broadcast

#14 Post by nigelbe » 16 Jun 2017, 16:59

Thanks grovkillen, that's the binary I'm using.

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests