Trigger event on reboot. **solved**

All about the standard Meteobridge devices based on mobile routers from TP-Link, D-Link, ASUS

Moderator: Mattk

Post Reply
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Trigger event on reboot. **solved**

Post by admin »

I was asked by one of the users to add a function that allows triggering a service each time the Meteobridge reboots. After thinking a bit about this reasonable request I realized, that this can already be done. Example below sends an email 60 seconds after reboot of the Meteobridge.

Meteobridge variable "mbsystem-uptime" reports uptime in seconds. Once this is above 60 the alarm trigger is raised and the action started. As the alarm trigger gets never cleared (clear condition always evaluates to zero) no second invocation of the alarm is done.


Bildschirmfoto 2021-09-26 um 11.36.17.png
Bildschirmfoto 2021-09-26 um 11.36.17.png (23.8 KiB) Viewed 4061 times
Mauricio
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: Sun Jan 28, 2018 7:55 pm

Re: Trigger event on reboot

Post by Mauricio »

Hi, I'm trying this template but it doesn't return anything when I perform the test after a reboot.

Image

Any help would be appreciated. If [mbsystem-uptime.0:0] >60 isn't right, please let me know.

Thanks!
Mattk
Platinum Boarder
Platinum Boarder
Posts: 1385
Joined: Mon Sep 22, 2014 3:24 am

Re: Trigger event on reboot

Post by Mattk »

Try [mbsystem-uptime] > 60
Mauricio
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: Sun Jan 28, 2018 7:55 pm

Re: Trigger event on reboot

Post by Mauricio »

Hi, It definitely doesn't work either way, even after submitting a "test" email. I tested it on an MR3020 and an RPi 3b+.
Mattk
Platinum Boarder
Platinum Boarder
Posts: 1385
Joined: Mon Sep 22, 2014 3:24 am

Re: Trigger event on reboot

Post by Mattk »

[mbsystem-uptime] > 60 definitely works on a MBPro but is not immediate (takes a couple of minutes) as it appears the trigger is being checked at a non immediate interval? I couldn't get the original to work.
Mauricio
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: Sun Jan 28, 2018 7:55 pm

Re: Trigger event on reboot

Post by Mauricio »

It is possible to build another alternative to add a function that allows triggering a service each time the Meteobridge reboots?
Mattk
Platinum Boarder
Platinum Boarder
Posts: 1385
Joined: Mon Sep 22, 2014 3:24 am

Re: Trigger event on reboot

Post by Mattk »

Have tested this further and is working fine on a MBPro, Nano & NanoSD.

One thing I was noticing was > 60 (seconds) failed at times? Changed to > 120 (seconds) and no further issues.
Mauricio
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: Sun Jan 28, 2018 7:55 pm

Re: Trigger event on reboot

Post by Mauricio »

Hi, I'm testing it with an MR3020 v3 and an RPi 3B+ configured this way.

Raise: [mbsystem-uptime] > 120
Clear: 0

But it doesn't work.

Thanks
Mauricio
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: Sun Jan 28, 2018 7:55 pm

Re: Trigger event on reboot

Post by Mauricio »

Now it works! with:

Raise: ([mbsystem-uptime.0:0] > 60)
Clear: 0

I don't understand what I was doing wrong

Thanks!
Mattk
Platinum Boarder
Platinum Boarder
Posts: 1385
Joined: Mon Sep 22, 2014 3:24 am

Re: Trigger event on reboot

Post by Mattk »

So you have included the (outside brackets), yes that might do it.
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: Trigger event on reboot

Post by admin »

Operation of user-defined events is blocked for a while until main sensor date (wind, rain, outdoor temp is there. You can read in System - Logging if Meteobridge is still waiting for sensor data. This might delay doing the event trigger a bit. However, the round brackets should not have any impact here.
Mauricio
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: Sun Jan 28, 2018 7:55 pm

Re: Trigger event on reboot

Post by Mauricio »

Hi, without the brackets, it works correctly. If you set the value to 60 seconds, it sends two alerts; if you set the value to 120 seconds: it sends only one alert.
I left it like this.
[mbsystem-uptime.0:0] >120
Thanks!!
Post Reply