Skip to content

Commit

Permalink
Track last time thermostat data updated
Browse files Browse the repository at this point in the history
Good for knowing if the status report data we're sending is actually current.
  • Loading branch information
ocdtrekkie committed Aug 28, 2018
1 parent 8aa10a0 commit 749aedc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@
<setting name="Global_LoadModulesAsync" serializeAs="String">
<value>True</value>
</setting>
<setting name="Global_TimeThermostatLastUpdated" serializeAs="String">
<value />
</setting>
</HAController.My.MySettings>
</userSettings>
<entityFramework>
Expand Down
11 changes: 11 additions & 0 deletions My Project/Settings.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions My Project/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,8 @@
<Setting Name="Global_LoadModulesAsync" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="Global_TimeThermostatLastUpdated" Type="System.DateTime" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
4 changes: 2 additions & 2 deletions modGlobal.vb
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ Public Module modGlobal
End Function

Function SendStatusReport() As String
Dim strStatusReport As String = "The current time is " & Now() & vbCrLf & vbCrLf & "Home monitoring status is set to " & modGlobal.HomeStatus & "." & vbCrLf & vbCrLf & "The current inside temperature is " & My.Settings.Global_LastKnownInsideTemp & " F."
Dim strStatusReport As String = "The current time is " & Now() & vbCrLf & vbCrLf & "Home monitoring status is set to " & modGlobal.HomeStatus & "." & vbCrLf & vbCrLf & "The inside temperature read " & My.Settings.Global_LastKnownInsideTemp & " F at " & My.Settings.Global_TimeThermostatLastUpdated.ToShortTimeString & " on " & My.Settings.Global_TimeThermostatLastUpdated.ToShortDateString & "."
If My.Settings.Insteon_ThermostatSlaveAddr <> "" Then
strStatusReport = strStatusReport & " (Second reading: " & My.Settings.Global_LastKnownInsideTemp2nd & " F)"
End If
If My.Settings.Global_TimeDoorLastOpened <> "" Then
If My.Settings.Global_TimeDoorLastOpened > DateTime.MinValue Then
strStatusReport = strStatusReport & vbCrLf & vbCrLf & "The door was last opened at " & My.Settings.Global_TimeDoorLastOpened.ToShortTimeString & " on " & My.Settings.Global_TimeDoorLastOpened.ToShortDateString
End If
If My.Settings.Pihole_Enable = True Then
Expand Down
2 changes: 2 additions & 0 deletions modInsteon.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1834,6 +1834,7 @@
modDatabase.Execute("INSERT INTO ENVIRONMENT (Date, Source, Location, Temperature) VALUES('" + Now.ToUniversalTime.ToString("u") & "', 'Insteon " & FromAddress & "', 'Interior', " & CStr(Int(comm2 / 2)) & ")")
If FromAddress = My.Settings.Insteon_ThermostatAddr Then
My.Settings.Global_LastKnownInsideTemp = Int(comm2 / 2)
My.Settings.Global_TimeThermostatLastUpdated = Now()
ElseIf FromAddress = My.Settings.Insteon_ThermostatSlaveAddr Then
My.Settings.Global_LastKnownInsideTemp2nd = Int(comm2 / 2)
End If
Expand All @@ -1851,6 +1852,7 @@
modDatabase.Execute("INSERT INTO ENVIRONMENT (Date, Source, Location, Temperature) VALUES('" & Now.ToUniversalTime.ToString("u") & "', 'Insteon " & FromAddress & "', 'Interior', " & CStr(Int(comm2 / 2)) & ")")
If FromAddress = My.Settings.Insteon_ThermostatAddr Then
My.Settings.Global_LastKnownInsideTemp = Int(comm2 / 2)
My.Settings.Global_TimeThermostatLastUpdated = Now()
ElseIf FromAddress = My.Settings.Insteon_ThermostatSlaveAddr Then
My.Settings.Global_LastKnownInsideTemp2nd = Int(comm2 / 2)
End If
Expand Down

0 comments on commit 749aedc

Please sign in to comment.