mirror of
				https://github.com/beestat/app.git
				synced 2025-10-30 17:52:25 -04:00 
			
		
		
		
	Added system off time to thermostat detail
This commit is contained in:
		
							parent
							
								
									c7fbefcf2e
								
							
						
					
					
						commit
						c015f634eb
					
				| @ -82,6 +82,7 @@ beestat.runtime_thermostat.get_data = function(thermostat_id, range, key) { | |||||||
|     'dehumidifier', |     'dehumidifier', | ||||||
|     'ventilator', |     'ventilator', | ||||||
|     'economizer', |     'economizer', | ||||||
|  |     'off_heat_cool', | ||||||
|     'dummy' |     'dummy' | ||||||
|   ].forEach(function(series_code) { |   ].forEach(function(series_code) { | ||||||
|     data.series[series_code] = []; |     data.series[series_code] = []; | ||||||
| @ -383,6 +384,54 @@ beestat.runtime_thermostat.get_data = function(thermostat_id, range, key) { | |||||||
|         durations.economizer = {'seconds': 0}; |         durations.economizer = {'seconds': 0}; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  |       // System off duration
 | ||||||
|  |       if ( | ||||||
|  |         durations.off_heat_cool.seconds === 0 && | ||||||
|  |         ( | ||||||
|  |           runtime_thermostat.compressor_1 < 300 && | ||||||
|  |           runtime_thermostat.compressor_2 < 300 && | ||||||
|  |           runtime_thermostat.auxiliary_heat_1 < 300 && | ||||||
|  |           runtime_thermostat.auxiliary_heat_2 < 300 && | ||||||
|  |           runtime_thermostat.fan < 300 | ||||||
|  |         ) | ||||||
|  |       ) { | ||||||
|  |         // If currently running and it stops.
 | ||||||
|  |         durations.off_heat_cool = { | ||||||
|  |           'seconds': 300 - Math.max( | ||||||
|  |             runtime_thermostat.compressor_1, | ||||||
|  |             runtime_thermostat.compressor_2, | ||||||
|  |             runtime_thermostat.auxiliary_heat_1, | ||||||
|  |             runtime_thermostat.auxiliary_heat_2 | ||||||
|  |           ) | ||||||
|  |         }; | ||||||
|  |       } else if ( | ||||||
|  |         durations.off_heat_cool.seconds > 0 && | ||||||
|  |         ( | ||||||
|  |           runtime_thermostat.compressor_1 > 0 || | ||||||
|  |           runtime_thermostat.compressor_2 > 0 || | ||||||
|  |           runtime_thermostat.auxiliary_heat_1 > 0 || | ||||||
|  |           runtime_thermostat.auxiliary_heat_2 > 0 | ||||||
|  |         ) | ||||||
|  |       ) { | ||||||
|  |         // If not currently running and it starts
 | ||||||
|  |         durations.off_heat_cool.seconds += | ||||||
|  |           Math.max( | ||||||
|  |             runtime_thermostat.compressor_1, | ||||||
|  |             runtime_thermostat.compressor_2, | ||||||
|  |             runtime_thermostat.auxiliary_heat_1, | ||||||
|  |             runtime_thermostat.auxiliary_heat_2 | ||||||
|  |           ); | ||||||
|  | 
 | ||||||
|  |         durations.off_heat_cool = {'seconds': 0}; | ||||||
|  |       } else if ( | ||||||
|  |         durations.off_heat_cool.seconds > 0 | ||||||
|  |       ) { | ||||||
|  |         // If not currently running
 | ||||||
|  |         durations.off_heat_cool.seconds += 300; | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       data.metadata.series.off_heat_cool.durations[current_m.valueOf()] = durations.off_heat_cool; | ||||||
|  | 
 | ||||||
|       // Equipment
 |       // Equipment
 | ||||||
|       [ |       [ | ||||||
|         'fan', |         'fan', | ||||||
| @ -505,6 +554,7 @@ beestat.runtime_thermostat.get_data = function(thermostat_id, range, key) { | |||||||
|       data.series.dehumidifier.push(null); |       data.series.dehumidifier.push(null); | ||||||
|       data.series.ventilator.push(null); |       data.series.ventilator.push(null); | ||||||
|       data.series.economizer.push(null); |       data.series.economizer.push(null); | ||||||
|  |       data.series.off_heat_cool.push(null); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     current_m.add(5, 'minute'); |     current_m.add(5, 'minute'); | ||||||
|  | |||||||
| @ -154,6 +154,11 @@ beestat.series.fan = { | |||||||
|   'color': beestat.style.color.gray.base |   'color': beestat.style.color.gray.base | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | beestat.series.off_heat_cool = { | ||||||
|  |   'name': 'System Off', | ||||||
|  |   'color': beestat.style.color.gray.base | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| beestat.series.humidifier = { | beestat.series.humidifier = { | ||||||
|   'name': 'Humidifier', |   'name': 'Humidifier', | ||||||
|   'color': beestat.style.color.gray.light |   'color': beestat.style.color.gray.light | ||||||
|  | |||||||
| @ -179,7 +179,8 @@ beestat.component.chart.runtime_thermostat_detail_temperature.prototype.get_opti | |||||||
|     var groups = { |     var groups = { | ||||||
|       'mode': [], |       'mode': [], | ||||||
|       'data': [], |       'data': [], | ||||||
|       'equipment': [] |       'equipment': [], | ||||||
|  |       'off': [] | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     var visible_series = []; |     var visible_series = []; | ||||||
| @ -378,6 +379,19 @@ beestat.component.chart.runtime_thermostat_detail_temperature.prototype.get_opti | |||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |     if ( | ||||||
|  |       self.data_.metadata.series.off_heat_cool.durations[x.valueOf()] !== undefined && | ||||||
|  |       self.data_.metadata.series.off_heat_cool.durations[x.valueOf()].seconds > 0 | ||||||
|  |     ) { | ||||||
|  |       groups.off.push({ | ||||||
|  |         'label': beestat.series.off_heat_cool.name, | ||||||
|  |         'value': beestat.time( | ||||||
|  |           self.data_.metadata.series.off_heat_cool.durations[x.valueOf()] | ||||||
|  |         ), | ||||||
|  |         'color': beestat.series.off_heat_cool.color | ||||||
|  |       }); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     if ( |     if ( | ||||||
|       groups.mode.length === 0 && |       groups.mode.length === 0 && | ||||||
|       groups.equipment.length === 0 && |       groups.equipment.length === 0 && | ||||||
| @ -394,6 +408,10 @@ beestat.component.chart.runtime_thermostat_detail_temperature.prototype.get_opti | |||||||
|     sections.push(groups.data); |     sections.push(groups.data); | ||||||
|     sections.push(groups.equipment); |     sections.push(groups.equipment); | ||||||
| 
 | 
 | ||||||
|  |     if(beestat.user.has_early_access() === true) { | ||||||
|  |       sections.push(groups.off); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     var title = this.x.format('ddd, MMM D @ h:mma'); |     var title = this.x.format('ddd, MMM D @ h:mma'); | ||||||
| 
 | 
 | ||||||
|     return self.tooltip_formatter_helper_( |     return self.tooltip_formatter_helper_( | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user