diff --git a/js/beestat/floor_plan.js b/js/beestat/floor_plan.js index 93c2ec9..829757a 100644 --- a/js/beestat/floor_plan.js +++ b/js/beestat/floor_plan.js @@ -173,7 +173,10 @@ beestat.floor_plan.get_sensor_ids_map = function(floor_plan_id) { const sensor_ids_map = {}; floor_plan.data.groups.forEach(function(group) { group.rooms.forEach(function(room) { - if (room.sensor_id !== undefined) { + if ( + room.sensor_id !== undefined && + beestat.cache.sensor[room.sensor_id] !== undefined + ) { sensor_ids_map[room.sensor_id] = true; } }); @@ -195,7 +198,10 @@ beestat.floor_plan.get_thermostat_ids_map = function(floor_plan_id) { const thermostat_ids_map = {}; floor_plan.data.groups.forEach(function(group) { group.rooms.forEach(function(room) { - if (room.sensor_id !== undefined) { + if ( + room.sensor_id !== undefined && + beestat.cache.sensor[room.sensor_id] !== undefined + ) { const sensor = beestat.cache.sensor[room.sensor_id]; thermostat_ids_map[sensor.thermostat_id] = true; } diff --git a/js/component/card/floor_plan_editor.js b/js/component/card/floor_plan_editor.js index 793b4ae..be6d841 100644 --- a/js/component/card/floor_plan_editor.js +++ b/js/component/card/floor_plan_editor.js @@ -601,7 +601,10 @@ beestat.component.card.floor_plan_editor.prototype.decorate_info_pane_room_ = fu sensor_input.render(div); - if (self.state_.active_room_entity.get_room().sensor_id !== undefined) { + if ( + self.state_.active_room_entity.get_room().sensor_id !== undefined && + beestat.cache.sensor[self.state_.active_room_entity.get_room().sensor_id] !== undefined + ) { sensor_input.set_value(self.state_.active_room_entity.get_room().sensor_id); } else { sensor_input.set_value(''); diff --git a/js/component/card/three_d.js b/js/component/card/three_d.js index 07055a9..e13ced9 100644 --- a/js/component/card/three_d.js +++ b/js/component/card/three_d.js @@ -430,7 +430,8 @@ beestat.component.card.three_d.prototype.decorate_controls_ = function(parent) { let thermostat_ids; if ( active_room !== null && - active_room.sensor_id !== undefined + active_room.sensor_id !== undefined && + beestat.cache.sensor[active_room.sensor_id] !== undefined ) { thermostat_ids = [beestat.cache.sensor[active_room.sensor_id].thermostat_id]; } else { diff --git a/js/component/input/select.js b/js/component/input/select.js index 657e4b5..6f16768 100644 --- a/js/component/input/select.js +++ b/js/component/input/select.js @@ -41,7 +41,6 @@ beestat.component.input.select.prototype.decorate_ = function(parent) { this.input_.style.color = '#fff'; this.input_.style.outline = 'none'; this.input_.style.transition = 'background 200ms ease'; - this.input_.style.marginBottom = beestat.style.size.gutter + 'px'; this.input_.style.borderBottom = '2px solid ' + beestat.style.color.lightblue.base; // Clear any existing option values from the input. diff --git a/js/component/scene.js b/js/component/scene.js index a821d60..d152d0d 100644 --- a/js/component/scene.js +++ b/js/component/scene.js @@ -411,50 +411,52 @@ beestat.component.scene.prototype.update_ = function() { const sensor = beestat.cache.sensor[room.sensor_id]; let icon; let icon_opacity; - if ( - self.data_.series.compressor_cool_1[sensor.thermostat_id][time] !== undefined && - self.data_.series.compressor_cool_1[sensor.thermostat_id][time] > 0 - ) { - icon = 'snowflake'; - icon_opacity = self.data_.series.compressor_cool_1[sensor.thermostat_id][time]; - } else if ( - self.data_.series.compressor_cool_2[sensor.thermostat_id][time] !== undefined && - self.data_.series.compressor_cool_2[sensor.thermostat_id][time] > 0 - ) { - icon = 'snowflake'; - icon_opacity = self.data_.series.compressor_cool_2[sensor.thermostat_id][time]; - } else if ( - self.data_.series.compressor_heat_1[sensor.thermostat_id][time] !== undefined && - self.data_.series.compressor_heat_1[sensor.thermostat_id][time] > 0 - ) { - icon = 'fire'; - icon_opacity = self.data_.series.compressor_heat_1[sensor.thermostat_id][time]; - } else if ( - self.data_.series.compressor_heat_2[sensor.thermostat_id][time] !== undefined && - self.data_.series.compressor_heat_2[sensor.thermostat_id][time] > 0 - ) { - icon = 'fire'; - icon_opacity = self.data_.series.compressor_heat_2[sensor.thermostat_id][time]; - } else if ( - self.data_.series.auxiliary_heat_1[sensor.thermostat_id][time] !== undefined && - self.data_.series.auxiliary_heat_1[sensor.thermostat_id][time] > 0 - ) { - icon = 'fire'; - icon_opacity = self.data_.series.auxiliary_heat_1[sensor.thermostat_id][time]; - } else if ( - self.data_.series.auxiliary_heat_2[sensor.thermostat_id][time] !== undefined && - self.data_.series.auxiliary_heat_2[sensor.thermostat_id][time] > 0 - ) { - icon = 'fire'; - icon_opacity = self.data_.series.auxiliary_heat_2[sensor.thermostat_id][time]; - } else if ( - self.data_.series.fan[sensor.thermostat_id][time] !== undefined && - self.data_.series.fan[sensor.thermostat_id][time] > 0 - ) { - icon = 'fan'; - icon_opacity = self.data_.series.fan[sensor.thermostat_id][time]; + if (sensor !== undefined) { + if ( + self.data_.series.compressor_cool_1[sensor.thermostat_id][time] !== undefined && + self.data_.series.compressor_cool_1[sensor.thermostat_id][time] > 0 + ) { + icon = 'snowflake'; + icon_opacity = self.data_.series.compressor_cool_1[sensor.thermostat_id][time]; + } else if ( + self.data_.series.compressor_cool_2[sensor.thermostat_id][time] !== undefined && + self.data_.series.compressor_cool_2[sensor.thermostat_id][time] > 0 + ) { + icon = 'snowflake'; + icon_opacity = self.data_.series.compressor_cool_2[sensor.thermostat_id][time]; + } else if ( + self.data_.series.compressor_heat_1[sensor.thermostat_id][time] !== undefined && + self.data_.series.compressor_heat_1[sensor.thermostat_id][time] > 0 + ) { + icon = 'fire'; + icon_opacity = self.data_.series.compressor_heat_1[sensor.thermostat_id][time]; + } else if ( + self.data_.series.compressor_heat_2[sensor.thermostat_id][time] !== undefined && + self.data_.series.compressor_heat_2[sensor.thermostat_id][time] > 0 + ) { + icon = 'fire'; + icon_opacity = self.data_.series.compressor_heat_2[sensor.thermostat_id][time]; + } else if ( + self.data_.series.auxiliary_heat_1[sensor.thermostat_id][time] !== undefined && + self.data_.series.auxiliary_heat_1[sensor.thermostat_id][time] > 0 + ) { + icon = 'fire'; + icon_opacity = self.data_.series.auxiliary_heat_1[sensor.thermostat_id][time]; + } else if ( + self.data_.series.auxiliary_heat_2[sensor.thermostat_id][time] !== undefined && + self.data_.series.auxiliary_heat_2[sensor.thermostat_id][time] > 0 + ) { + icon = 'fire'; + icon_opacity = self.data_.series.auxiliary_heat_2[sensor.thermostat_id][time]; + } else if ( + self.data_.series.fan[sensor.thermostat_id][time] !== undefined && + self.data_.series.fan[sensor.thermostat_id][time] > 0 + ) { + icon = 'fan'; + icon_opacity = self.data_.series.fan[sensor.thermostat_id][time]; + } + icon_opacity = Math.round(icon_opacity * 10) / 10; } - icon_opacity = Math.round(icon_opacity * 10) / 10; // Labels if ( @@ -559,7 +561,10 @@ beestat.component.scene.prototype.add_room_ = function(layer, group, room) { const material = new THREE.MeshPhongMaterial({ 'color': color }); - if (room.sensor_id === undefined) { + if ( + room.sensor_id === undefined || + beestat.cache.sensor[room.sensor_id] === undefined + ) { const loader = new THREE.TextureLoader(); loader.load( 'img/visualize/stripe.png',