MQTT input in rules

Moderators: grovkillen, Stuntteam, TD-er

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

Re: MQTT input in rules

#11 Post by grovkillen » 12 Jul 2018, 12:34

No problem to send HTTP commands using a web interface. Or what's the hiccups?
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:

waspie
Normal user
Posts: 127
Joined: 09 Feb 2017, 19:35

Re: MQTT input in rules

#12 Post by waspie » 12 Jul 2018, 14:34

joyNstay wrote: 12 Jul 2018, 12:04 I don't know if that will work... It seems that this is just commands in the rule section. When I wrote button I mean a visual button in the browser. Sorry for the confusion.
i don't think the espeasy is really meant to be used as a control panel (of sorts). it's more for setting up the device to control things (motors, lights, etc). what you need is home automation software that sends the commands to the esp and then the esp makes it happen.


you need to be looking at openhab, domoticz, home assistant, etc.

joyNstay
New user
Posts: 9
Joined: 11 Jul 2018, 14:42

Re: MQTT input in rules

#13 Post by joyNstay » 18 Jul 2018, 16:13

So If I have understood currently ESPeasy is more to send an signal and the esp do it immediately and software like openhab is more hard coded and you have the logic in the esp( or sonoff)?

TD-er
Core team member
Posts: 8749
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MQTT input in rules

#14 Post by TD-er » 18 Jul 2018, 22:13

joyNstay wrote: 18 Jul 2018, 16:13 So If I have understood currently ESPeasy is more to send an signal and the esp do it immediately and software like openhab is more hard coded and you have the logic in the esp( or sonoff)?
ESPeasy has a number of possibilities.
For example:
- Operate sensors/displays on a number of pins. (support for specific sensors is done in "Plugins" or "Tasks" as they are called in ESPeasy)
- Collect data from the sensors and do some simple computations on them. (Formulas at the bottom of each "plugin" page)
- Send sensor data to a number of typical data-collecting/processing units (they are called controllers in ESPeasy)
- Act on events and perform some time-based actions (Rules in ESPeasy)

Its possibilities are not limited to these, but in general it is the functionality of ESPeasy.

The controllers interface to some other tools, which are often more the general interface hubs of the home automation system.
For example Domoticz, OpenHAB, HomeAssistant, etc.

There is also a plugin called MQTT input, which is just plainly a hack, since it does not fit as plugin (a plugin interacts with hardware) and it is not used as a controller (what it should be)
Problem with the current implementation of controllers is that they're just sending data and not (yet) meant to collect data, so I get why it was written like it is now.

I hope it is now a bit more clear how each interacts with eachother.
N.B. this may (and will) change/shift in the future, but for now, that's how it is working.

joyNstay
New user
Posts: 9
Joined: 11 Jul 2018, 14:42

Re: MQTT input in rules

#15 Post by joyNstay » 19 Jul 2018, 00:47

Thank you for you reply but still nobody has answer my question. Can from the ESPeasy and maybe MQTT change the code from ESP( foe example sonoff)?
For example some how to say to sonoff turn on in 3 hour and after 4 hours turn off. And that will happened both when it is connected to the network and when it is not connected. I have found that it is possible throw MQTT message but MQTT works only when it is connected to the network because the message is turn onn/off NOW. I need a tool to do time scheduling. Do you know anything about that?

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

Re: MQTT input in rules

#16 Post by grovkillen » 19 Jul 2018, 08:06

You can use event command and send a integer/float values as %eventvalue% and that value could be used as the timer duration.
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:

wim16
Normal user
Posts: 88
Joined: 01 May 2017, 20:35

Re: MQTT input in rules

#17 Post by wim16 » 19 Jul 2018, 09:48

And you might store the %eventvalue% in a dummy variable so that it is still available when there is no network connection.

kirelam
Normal user
Posts: 29
Joined: 04 Apr 2016, 12:10
Location: Westervoort

Re: MQTT input in rules

#18 Post by kirelam » 14 Sep 2020, 20:18

Dear IOT'ers,

Maybe someone here can help me also. My problem may be of a silimar one.

I have build a chickenbot with stepper motor in it driven on a Adafruit motorshield.
over HTTP the command works great, but now i am switching to MQTT.

No command seems to work :S

finally i found this thread, and it seems mayby i can solve my problem though a rule!

My rule right now in ESPEASY is:
This is just for testing, but it is an important one (otherwise the motor burns itself crisp)

on Chickenbot#Feeder=Release do
MotorShieldCMD,Stepper,1,Release
endon

My HA command is:
ChickenBot_4/Chickenbot (with the payload) Release

nothing happens :(

Regards,
Kirelam

User avatar
Ath
Normal user
Posts: 3513
Joined: 10 Jun 2018, 12:06
Location: NL

Re: MQTT input in rules

#19 Post by Ath » 14 Sep 2020, 21:51

There are at least a few misunderstandings in your code.
ESPEasy works with float and integer values. And though it is possible to trigger events based on string values, you can't store a string in a Dummy Device, so trying to send it over MQTT, to trigger an event on it, will not work.

Using "1" instead of "Release" should be able to work.

NB: I know nearly nothing about MQTT, so that side of the story I can't help you further, sorry.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8749
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MQTT input in rules

#20 Post by TD-er » 14 Sep 2020, 21:53

Sending commands via MQTT should be done via the subscribed topic + /cmd
So if you subscribe to the topic

Code: Select all

ChickenBot_4/Chickenbot 
you should publish the ESPEasy commands to

Code: Select all

ChickenBot_4/Chickenbot/cmd

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 37 guests