mirror of
https://github.com/beestat/app.git
synced 2025-05-24 02:14:03 -04:00
Fixed #404 - Temperature profiles do not auto-update on self-hosted
This commit is contained in:
parent
6d802f2210
commit
69475d4526
@ -71,6 +71,8 @@ beestat.component.card.temperature_profiles.prototype.decorate_contents_ = funct
|
|||||||
* @return {object} The series data.
|
* @return {object} The series data.
|
||||||
*/
|
*/
|
||||||
beestat.component.card.temperature_profiles.prototype.get_data_ = function() {
|
beestat.component.card.temperature_profiles.prototype.get_data_ = function() {
|
||||||
|
const self = this;
|
||||||
|
|
||||||
var thermostat = beestat.cache.thermostat[this.thermostat_id_];
|
var thermostat = beestat.cache.thermostat[this.thermostat_id_];
|
||||||
var data = {
|
var data = {
|
||||||
'x': [],
|
'x': [],
|
||||||
@ -89,8 +91,13 @@ beestat.component.card.temperature_profiles.prototype.get_data_ = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
thermostat.profile === null
|
this.fetching_data_ !== true &&
|
||||||
|
(
|
||||||
|
thermostat.profile === null ||
|
||||||
|
moment().diff(moment(thermostat.profile.metadata.generated_at), 'days') >= 7
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
|
this.fetching_data_ = true;
|
||||||
this.show_loading_('Fetching');
|
this.show_loading_('Fetching');
|
||||||
new beestat.api()
|
new beestat.api()
|
||||||
.add_call(
|
.add_call(
|
||||||
@ -111,6 +118,7 @@ beestat.component.card.temperature_profiles.prototype.get_data_ = function() {
|
|||||||
'thermostat'
|
'thermostat'
|
||||||
)
|
)
|
||||||
.set_callback(function(response) {
|
.set_callback(function(response) {
|
||||||
|
self.fetching_data_ = false;
|
||||||
beestat.cache.set('thermostat', response.thermostat);
|
beestat.cache.set('thermostat', response.thermostat);
|
||||||
})
|
})
|
||||||
.send();
|
.send();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user