mirror of
https://github.com/beestat/app.git
synced 2025-06-02 05:06:25 -04:00
Fixed sensor temperature getting ignored if the sensor does not support occupancy.
This commit is contained in:
parent
c3891ffff8
commit
78fb1d99fc
@ -424,15 +424,12 @@ beestat.component.card.three_d.prototype.get_data_ = function(force) {
|
|||||||
if (beestat.cache.data.three_d__runtime_sensor !== undefined) {
|
if (beestat.cache.data.three_d__runtime_sensor !== undefined) {
|
||||||
// Add to data
|
// Add to data
|
||||||
beestat.cache.data.three_d__runtime_sensor.forEach(function(runtime_sensor) {
|
beestat.cache.data.three_d__runtime_sensor.forEach(function(runtime_sensor) {
|
||||||
if (
|
if (sensor_ids_map[runtime_sensor.sensor_id] !== undefined) {
|
||||||
sensor_ids_map[runtime_sensor.sensor_id] !== undefined &&
|
|
||||||
runtime_sensor.temperature !== null &&
|
|
||||||
runtime_sensor.occupancy !== null
|
|
||||||
) {
|
|
||||||
const timestamp_m = moment(runtime_sensor.timestamp);
|
const timestamp_m = moment(runtime_sensor.timestamp);
|
||||||
const time = timestamp_m.format('HH:mm');
|
const time = timestamp_m.format('HH:mm');
|
||||||
|
|
||||||
// Temperature
|
// Temperature
|
||||||
|
if (runtime_sensor.temperature !== null) {
|
||||||
if (self.data_.series.temperature[runtime_sensor.sensor_id] === undefined) {
|
if (self.data_.series.temperature[runtime_sensor.sensor_id] === undefined) {
|
||||||
self.data_.series.temperature[runtime_sensor.sensor_id] = {};
|
self.data_.series.temperature[runtime_sensor.sensor_id] = {};
|
||||||
}
|
}
|
||||||
@ -440,8 +437,10 @@ beestat.component.card.three_d.prototype.get_data_ = function(force) {
|
|||||||
self.data_.series.temperature[runtime_sensor.sensor_id][time] = [];
|
self.data_.series.temperature[runtime_sensor.sensor_id][time] = [];
|
||||||
}
|
}
|
||||||
self.data_.series.temperature[runtime_sensor.sensor_id][time].push(runtime_sensor.temperature);
|
self.data_.series.temperature[runtime_sensor.sensor_id][time].push(runtime_sensor.temperature);
|
||||||
|
}
|
||||||
|
|
||||||
// Occupancy
|
// Occupancy
|
||||||
|
if (runtime_sensor.occupancy !== null) {
|
||||||
if (self.data_.series.occupancy[runtime_sensor.sensor_id] === undefined) {
|
if (self.data_.series.occupancy[runtime_sensor.sensor_id] === undefined) {
|
||||||
self.data_.series.occupancy[runtime_sensor.sensor_id] = {};
|
self.data_.series.occupancy[runtime_sensor.sensor_id] = {};
|
||||||
}
|
}
|
||||||
@ -450,6 +449,7 @@ beestat.component.card.three_d.prototype.get_data_ = function(force) {
|
|||||||
}
|
}
|
||||||
self.data_.series.occupancy[runtime_sensor.sensor_id][time].push(runtime_sensor.occupancy === true ? 1 : 0);
|
self.data_.series.occupancy[runtime_sensor.sensor_id][time].push(runtime_sensor.occupancy === true ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Average data
|
// Average data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user