From 99facf2eee739737280b4a505fa9ec4dafcf335a Mon Sep 17 00:00:00 2001 From: Bernard Sheppard <37993507+BJReplay@users.noreply.github.com> Date: Sun, 27 Mar 2022 16:29:15 +1100 Subject: [PATCH] Release 4.8.1 - Don't always retreive consumption --- PowerwallService/My Project/AssemblyInfo.vb | 4 ++-- PowerwallService/PowerwallService.vb | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/PowerwallService/My Project/AssemblyInfo.vb b/PowerwallService/My Project/AssemblyInfo.vb index db40c6a..ea368cc 100644 --- a/PowerwallService/My Project/AssemblyInfo.vb +++ b/PowerwallService/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + + diff --git a/PowerwallService/PowerwallService.vb b/PowerwallService/PowerwallService.vb index c08416f..a7ec73a 100644 --- a/PowerwallService/PowerwallService.vb +++ b/PowerwallService/PowerwallService.vb @@ -460,8 +460,10 @@ Public Class PowerwallService Private Sub GetPeakConsumption() PeakConsumption = 0 Try - PeakConsumption = CInt(SPs.fnGetMonthlyPeakLoad(PeakStartHour:=PeakStartHour, PeakEndHour:=(OffPeakStartHour - 1))) - EventLog.WriteEntry(String.Format("Peak Consumption Set To: {0}", PeakConsumption), EventLogEntryType.Information, 803) + If My.Settings.PWPeakConsumptionUseHistory Then + PeakConsumption = CInt(SPs.fnGetMonthlyPeakLoad(PeakStartHour:=PeakStartHour, PeakEndHour:=(OffPeakStartHour - 1))) + EventLog.WriteEntry(String.Format("Peak Consumption Set To: {0}", PeakConsumption), EventLogEntryType.Information, 803) + End If Catch ex As Exception EventLog.WriteEntry(String.Format("Failed to get Peak Consumption: Exception: {0}, Stack Trace: {1}", ex.Message, ex.StackTrace), EventLogEntryType.Error, 804) End Try