Rules and triggers
Moderators: grovkillen, Stuntteam, TD-er
Rules and triggers
I've been digging into the Rules section of the wiki and trying to test out some triggers to use for my project. I'd like an LED to light when WiFi is connected, same for MQTT connected and lastly every time an MQTT Publish happens. I've found the WiFi and MQTT triggers but not one for the MQTT Publish. Also, the Wifi and MQTT connect triggers do not seem to be firing for me.
This works
On System#Boot do
gpio,16,1
endon
But these do not
On MQTTimport#Connected do
gpio,16,1
endon
On WiFi#Connected do
gpio,16,1
endon
Am I doing something wrong?
This works
On System#Boot do
gpio,16,1
endon
But these do not
On MQTTimport#Connected do
gpio,16,1
endon
On WiFi#Connected do
gpio,16,1
endon
Am I doing something wrong?
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules and triggers
Are you sure they don't work? Looked in the logs?
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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Rules and triggers
I’m just basing this on the fact that the led I have attached to the gpio does not light up. When I run the system boot rule the led lights up fine. I’ll check the logs but why would that be diffferent?
Re: Rules and triggers
It should show entries for GPIO-16 and other events so you can debug the problem. But you should use Serial Log (not web log) because the WiFi and MQTT rule actions will occur before web log has begun.I’ll check the logs but why would that be diffferent?
BTW, I tested ESP_Easy_mega-20190409_normal_ESP8285_1M.bin on a Sonoff Basic and confirmed that MQTTimport#Connected and WiFi#Connected work correctly. You didn't say which version you are using, so if it's not a recent release then try the latest MEGA version.
Please note that MQTTimport#Connected requires that you have a properly configured MQTT Controller **and** have also enabled the Generic MQTT Import plugin. If the MQTT Import plugin is not installed then use the MQTT#Connected rule instead.
- Thomas
Re: Rules and triggers
Thank you Thomas and you are correct, should have posted the version I'm using. Currently I'm trying to use up these 1mg Wemos D1 mini boards I have. Since they only have 1mg flash I'm using the ESPEasy_R120_1024.bin build. Can I use the serial monitor on this build? I'll keep testing more tonight.
Thank you
Thank you
Re: Rules and triggers
ESPEasy_R120_1024.bin is old legacy code. It might not support what you are trying to do. Install the latest MEGA release and try again.
- Thomas
- Thomas
Re: Rules and triggers
From what I'm reading, I don't think I can run mega (easily) on this little 1 mg Wemos
That is completely cool because ESP Easy is rather powerful and getting it all to fit on a little 1mg slot it crazy!
I have more then enough functionality to do what I need right now with this older build to play with and will just have to pick up some 4mg Wemos boards.
Really not a problem and worth it to get to use the Mega build HAHAHA!
Running on 1mg
https://www.letscontrolit.com/wiki/inde ... MB_modules
Thank you again!
That is completely cool because ESP Easy is rather powerful and getting it all to fit on a little 1mg slot it crazy!
I have more then enough functionality to do what I need right now with this older build to play with and will just have to pick up some 4mg Wemos boards.
Really not a problem and worth it to get to use the Mega build HAHAHA!
Running on 1mg
https://www.letscontrolit.com/wiki/inde ... MB_modules
Thank you again!
Re: Rules and triggers
As mentioned earlier, I tested your rule examples with ESP_Easy_mega-20190409_normal on a 1MB Sonoff module. Your 1MB Wemos should work fine too if you flash with a MEGA release that was built for your 1M modules. You can't OTA flash, you need to use serial flash.From what I'm reading, I don't think I can run mega (easily) on this little 1 mg Wemos
- Thomas
Re: Rules and triggers
Sounds good to me! I'll get the USB cable out now and play HAHAHA! Thank you
Re: Rules and triggers
Quick update. I flashed ESP_Easy_mega-20190607_normal_core_241_ESP8266_1M to the Wemos and it installed fine. Would this be the latest version? I'm not sure what the 241 means in the build name and saw some higher numbers in the list. Regardless, just like you said Thomas, both rules work perfectly! I did end up using the MQTT rather then MQTTImport. I didn't realize the difference so thank you for pointing that out. I'm going to do some more playing with rules because I would like to have the LED blink when an MQTT publish is sent. I'm pretty sure I saw an event for that so I'll go have some fun!
Honestly I have to say that once I get the hang of ESP Easy it's gonna be so much easier to create my IoT projects. I'll still be hacking away at the Arduino IDE for my other stuff but for sensor communication this is the way to go for sure!
Honestly I have to say that once I get the hang of ESP Easy it's gonna be so much easier to create my IoT projects. I'll still be hacking away at the Arduino IDE for my other stuff but for sensor communication this is the way to go for sure!
Re: Rules and triggers
At the moment it is the latest.I flashed ESP_Easy_mega-20190607_normal_core_241_ESP8266_1M to the Wemos and it installed fine. Would this be the latest version?
Congrats on your success.... both rules work perfectly!
- Thomas
Re: Rules and triggers
Whelp, I guess I miss read the events in the wiki. I thought I saw one for when an MQTT publish happens. Right now I have all my hardware together and I tested everything based on System Boot, WiFi Connect, MQTT Connect just to confirm that the rules would work and that my horrible solder skills held up! HAHAHA
Is there an event that I can listen for that fires when an MQTT Publish happens?
Thank you
Is there an event that I can listen for that fires when an MQTT Publish happens?
Thank you
Re: Rules and triggers
Instead of using a plugin's Send to Controller option, you can create rules that are triggered when the device's value changes. In the rule you can publish the MQTT message, plus call a timer rule that winks the LED.Is there an event that I can listen for that fires when an MQTT Publish happens?
- Thomas
Who is online
Users browsing this forum: No registered users and 51 guests