mirror of
https://github.com/beestat/app.git
synced 2025-07-09 03:04:07 -04:00
Added API call for cron job to be able to generate thermostat profiles weekly
This commit is contained in:
parent
9ef6773440
commit
fc41e7c2fc
@ -15,6 +15,7 @@ class thermostat extends cora\crud {
|
|||||||
'restore_alert',
|
'restore_alert',
|
||||||
'set_reported_system_types',
|
'set_reported_system_types',
|
||||||
'generate_profile',
|
'generate_profile',
|
||||||
|
'generate_profiles',
|
||||||
'get_metrics'
|
'get_metrics'
|
||||||
],
|
],
|
||||||
'public' => []
|
'public' => []
|
||||||
@ -217,6 +218,25 @@ class thermostat extends cora\crud {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate profiles for all thermostats. This pretty much only exists for
|
||||||
|
* the cron job.
|
||||||
|
*/
|
||||||
|
public function generate_profiles() {
|
||||||
|
$thermostats = $this->read();
|
||||||
|
foreach($thermostats as $thermostat) {
|
||||||
|
$this->generate_profile(
|
||||||
|
$thermostat['thermostat_id']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->api(
|
||||||
|
'user',
|
||||||
|
'update_sync_status',
|
||||||
|
['key' => 'thermostat.generate_profiles']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a new profile for this thermostat.
|
* Generate a new profile for this thermostat.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user