Low battery notifications?

I’m not a coder/developer but I followed the instructions and was able to successfully copy the code above into my IDE and have it show up in my iOS app. The code comments say it is scheduled to check battery status on the 1st and 15th of every month. How to I tweak the code to change the schedule? Let’s say to the 5th and 20th?

This is set in the initialize section with a cron format scheduling as shown in bold.

def initialize() {
//Second Minute Hour DayOfMonth Month DayOfWeek Year
schedule(“0 0 10am 1-31 * ?”, check_batteries)
check_batteries()
}

You can read about the cron format here and a helpful scheduling tool to generate the crontab can be found here.

I think the description of the code (runs on the 1st and 15th of every month) is incorrect for the actual schedule (run every day at 10 am).

You need to remove the “am” from that line for the app to successfully work now.

schedule("0 0 10 1-31 * ?", check_batteries)

Level 89% battery, However
-Montion Sensor is not active in long time.
-The system does not have any notifications

I think the system must know the problem.
Bad problem for ST

I have just tried to set this up to I get an unexpected error occured - where can i start to troubleshoot this?

It could be a copy paste error or a temporary platform issue. If it’s the latter try after a few minutes. Did you see the modification from Adam/drshaw above regarding the am/PM correction?

If you have access to the RBoy Apps server you may want to check out this SmartApp:

It was exactly that, thanks RBoy. Removing the am from the code worked a treat

1 Like