ui Value refactor

This commit is contained in:
Patrick Haßel 2024-10-21 09:41:49 +02:00
parent c3fc3ca3ca
commit 3fd4da3797

View File

@ -70,37 +70,37 @@ export class SeriesService {
}
private seriesUpdate(series: Series) {
this.gridPurchased = this.seriesUpdate2(series, this.gridPurchased, 'electricity.grid.purchase.energy');
this.gridDelivered = this.seriesUpdate2(series, this.gridDelivered, 'electricity.grid.delivery.energy');
this.gridPower = this.seriesUpdate2(series, this.gridPower, 'electricity.grid.power');
this.gridPurchased = this.returnSeriesIfName(series, this.gridPurchased, 'electricity.grid.purchase.energy');
this.gridDelivered = this.returnSeriesIfName(series, this.gridDelivered, 'electricity.grid.delivery.energy');
this.gridPower = this.returnSeriesIfName(series, this.gridPower, 'electricity.grid.power');
this.photovoltaicProduced = this.seriesUpdate2(series, this.photovoltaicProduced, 'electricity.photovoltaic.energy');
this.photovoltaicPower = this.seriesUpdate2(series, this.photovoltaicPower, 'electricity.photovoltaic.power');
this.photovoltaicProduced = this.returnSeriesIfName(series, this.photovoltaicProduced, 'electricity.photovoltaic.energy');
this.photovoltaicPower = this.returnSeriesIfName(series, this.photovoltaicPower, 'electricity.photovoltaic.power');
this.schlafzimmerTemperature = this.seriesUpdate2(series, this.schlafzimmerTemperature, 'schlafzimmer.temperature');
this.schlafzimmerHumidityRelative = this.seriesUpdate2(series, this.schlafzimmerHumidityRelative, 'schlafzimmer.humidity_relative');
this.schlafzimmerHumidityAbsolute = this.seriesUpdate2(series, this.schlafzimmerHumidityAbsolute, 'schlafzimmer.humidity_absolute');
this.schlafzimmerTemperature = this.returnSeriesIfName(series, this.schlafzimmerTemperature, 'schlafzimmer.temperature');
this.schlafzimmerHumidityRelative = this.returnSeriesIfName(series, this.schlafzimmerHumidityRelative, 'schlafzimmer.humidity_relative');
this.schlafzimmerHumidityAbsolute = this.returnSeriesIfName(series, this.schlafzimmerHumidityAbsolute, 'schlafzimmer.humidity_absolute');
this.outdoorTemperature = this.seriesUpdate2(series, this.outdoorTemperature, 'garten.temperature');
this.outdoorHumidityRelative = this.seriesUpdate2(series, this.outdoorHumidityRelative, 'garten.humidity_relative');
this.outdoorHumidityAbsolute = this.seriesUpdate2(series, this.outdoorHumidityAbsolute, 'garten.humidity_absolute');
this.outdoorTemperature = this.returnSeriesIfName(series, this.outdoorTemperature, 'garten.temperature');
this.outdoorHumidityRelative = this.returnSeriesIfName(series, this.outdoorHumidityRelative, 'garten.humidity_relative');
this.outdoorHumidityAbsolute = this.returnSeriesIfName(series, this.outdoorHumidityAbsolute, 'garten.humidity_absolute');
this.heatingRoomTemperature = this.seriesUpdate2(series, this.heatingRoomTemperature, 'heating.room.temperature');
this.heatingRoomHumidityRelative = this.seriesUpdate2(series, this.heatingRoomHumidityRelative, 'heating.room.humidity_relative');
this.heatingRoomHumidityAbsolute = this.seriesUpdate2(series, this.heatingRoomHumidityAbsolute, 'heating.room.humidity_absolute');
this.heatingRoomTemperature = this.returnSeriesIfName(series, this.heatingRoomTemperature, 'heating.room.temperature');
this.heatingRoomHumidityRelative = this.returnSeriesIfName(series, this.heatingRoomHumidityRelative, 'heating.room.humidity_relative');
this.heatingRoomHumidityAbsolute = this.returnSeriesIfName(series, this.heatingRoomHumidityAbsolute, 'heating.room.humidity_absolute');
this.heatingExhaustTemperature = this.seriesUpdate2(series, this.heatingExhaustTemperature, 'heating.exhaust.temperature');
this.heatingBufferSupplyTemperature = this.seriesUpdate2(series, this.heatingBufferSupplyTemperature, 'heating.buffer.supply.temperature');
this.heatingBufferReturnTemperature = this.seriesUpdate2(series, this.heatingBufferReturnTemperature, 'heating.buffer.return.temperature');
this.heatingBufferColdTemperature = this.seriesUpdate2(series, this.heatingBufferColdTemperature, 'heating.buffer.cold.temperature');
this.heatingBufferInnerTemperature = this.seriesUpdate2(series, this.heatingBufferInnerTemperature, 'heating.buffer.inner.temperature');
this.heatingBufferHotTemperature = this.seriesUpdate2(series, this.heatingBufferHotTemperature, 'heating.buffer.hot.temperature');
this.heatingBufferCirculationTemperature = this.seriesUpdate2(series, this.heatingBufferCirculationTemperature, 'heating.buffer.circulation.temperature');
this.heatingLoopSupplyTemperature = this.seriesUpdate2(series, this.heatingLoopSupplyTemperature, 'heating.loop.supply.temperature');
this.heatingLoopReturnTemperature = this.seriesUpdate2(series, this.heatingLoopReturnTemperature, 'heating.loop.return.temperature');
this.heatingExhaustTemperature = this.returnSeriesIfName(series, this.heatingExhaustTemperature, 'heating.exhaust.temperature');
this.heatingBufferSupplyTemperature = this.returnSeriesIfName(series, this.heatingBufferSupplyTemperature, 'heating.buffer.supply.temperature');
this.heatingBufferReturnTemperature = this.returnSeriesIfName(series, this.heatingBufferReturnTemperature, 'heating.buffer.return.temperature');
this.heatingBufferColdTemperature = this.returnSeriesIfName(series, this.heatingBufferColdTemperature, 'heating.buffer.cold.temperature');
this.heatingBufferInnerTemperature = this.returnSeriesIfName(series, this.heatingBufferInnerTemperature, 'heating.buffer.inner.temperature');
this.heatingBufferHotTemperature = this.returnSeriesIfName(series, this.heatingBufferHotTemperature, 'heating.buffer.hot.temperature');
this.heatingBufferCirculationTemperature = this.returnSeriesIfName(series, this.heatingBufferCirculationTemperature, 'heating.buffer.circulation.temperature');
this.heatingLoopSupplyTemperature = this.returnSeriesIfName(series, this.heatingLoopSupplyTemperature, 'heating.loop.supply.temperature');
this.heatingLoopReturnTemperature = this.returnSeriesIfName(series, this.heatingLoopReturnTemperature, 'heating.loop.return.temperature');
}
private seriesUpdate2(fresh: Series, old: Series, name: string): Series {
private returnSeriesIfName(fresh: Series, old: Series, name: string): Series {
if (fresh.name !== name) {
return old;
}