FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
398 views 3 comments
by anonymous
Hi,

I would like to be able to "Output Scheduler Instances" using http post/get or som other API (not manually by the web gui). I know it is possible to do turn output on and off by using the http post/get function. But I would like to be able to set up scheduled events in advance. Ex:

Turn on output 2022-02-27 13:00:00

Turn off output 2022-02-27 15:00:00

Br,

Henrik

1 Answer

0 votes
by anonymous
Hello. Can you elaborate a bit more on the solution you need.

Effectively you can go to SERVICES > I/O JUGGLER > Scheduler Menu of your device and add a timed instance to trigger the output of the device at specific times and days.

You can setup as many trigger actions you need. Keep in mind that you have to update your firmware to the 07.XX.XX version and keep the Time-Date updated. You can  Sync the Date of your device under SERVICES > NTP Menu.
by anonymous
Thank you for your answer!

I will try to explain more.

As I understand it the scheduler is good for setting reoccurring events like: "Turn output on at 09:00 every tuesday".

What I would like to add is something like this: "Turn output on 2022-04-12 13:00".

I would like to turn on the output at a specific timestamp (date and time).

Is this possible to accomplish using the API?

Br,

Henrik
by anonymous

Hello Henrik

Basically you want to make like a calendar trigger, isn't it?

Sadly there is no built int tool to program such task, what you can do for sure is to make some kind of script that checks every certain amount of time if it is already the corresponding date and time. 

Right now we don't have any script like that that we could provide, but there are a few example here in the crowd support of people that have written a few scripts.

As for example:



# Put your custom commands here that should be executed once

# the system init finished. By default this file does nothing.

#curl -X GET "http://192.168.2.1/cgi-bin/io_state?username=admin&password=extreme123&pin=dio0&state=on"

service cron restart

/etc/init.d/cron enable

. /usr/share/libubox/jshn.sh

json_init

MSG=`ubus call ioman.gpio.dio0 status`

json_load "$MSG"

json_dump

json_get_var var1 value

if [ $var1 = 1 ]; then

sleep 1        

curl -X GET "http://192.168.2.1/cgi-bin/io_state?username=admin&password=extreme123&pin=dio0&state=off"

else sleep 1;

fi

exit 0

Then I added this to Crontabs File /etc/crontabs/root

*/1 * * * * sh /etc/rc.local

by anonymous
Thank you!

I will see if I can make something out of this.