From 9a6bf78c80a549453e682e3bfce34a2fc58d150e Mon Sep 17 00:00:00 2001 From: Lars Saalbach Date: Tue, 24 Sep 2024 21:57:26 +0200 Subject: [PATCH] #632 - First support of visualizer import --- .../brew-brewing-graph.component.ts | 54 ++++++++++++------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/src/components/brews/brew-brewing-graph/brew-brewing-graph.component.ts b/src/components/brews/brew-brewing-graph/brew-brewing-graph.component.ts index 680ade71..ef18406f 100644 --- a/src/components/brews/brew-brewing-graph/brew-brewing-graph.component.ts +++ b/src/components/brews/brew-brewing-graph/brew-brewing-graph.component.ts @@ -664,30 +664,48 @@ export class BrewBrewingGraphComponent implements OnInit { presetFlowProfile.pressureFlow && presetFlowProfile.pressureFlow.length > 0 ) { - this.chartData.push(this.pressureTraceReference); - for (const data of presetFlowProfile.pressureFlow) { - this.pressureTraceReference.x.push( - new Date( - moment(data.timestamp, 'HH:mm:ss.SSS').toDate().getTime() - - delay - ) - ); - this.pressureTraceReference.y.push(data.actual_pressure); + const pressureDevice = this.bleManager.getPressureDevice(); + if ( + (pressureDevice != null && + this.getPreparation().style_type === + PREPARATION_STYLE_TYPE.ESPRESSO) || + this.brewComponent?.brewBrewingPreparationDeviceEl?.preparationDeviceConnected() || + !this.platform.is('cordova') + ) { + /** We just push the data, if we also got an pressure device connected**/ + this.chartData.push(this.pressureTraceReference); + for (const data of presetFlowProfile.pressureFlow) { + this.pressureTraceReference.x.push( + new Date( + moment(data.timestamp, 'HH:mm:ss.SSS').toDate().getTime() - + delay + ) + ); + this.pressureTraceReference.y.push(data.actual_pressure); + } } } if ( presetFlowProfile.temperatureFlow && presetFlowProfile.temperatureFlow.length > 0 ) { - this.chartData.push(this.temperatureTraceReference); - for (const data of presetFlowProfile.temperatureFlow) { - this.temperatureTraceReference.x.push( - new Date( - moment(data.timestamp, 'HH:mm:ss.SSS').toDate().getTime() - - delay - ) - ); - this.temperatureTraceReference.y.push(data.actual_temperature); + const temperatureDevice = this.bleManager.getTemperatureDevice(); + if ( + temperatureDevice != null || + this.brewComponent?.brewBrewingPreparationDeviceEl?.preparationDeviceConnected() || + !this.platform.is('cordova') + ) { + /** We just push the data, if we also got an temperature device connected**/ + this.chartData.push(this.temperatureTraceReference); + for (const data of presetFlowProfile.temperatureFlow) { + this.temperatureTraceReference.x.push( + new Date( + moment(data.timestamp, 'HH:mm:ss.SSS').toDate().getTime() - + delay + ) + ); + this.temperatureTraceReference.y.push(data.actual_temperature); + } } } }