EVENT call from MQTT

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
leel1967l
Normal user
Posts: 73
Joined: 30 Nov 2017, 18:29

EVENT call from MQTT

#1 Post by leel1967l » 01 Feb 2018, 09:39

Hi,
I am building my first project integrating ESPEASY and OPENHAB2.

I would like to understand how I can send and event call from MQTT.
In other words, I would like to trigger a rule from MQTT.

I know how it can be done using http: http://<espeasyip>/control?cmd=event,remoteTimerControl=5
But I need to do in MQTT.

How can this be achieved?

thanks

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

Re: EVENT call from MQTT

#2 Post by grovkillen » 01 Feb 2018, 10:11

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:

leel1967l
Normal user
Posts: 73
Joined: 30 Nov 2017, 18:29

Re: EVENT call from MQTT

#3 Post by leel1967l » 01 Feb 2018, 11:31

grovkillen wrote: 01 Feb 2018, 10:11 Wiki is your friend: https://www.letscontrolit.com/wiki/inde ... _Reference
Hi @grovkillen,
I appreciate your help, but I had already checked that page and the tutorial page.
I couldn't find an example of how to format the syntax of a MQTT request to call an EVENT.

For a GPIO the syntax that I use is:
Switch Sonoff1 {mqtt=">[mymosquitto:/Sonoff_1/gpio/12:command:ON:1],>[mymosquitto:/Sonoff_1/gpio/12:command:OFF:0]"}

What should be the syntax for an EVENT?

thanks

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

Re: EVENT call from MQTT

#4 Post by grovkillen » 01 Feb 2018, 14:14

Topic:

Code: Select all

<unitname>/cmd
Payload:

Code: Select all

event,remoteTimerControl=5
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:

leel1967l
Normal user
Posts: 73
Joined: 30 Nov 2017, 18:29

Re: EVENT call from MQTT

#5 Post by leel1967l » 01 Feb 2018, 15:01

grovkillen wrote: 01 Feb 2018, 14:14 Topic:

Code: Select all

<unitname>/cmd
Payload:

Code: Select all

event,remoteTimerControl=5
will try tonight thanks

leel1967l
Normal user
Posts: 73
Joined: 30 Nov 2017, 18:29

Re: EVENT call from MQTT

#6 Post by leel1967l » 01 Feb 2018, 23:11

grovkillen wrote: 01 Feb 2018, 14:14 Topic:

Code: Select all

<unitname>/cmd
Payload:

Code: Select all

event,remoteTimerControl=5
Hi,
I can't understand the syntax.
Tried this in Openhab, but it did not trigger any rule in ESPeasy:

Code: Select all

{mqtt=">[mymosquitto:/Sonoff_1/cmd/event:command:remoteTimerControl=5:0]"}
Rule is (works with http call):

Code: Select all

on remoteTimerControl do
  TaskValueSet 5,1,%eventvalue%
endon

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

Re: EVENT call from MQTT

#7 Post by grovkillen » 02 Feb 2018, 06:06

leel1967l wrote: 01 Feb 2018, 23:11
grovkillen wrote: 01 Feb 2018, 14:14 Topic:

Code: Select all

<unitname>/cmd
Payload:

Code: Select all

event,remoteTimerControl=5
Hi,
I can't understand the syntax.
Tried this in Openhab, but it did not trigger any rule in ESPeasy:

Code: Select all

{mqtt=">[mymosquitto:/Sonoff_1/cmd/event:command:remoteTimerControl=5:0]"}
Rule is (works with http call):

Code: Select all

on remoteTimerControl do
  TaskValueSet 5,1,%eventvalue%
endon
This is a openhab issue. I don't use that controller myself. But to start I would use a mqtt viewer (I use MQTT snooper). That way you can see what the actual message from openhab looks like.

The being said, my guess is that you want the config file to read something like this:

Code: Select all

{mqtt=">[mymosquitto:/Sonoff_1/cmd:command:event,remoteTimerControl=5:0]"}
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:

Who is online

Users browsing this forum: Ahrefs [Bot], Anthropic Claude Bot [bot], opensiteexplorer.org/dotbot [bot] and 20 guests