Newbie Rules Question

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
smathur
New user
Posts: 3
Joined: 21 Oct 2016, 17:23

Newbie Rules Question

#1 Post by smathur » 21 Oct 2016, 18:14

I have a setup running with Openhab, MQTT and multiple ESP nodes.

One of the ESPEasy nodes running R120 is named "ESP1" and is configured with Subscribe Template "/ESP1/#". Through Openhab, user action generates a MQTT message "/ESP1/aaa/bbb 1".

What is the event syntax in ESPEasy Rules that I need for the above message?

I have read many posts on the ESPEasy rules but have not been able to figure it out as I am a newbie to the rules.

Thanks in advance.

smathur
New user
Posts: 3
Joined: 21 Oct 2016, 17:23

Re: Newbie Rules Question

#2 Post by smathur » 28 Oct 2016, 09:15

Tried a few things and found that "MQTT Import" provided the best solution.

timsson
Normal user
Posts: 77
Joined: 25 Mar 2016, 22:00

Re: Newbie Rules Question

#3 Post by timsson » 28 Oct 2016, 10:30

smathur wrote: ..MQTT message "/ESP1/aaa/bbb 1".
What is the event syntax in ESPEasy Rules that I need for the above message?
on <event> do
publish /ESP1/aaa/bbb,1
endon

smathur
New user
Posts: 3
Joined: 21 Oct 2016, 17:23

Re: Newbie Rules Question

#4 Post by smathur » 03 Nov 2016, 22:21

Thanks timsson. However, I need to subscribe rather than publish as the publishing is done by Openhab. Based on the content of the topic subscribed in the ESPEasy device, I want to process a rule.
timsson wrote: on <event> do
publish /ESP1/aaa/bbb,1
endon

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: Newbie Rules Question

#5 Post by Drum » 07 Nov 2016, 10:03

I am not sure how this works as I have not tried to use the subscribe, but can you tell me what shows up in the log when the MQTT message arrives? If it is an event, try to use it as an event in "rules".
I haven't found anything else, but this is where I would start. Syntax is probably the same as any event based rule.

Please post if it works!

StephenF
Normal user
Posts: 13
Joined: 31 May 2016, 23:34

Re: Newbie Rules Question

#6 Post by StephenF » 12 Nov 2016, 23:07

Several posts showing you cannot subscribe to MQTT published data on ESPEasy. See also http://www.letscontrolit.com/wiki/index ... _Variables

However, you can use it this way:

In OpenHAB: executeCommandLine("curl http://192.168.1.201/control?cmd=event,myEventNo1=123")

on myEventNo1 do
timerSet 1,%eventvalue%
endon

or for a Dummy Device (like a variable).....

on myEventNo1 do
TaskValueSet 1,1,%eventvalue%
endon

timsson
Normal user
Posts: 77
Joined: 25 Mar 2016, 22:00

Re: Newbie Rules Question

#7 Post by timsson » 12 Nov 2016, 23:35

StephenF wrote:Several posts showing you cannot subscribe to MQTT published data on ESPEasy. ......
endon
https://github.com/ESP8266nu/ESPEasyPlu ... Import.ino

StephenF
Normal user
Posts: 13
Joined: 31 May 2016, 23:34

Re: Newbie Rules Question

#8 Post by StephenF » 22 Nov 2016, 21:30

timsson wrote:
StephenF wrote:Several posts showing you cannot subscribe to MQTT published data on ESPEasy. ......
endon
https://github.com/ESP8266nu/ESPEasyPlu ... Import.ino
I am using Esp Easy Mega, and the MQTT Import works very well... Excellent plugin. Thanks

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 29 guests