|
133 | 133 | End Sub |
134 | 134 |
|
135 | 135 | Sub InsteonAlarmControl(ByVal strAddress As String, ByRef ResponseMsg As String, ByVal Command1 As String, Optional ByVal intSeconds As Integer = 0) |
136 | | - Dim comm1 As Short |
137 | | - Dim comm2 As Short |
| 136 | + Dim comm1 As Byte |
| 137 | + Dim comm2 As Byte |
138 | 138 |
|
139 | 139 | Select Case Command1 |
140 | 140 | Case "Off", "off" |
|
168 | 168 | InsteonSendStdCommand(strAddress, 13, 0) |
169 | 169 | End Sub |
170 | 170 |
|
171 | | - Sub InsteonLightControl(ByVal strAddress As String, ByRef ResponseMsg As String, ByVal Command1 As String, Optional ByVal intBrightness As Integer = 255) |
172 | | - Dim comm1 As Short |
173 | | - Dim comm2 As Short |
| 171 | + Sub InsteonLightControl(ByVal strAddress As String, ByRef ResponseMsg As String, ByVal Command1 As String, Optional ByVal intBrightness As Byte = 255) |
| 172 | + Dim comm1 As Byte |
| 173 | + Dim comm2 As Byte |
174 | 174 | Dim needExtended As Boolean = False |
175 | 175 |
|
176 | 176 | Select Case Command1 |
|
215 | 215 | End If |
216 | 216 | End Sub |
217 | 217 |
|
218 | | - Sub InsteonLinkI2CSDevice(ByVal strAddress As String, ByRef ResponseMsg As String, ByVal intLinkType As Integer) |
| 218 | + Sub InsteonLinkI2CSDevice(ByVal strAddress As String, ByRef ResponseMsg As String, ByVal intLinkType As Byte) |
219 | 219 | SyncLock serialLock |
220 | 220 | Dim data(4) As Byte |
221 | 221 |
|
|
243 | 243 | End Select |
244 | 244 | End Sub |
245 | 245 |
|
246 | | - Sub InsteonSendExtCommand(ByVal strAddress As String, ByVal comm1 As Short, ByVal comm2 As Short) |
| 246 | + Sub InsteonSendExtCommand(ByVal strAddress As String, ByVal comm1 As Byte, ByVal comm2 As Byte) |
247 | 247 | SyncLock serialLock |
248 | 248 | If My.Settings.Insteon_Enable = True Then |
249 | 249 | If SerialPLM.IsOpen = True Then |
|
275 | 275 | End SyncLock |
276 | 276 | End Sub |
277 | 277 |
|
278 | | - Sub InsteonSendStdCommand(ByVal strAddress As String, ByVal comm1 As Short, ByVal comm2 As Short) |
| 278 | + Sub InsteonSendStdCommand(ByVal strAddress As String, ByVal comm1 As Byte, ByVal comm2 As Byte) |
279 | 279 | SyncLock serialLock |
280 | 280 | If My.Settings.Insteon_Enable = True Then |
281 | 281 | If SerialPLM.IsOpen = True Then |
|
306 | 306 | End SyncLock |
307 | 307 | End Sub |
308 | 308 |
|
309 | | - Sub InsteonThermostatControl(ByVal strAddress As String, ByRef ResponseMsg As String, ByVal Command1 As String, Optional ByVal intTemperature As Integer = 72) |
310 | | - Dim comm1 As Short |
311 | | - Dim comm2 As Short |
| 309 | + Sub InsteonThermostatControl(ByVal strAddress As String, ByRef ResponseMsg As String, ByVal Command1 As String, Optional ByVal intTemperature As Byte = 72) |
| 310 | + Dim comm1 As Byte |
| 311 | + Dim comm2 As Byte |
312 | 312 |
|
313 | 313 | If strAddress = "" And My.Settings.Insteon_ThermostatAddr = "" Then |
314 | 314 | My.Application.Log.WriteEntry("No thermostat set, asking for it") |
|
327 | 327 | comm2 = 5 |
328 | 328 | Case "CoolSet", "coolset" |
329 | 329 | comm1 = 108 |
330 | | - comm2 = intTemperature * 2 |
| 330 | + comm2 = CByte(intTemperature * 2) |
331 | 331 | Case "Down", "down" |
332 | 332 | comm1 = 105 |
333 | 333 | comm2 = 2 |
|
342 | 342 | comm2 = 4 |
343 | 343 | Case "HeatSet", "heatset" |
344 | 344 | comm1 = 109 |
345 | | - comm2 = intTemperature * 2 |
| 345 | + comm2 = CByte(intTemperature * 2) |
346 | 346 | Case "Off", "off" |
347 | 347 | comm1 = 107 |
348 | 348 | comm2 = 9 |
|
405 | 405 | Dim PLMThread As New Threading.Thread(AddressOf PLM) |
406 | 406 |
|
407 | 407 | Do Until SerialPLM.BytesToRead = 0 |
408 | | - x(x_LastWrite + 1) = SerialPLM.ReadByte |
| 408 | + x(x_LastWrite + 1) = CByte(SerialPLM.ReadByte) |
409 | 409 | x(x_LastWrite + 10) = 0 |
410 | 410 | If x_LastWrite < 30 Then x(x_LastWrite + 1001) = x(x_LastWrite + 1) |
411 | 411 | ' the ends overlap so no message breaks over the limit of the array |
|
1274 | 1274 | Function X10SendCommand(ByVal strAddress As String, ByVal strCommand As String) As String |
1275 | 1275 | Dim strOutcome As String = "" |
1276 | 1276 | Dim bytCommand As Byte |
1277 | | - Dim HouseCode As Byte = Asc(strAddress.Substring(0, 1)) - 65 |
1278 | | - Dim DeviceCode As Byte = CInt(strAddress.Substring(1, strAddress.Length - 1)) |
| 1277 | + Dim HouseCode As Byte = CByte(Asc(strAddress.Substring(0, 1)) - 65) |
| 1278 | + Dim DeviceCode As Byte = CByte(strAddress.Substring(1, strAddress.Length - 1)) |
1279 | 1279 |
|
1280 | 1280 | Select Case strCommand |
1281 | 1281 | Case "bright" |
|
2040 | 2040 | ' TODO: Don't assume this info is temperature! It might not be! (But currently my code only requests it.) |
2041 | 2041 | modDatabase.Execute("INSERT INTO ENVIRONMENT (Date, Source, Location, Temperature) VALUES('" + Now.ToUniversalTime.ToString("u") & "', 'Insteon " & FromAddress & "', 'Interior', " & CStr(Int(comm2 / 2)) & ")") |
2042 | 2042 | If FromAddress = My.Settings.Insteon_ThermostatAddr Then |
2043 | | - My.Settings.Global_LastKnownInsideTemp = Int(comm2 / 2) |
| 2043 | + My.Settings.Global_LastKnownInsideTemp = CInt(Int(comm2 / 2)) |
2044 | 2044 | My.Settings.Global_TimeThermostatLastUpdated = Now() |
2045 | 2045 | ElseIf FromAddress = My.Settings.Insteon_ThermostatSlaveAddr Then |
2046 | | - My.Settings.Global_LastKnownInsideTemp2nd = Int(comm2 / 2) |
| 2046 | + My.Settings.Global_LastKnownInsideTemp2nd = CInt(Int(comm2 / 2)) |
2047 | 2047 | End If |
2048 | 2048 | ' TODO: Probably should grab these temperature warnings from the second thermostat too someday. |
2049 | 2049 | If My.Settings.Global_LastKnownInsideTemp >= My.Settings.Global_InsideTempHeatWarning Then |
|
2058 | 2058 | Case 110 |
2059 | 2059 | modDatabase.Execute("INSERT INTO ENVIRONMENT (Date, Source, Location, Temperature) VALUES('" & Now.ToUniversalTime.ToString("u") & "', 'Insteon " & FromAddress & "', 'Interior', " & CStr(Int(comm2 / 2)) & ")") |
2060 | 2060 | If FromAddress = My.Settings.Insteon_ThermostatAddr Then |
2061 | | - My.Settings.Global_LastKnownInsideTemp = Int(comm2 / 2) |
| 2061 | + My.Settings.Global_LastKnownInsideTemp = CInt(Int(comm2 / 2)) |
2062 | 2062 | My.Settings.Global_TimeThermostatLastUpdated = Now() |
2063 | 2063 | ElseIf FromAddress = My.Settings.Insteon_ThermostatSlaveAddr Then |
2064 | | - My.Settings.Global_LastKnownInsideTemp2nd = Int(comm2 / 2) |
| 2064 | + My.Settings.Global_LastKnownInsideTemp2nd = CInt(Int(comm2 / 2)) |
2065 | 2065 | End If |
2066 | 2066 | Return "Temperature: " & CStr(Int(comm2 / 2)) & " F" |
2067 | 2067 | Case 111 |
|
0 commit comments