How to send a SMS every x days?

Post your questions and help other users.

Moderator: Martin

Post Reply
Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

How to send a SMS every x days?

Post by Wibbly » 24 Apr 2015 13:59

What would be the simplest method to achieve this? The phone might be rebooted in between so any variables set would be lost.

Should I set a flow, using the time trigger, and a script to test the inverval by dividing the current date in days by x and see if it's a whole number? If, so, what should such an expression in the script look like, please?

(The use case is a cheap phone being used at home for home automation, and that I have to instigate a chargeable event every 90 days to keep its SIM active on the GSM network. The phone in question is normally only used to receive SMSs to trigger actions that take place over WiFi, so no chargeable events occur)

User avatar
TheBrain1984
Posts: 137
Joined: 07 Aug 2013 08:17
Location: Germany

Re: How to send a SMS every x days?

Post by TheBrain1984 » 24 Apr 2015 22:59

Hi,

First of all after a reboot of the phone not every var is lost. The global_vars (vars that begin with global_ you can check them under the menu --> manage --> global vars) keep their value.
I would do it like this:
I would make a flow that starts like every 5 hours. The first thing the flow does to check if the triggertime is bigger than global_totrigger (if global_totrigger is present), if yes send the message and set global_totrigger via script like global_totrigger = addDays(x, triggertime) //x is the value of days you want to add
and if not not it should do nothing.

Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

Re: How to send a SMS every x days?

Post by Wibbly » 25 Apr 2015 13:50

Thanks for the clarifaction and steer. Will give it a go :)

Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

Re: How to send a SMS every x days?

Post by Wibbly » 25 Apr 2015 14:56

Got it to work once I realised the syntax is addDays(triggertime, x) rather than addDays(x, triggertime). :)

User avatar
TheBrain1984
Posts: 137
Joined: 07 Aug 2013 08:17
Location: Germany

Re: How to send a SMS every x days?

Post by TheBrain1984 » 26 Apr 2015 14:32

Sorry, my fault. ;)

Post Reply