-
Notifications
You must be signed in to change notification settings - Fork 0
/
cron.php
57 lines (35 loc) · 1003 Bytes
/
cron.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
require 'vendor/autoload.php';
use GO\Scheduler;
define('ROOT_DIR', __DIR__);
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();
$scheduler = new Scheduler();
$scheduler->call(function () {
// Call Nest API Every 5mins
$n = new Nest();
$nestDevices = $n->getDevices();
$n->insertHouseTemps();
})->at('*/5 * * * *');
$scheduler->call(function () {
// Call OpenWeather API Every 5mins
$owm = new OpenWeather();
$temp = $owm->getOutsideTemp();
$owm->insertOutsideTemp();
})->at('*/15 * * * *');
$scheduler->call(function () {
// Call HUE Api every 1min
$ph = new PhilipsHue();
$lightsOnCount = $ph->insertLightsOn();
})->everyMinute();
$scheduler->call(function () {
// Call Transmission RPC every 1min
$ph = new Transmission();
$lightsOnCount = $ph->insertBandwidthStats();
})->everyMinute();
$scheduler->call(function () {
// Call Sabnzbd API every 1min
$sb = new Sabnzbd();
$sb->insertBandwidthStats();
})->everyMinute();
$scheduler->run();