Mechanical ventilation known to work with RFXCOM

Forum about Rfxcom home automation Domotica devices.

Moderator: b_weijenberg

Re: Mechanical ventilation known to work with RFXCOM

Postby rovinge » Tue Jan 05, 2016 8:31 am

123unlock wrote:... have a system that measures CO2 level[/img]


Bit off topic, but what do you use to measure CO2 levels? Just out of interest.
Roel
rovinge
Member
Member
 
Posts: 53
Joined: October 2011
Location: The Netherlands

Re: Mechanical ventilation known to work with RFXCOM

Postby rovinge » Fri Jan 08, 2016 7:47 pm

123unlock wrote:....using an USB-RLY08 card....


I now have done the same as 123unlock using an USB-RLY08B card to control any of the ITHO ventilation settings via Homeseer.
The USB card is connected to my HS server, relay port 1 to 4 is wired/soldered to the ITHO remote buttons Low, Medium, High and Timer; the remote itself can still be used as a manual switch.
I have created a single device in HS3 with several buttons (Low, Medium, High, Timer 30 mins) that each will call the same control VB-script passing its button value as a parameter to the script; the script then temporarily closes the actual relay called for resulting in the ventilation unit to go into the requested setting.

Below the VB.Net script I am using in HS to control the USB relay board. It is straightforward and does not do any fancy error checking (e.g. on COM-ports).
Feel free to use this 'as is', or to make it even better/fancier (but then make sure you post it back on this forum ;-)). I run another separate script that measures the humidity in the bathroom and calls for the ventilation scripts when needed.

At a later stage I have plans to install a second, separate ventilation unit dedicated to our bathroom; I then can use relay ports 5 to 8 to control the second unit.
Before I was using the ITHO remote icw. two Xanura SAX35 modules, but as one of the SAX modules died on me I had to create something new. Before I could only put the ventilation to Low and High (2 settings), now I can do all four settings.

Roel

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
rovinge
Member
Member
 
Posts: 53
Joined: October 2011
Location: The Netherlands

Mechanical ventilation known to work with RFXCOM

Postby binkiem » Tue Jan 19, 2016 8:35 pm

I think the Development of the rfxtrx868x are going slowly. ;-) or the are maybe to much of the old one's on stock. I hope the new one is getting a lan port . I think that is more practical .
binkiem
Member
Member
 
Posts: 135
Joined: January 2008
Location: Netherlands

Previous

Return to Rfxcom Receivers & Transmitters Forum

Who is online

Users browsing this forum: No registered users and 1 guest