Bit off topic, but what do you use to measure CO2 levels? Just out of interest.123unlock wrote:... have a system that measures CO2 level[/img]
Roel
Moderator: b_weijenberg
Bit off topic, but what do you use to measure CO2 levels? Just out of interest.123unlock wrote:... have a system that measures CO2 level[/img]
I now have done the same as 123unlock using an USB-RLY08B card to control any of the ITHO ventilation settings via Homeseer.123unlock wrote:....using an USB-RLY08 card....
Code: Select all
' Zet Stand ITHO CVE mbv. USB Relay kaart RLY08B
Sub Main(parm as Object)
End Sub
Sub SetCVEs(ScriptParameters As Object)
hs.WriteLog("CVEs", "Script start")
Dim USB_PORT As New System.IO.Ports.SerialPort 'declares a handle for COM port called USB_I2C
Dim SerBuf(10) As Byte 'a global accessable array for data to be buffered for the COMX port
Dim Action As Double = ScriptParameters(2)
Dim ComPoort As String = "COM5"
Dim i As Integer
' hs.WriteLog("CVEs", ScriptParameters) < geeft error in scripting
USB_PORT = My.Computer.Ports.OpenSerialPort(ComPoort, 19200, 0, 8, 2)
SerBuf(0) = 90 ' Get Module ID (must return 8)
Try
USB_PORT.Write(SerBuf, 0, 1)
USB_PORT.Read(SerBuf, 0, 2)
Catch ex as Exception
USB_PORT.Close()
hs.writelog("CVEs", "Fout - Geen RLY08B gevonden (catch)")
End Try
If ((SerBuf(0) <> 8) and USB_PORT.IsOpen) Then
USB_PORT.Close()
hs.writelog("CVEs", "Fout - Geen RLY08B gevonden")
Else
hs.writelog("CVEs", "Info - RLY08B gevonden; poort is open")
Select Case Action
Case 11 ' CVE #1 Stand Laag = Relay 1 On = 101
SerBuf(0) = 101
USB_PORT.Write(SerBuf, 0, 1)
hs.WaitSecs(1)
SerBuf(0) = 111
USB_PORT.Write(SerBuf, 0, 1)
Case 12 ' CVE #1 Stand Midden = Relay 2 = etc.
SerBuf(0) = 102
USB_PORT.Write(SerBuf, 0, 1)
hs.WaitSecs(1)
SerBuf(0) = 112
USB_PORT.Write(SerBuf, 0, 1)
Case 13 ' CVE #1 Stand Hoog = Relay 3
SerBuf(0) = 103
USB_PORT.Write(SerBuf, 0, 1)
hs.WaitSecs(1)
SerBuf(0) = 113
USB_PORT.Write(SerBuf, 0, 1)
Case 110 ' CVE #1 Hoog Timer 10 minuten = 1x Relay 4 aan/uit
SerBuf(0) = 104
USB_PORT.Write(SerBuf, 0, 1)
hs.WaitSecs(1)
SerBuf(0) = 114
USB_PORT.Write(SerBuf, 0, 1)
Case 120 ' CVE #1 Hoog Timer 20 minuten = 2x Relay 4 aan/uit achterelkaar
For i = 1 to 2
SerBuf(0) = 104
USB_PORT.Write(SerBuf, 0, 1)
hs.WaitSecs(1)
SerBuf(0) = 114
USB_PORT.Write(SerBuf, 0, 1)
Next
Case 130 ' CVE #1 Hoog Timer 30 minuten = 3x Relay 4 aan/uit achterelkaar
For i = 1 to 3
SerBuf(0) = 104
USB_PORT.Write(SerBuf, 0, 1)
hs.WaitSecs(1)
SerBuf(0) = 114
USB_PORT.Write(SerBuf, 0, 1)
Next
End Select
End If
' Afsluiten; extra check of alle relay poorten uit staan - anders loopt batterij AB leeg
hs.WaitSecs(1)
SerBuf(0) = 110 ' = All Relays off
USB_PORT.Write(SerBuf, 0, 1)
hs.WaitSecs(1)
USB_PORT.Close()
hs.writelog("CVEs", "Info - Actioned: " & Action)
' USB_PORT = Nothing
' SerBuf() = Nothing
Action = Nothing
ComPoort = Nothing
i = Nothing
End Sub