Skip to content

Commit c4eb545

Browse files
committed
Identify Smoke Bridge from database
1 parent 9677289 commit c4eb545

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

App.config

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@
9292
<setting name="Mail_Username" serializeAs="String">
9393
<value />
9494
</setting>
95-
<setting name="Insteon_SmokeBridgeAddr" serializeAs="String">
96-
<value />
97-
</setting>
9895
<setting name="Insteon_BackDoorSensorAddr" serializeAs="String">
9996
<value />
10097
</setting>

My Project/Settings.Designer.vb

Lines changed: 1 addition & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

My Project/Settings.settings

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@
6262
<Setting Name="Mail_Username" Type="System.String" Scope="User">
6363
<Value Profile="(Default)" />
6464
</Setting>
65-
<Setting Name="Insteon_SmokeBridgeAddr" Type="System.String" Scope="User">
66-
<Value Profile="(Default)" />
67-
</Setting>
6865
<Setting Name="Insteon_BackDoorSensorAddr" Type="System.String" Scope="User">
6966
<Value Profile="(Default)" />
7067
</Setting>

modInsteon.vb

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@
525525
strTemp = strTemp & InsteonThermostatResponse(Command1, Command2, FromAddress)
526526
ElseIf (FromAddress = My.Settings.Insteon_DoorSensorAddr OrElse FromAddress = My.Settings.Insteon_BackDoorSensorAddr) AndAlso ToAddress = "0.0.1" Then ' TODO: Detect this by device model
527527
strTemp = strTemp & InsteonDoorSensorResponse(Command1, Command2)
528-
ElseIf FromAddress = My.Settings.Insteon_SmokeBridgeAddr AndAlso Flags = 203 AndAlso x(ms + 5) = 0 AndAlso x(ms + 6) = 0 Then ' TODO: Detect this by device model
528+
ElseIf Flags = 203 AndAlso x(ms + 5) = 0 AndAlso x(ms + 6) = 0 AndAlso IsSmokeBridge(FromAddress) Then
529529
strTemp = strTemp & InsteonSmokeBridgeResponse(x(ms + 7))
530530
ElseIf FromAddress = My.Settings.Insteon_SumpAlarmAddr AndAlso Flags = 203 AndAlso x(ms + 5) = 0 AndAlso x(ms + 6) = 0 Then
531531
strTemp = strTemp & InsteonSumpAlarmResponse(Command1)
@@ -662,7 +662,7 @@
662662
strTemp = strTemp & FromName & " " & modInsteon.InsteonCommandLookup(Command1)
663663
End If
664664

665-
If FromAddress = My.Settings.Insteon_SmokeBridgeAddr Then ' TODO: Detect this by device model
665+
If IsSmokeBridge(FromAddress) Then
666666
strTemp = strTemp & " Smoke Bridge: " & InsteonSmokeBridgeResponse(Group)
667667
End If
668668
My.Application.Log.WriteEntry(strTemp, TraceEventType.Verbose)
@@ -1212,6 +1212,25 @@
12121212
Return False
12131213
End Function
12141214

1215+
''' <summary>
1216+
''' Returns true if address is for a Smoke Bridge
1217+
''' </summary>
1218+
''' <param name="strAddress">Insteon address in XX.XX.XX format</param>
1219+
''' <returns>True if in database as a smoke bridge</returns>
1220+
Function IsSmokeBridge(ByVal strAddress As String) As Boolean
1221+
Dim devcat As Integer = 0
1222+
Dim subcat As Integer = 0
1223+
1224+
modDatabase.ExecuteScalar("SELECT DevCat FROM INSTEON_DEVICES WHERE Address = '" + strAddress + "'", devcat)
1225+
modDatabase.ExecuteScalar("SELECT SubCat FROM INSTEON_DEVICES WHERE Address = '" + strAddress + "'", subcat)
1226+
1227+
If devcat = 16 AndAlso subcat = 10 Then
1228+
Return True
1229+
Else
1230+
Return False
1231+
End If
1232+
End Function
1233+
12151234
''' <summary>
12161235
''' Returns true if address is for a Water Leak Detector.
12171236
''' </summary>

0 commit comments

Comments
 (0)