Page 11 of 15

Re: Opentherm gateway and script integration into Homeseer

Posted: Mon Nov 04, 2013 2:07 am
by blb
Vanisher,

Yes, I'm thinking of it, but it's currently not my first priority.

Re: Opentherm gateway and script integration into Homeseer

Posted: Wed Nov 06, 2013 4:33 pm
by raymonvdm
I did not do anything with this script for al long time and accepted the issues that where there in my situation. Now i would like to fix this issues and modify my HSTouch interface so i can select degrees (per 0.5) to set the room setpoint.

I want a device that i can selecte temperatures with and a event which runs if this devices is modified to set the temperature but it is not working yet

Code: Select all

20.0	CV	Zolder	OTGW Temperature	O8	Status Only
The script to create the device looks like this

Code: Select all


Sub Main(ByVal Parms As String)
' Created by    : Rutger Bockholts
' Version       : 1.0
' Date      : 15-12-2012
' This script will create a virtual device, status only, and add the control buttons Up, Down, Set, Night, and a dropdown list with degrees.
' Usable with "BLB_OT_monitor_02.vb" script for the OpenTherm Gateway
' DeviceTherm "O7" is the device "Kamerthermostaat-Tijdelijk" which is created by the "BLB_OT_monitor_02.vb" script.
' DeviceCode "O8" is the virtual device in this script.

Dim DeviceTherm As String = "O7"
Dim DeviceCode As String = "O8"

Dim DevExists As String
Try
   DevExists = hs.DeviceExists(Devicecode) 
   If DevExists = -1 Then 
        Dim devicenew As Integer
        Dim device As Scheduler.Classes.DeviceClass
        devicenew = hs.NewDeviceRef("OTGW Temperature")
        device = hs.GetDeviceByRef(devicenew)
      device.misc = &o10
      device.can_dim = "false"
      'device.iotype = IOTYPE_CONTROL
      device.dev_type_string = "Status Only"
      device.location = "Zolder"
      device.location2 = "CV"
        device.hc = left(DeviceCode,1) 
        device.dc = Mid(DeviceCode,2)
   
      ' Create Controlbuttons: Night, Up, Down, Set
      hs.devicebuttonadd(DeviceCode, "OT_O8_Device_Control.vb(""Main"", ""Night"")", "Night")
      hs.devicebuttonadd(DeviceCode, "OT_O8_Device_Control.vb(""Main"", ""Up"")", "Up")
      hs.devicebuttonadd(DeviceCode, "OT_O8_Device_Control.vb(""Main"", ""Down"")", "Down")
      hs.devicebuttonadd(DeviceCode, "OT_O8_Device_Control.vb(""Main"", ""Set"")", "Set")
      
      ' Create Controlbutton: Dropdownlist with degrees 
      hs.DeviceValuesAdd(DeviceCode, _
         "12.0" & chr(2) & "120" & chr(1) & _
         "12.5" & chr(2) & "125" & chr(1) & _
         "13.0" & chr(2) & "130" & chr(1) & _
         "13.5" & chr(2) & "135" & chr(1) & _
         "14.0" & chr(2) & "140" & chr(1) & _
         "14.5" & chr(2) & "145" & chr(1) & _
         "15.0" & chr(2) & "150" & chr(1) & _
         "15.5" & chr(2) & "155" & chr(1) & _
         "16.0" & chr(2) & "160" & chr(1) & _
         "16.5" & chr(2) & "165" & chr(1) & _
         "17.0" & chr(2) & "170" & chr(1) & _
         "17.5" & chr(2) & "175" & chr(1) & _
         "18.0" & chr(2) & "180" & chr(1) & _
         "18.5" & chr(2) & "185" & chr(1) & _
         "19.0" & chr(2) & "190" & chr(1) & _
         "19.5" & chr(2) & "195" & chr(1) & _
         "20.0" & chr(2) & "200" & chr(1) & _
         "20.5" & chr(2) & "205" & chr(1) & _
         "21.0" & chr(2) & "210" & chr(1) & _
         "21.5" & chr(2) & "215" & chr(1) & _
         "22.0" & chr(2) & "220" & chr(1) & _
         "22.5" & chr(2) & "225" & chr(1) & _
         "23.0" & chr(2) & "230" & chr(1) & _
         "23.5" & chr(2) & "235" & chr(1) & _
         "24.0" & chr(2) & "240" & chr(1) & _
         "24.5" & chr(2) & "245" & chr(1) & _
         "25.0" & chr(2) & "250" & chr(1) & _
         "Any Value" & chr(2) & "999", true)
      hs.writelog ("Info","New device is created")
   End If
Catch ex As Exception
      hs.writelog ("Info","No new device is created")
End Try

' Action for Controlbuttons
Select Case Parms
   Case "Night"
   hs.setdevicevalue(DeviceCode, 180)
   hs.setdevicestring(DeviceCode, "Night", 180)

Case "Up"
   hs.setdevicevalue(DeviceCode, hs.devicevalue(DeviceCode) + 5)
   hs.setdevicestring(DeviceCode, hs.devicevalue(DeviceCode) + 5, True)

   
Case "Down"
   hs.setdevicevalue(DeviceCode, hs.devicevalue(DeviceCode) - 5)
   hs.setdevicestring(DeviceCode, hs.devicevalue(DeviceCode) - 5, True)

   
Case "Set"
   hs.setdevicevalue(DeviceTherm, (hs.devicevalue(DeviceCode)))

End Select


   If (hs.devicevalue(devicecode) = 160) Then
        hs.SetDeviceValue(DeviceTherm, 16)
    End If
    If (hs.devicevalue(DeviceCode) = 165) Then
        hs.SetDeviceValue(DeviceTherm, 16.5)
    End If
    If (hs.devicevalue(DeviceCode) = 170) Then
        hs.SetDeviceValue(DeviceTherm, 17)
    End If
    If (hs.devicevalue(DeviceCode) = 175) Then
        hs.SetDeviceValue(DeviceTherm, 17.5)
    End If
    If (hs.devicevalue(DeviceCode) = 180) Then
        hs.SetDeviceValue(DeviceTherm, 18)
    End If
    If (hs.devicevalue(DeviceCode) = 185) Then
        hs.SetDeviceValue(DeviceTherm, 18.5)
    End If
    If (hs.devicevalue(DeviceCode) = 190) Then
        hs.SetDeviceValue(DeviceTherm, 19)
    End If
   If (hs.devicevalue(DeviceCode) = 195) Then
        hs.SetDeviceValue(DeviceTherm, 19.5)
    End If
   If (hs.devicevalue(DeviceCode) = 200) Then
        hs.SetDeviceValue(DeviceTherm, 20)
    End If
   If (hs.devicevalue(DeviceCode) = 205) Then
        hs.SetDeviceValue(DeviceTherm, 20.5)
    End If
   If (hs.devicevalue(DeviceCode) = 210) Then
        hs.SetDeviceValue(DeviceTherm, 21)
   End If
   If (hs.devicevalue(DeviceCode) = 215) Then
        hs.SetDeviceValue(DeviceTherm, 21.5)
    End If
   If (hs.devicevalue(DeviceCode) = 220) Then
        hs.SetDeviceValue(DeviceTherm, 22)
    End If
   If (hs.devicevalue(DeviceCode) = 225) Then
        hs.SetDeviceValue(DeviceTherm, 22.5)
    End If
   If (hs.devicevalue(DeviceCode) = 230) Then
        hs.SetDeviceValue(DeviceTherm, 23)
    End If
   If (hs.devicevalue(DeviceCode) = 235) Then
        hs.SetDeviceValue(DeviceTherm, 23.5)
    End If
   If (hs.devicevalue(DeviceCode) = 240) Then
        hs.SetDeviceValue(DeviceTherm, 24)
    End If
   If (hs.devicevalue(DeviceCode) = 245) Then
        hs.SetDeviceValue(DeviceTherm, 24.5)
    End If
   If (hs.devicevalue(DeviceCode) = 250) Then
        hs.SetDeviceValue(DeviceTherm, 25)
    End If

End Sub

The event to modify the gateway (on status change but the devices does not support a status)

Code: Select all

BLB_OT_monitor_02.vb("Main","TC=$$DV:O8")

Re: Opentherm gateway and script integration into Homeseer

Posted: Wed Nov 06, 2013 4:58 pm
by Rutger
My script, already newer than you show above, worked well with the older firmware 3.4, but isn't able to run without errors yet. So I need more time to convert it to the new script. Because of lack of time, hopefully this weekend it will be ready.

Re: Opentherm gateway and script integration into Homeseer

Posted: Thu Nov 07, 2013 12:17 pm
by Rutger
The script is working fine now with my personal adjustments, only the commands are not accepted by the Gateway, even not with the OT monitor, so the fault isn't in the script. FW 4.0a10.
OT command is working fine, also in the script, but TR commandd is accepted but no changes later on.

Re: Opentherm gateway and script integration into Homeseer

Posted: Thu Nov 07, 2013 12:52 pm
by hvxl
Rutger wrote:The script is working fine now with my personal adjustments, only the commands are not accepted by the Gateway, even not with the OT monitor, so the fault isn't in the script. FW 4.0a10.
OT command is working fine, also in the script, but TR commandd is accepted but no changes later on.
The TR command was based on a misunderstanding. It has been removed in FW 4.0a6. Use the TT command.

Re: Opentherm gateway and script integration into Homeseer

Posted: Thu Nov 07, 2013 9:27 pm
by Rutger
Use the TT command.
I thought it must be something like that, but I couldn't find this morning the appropriate commands. TT is now working, thank you.

Re: Opentherm gateway and script integration into Homeseer

Posted: Sat Nov 09, 2013 11:21 pm
by raymonvdm
I`m also placing a new script for my gateway (Thanks to Rutger :D )

But what event should i create ?

I have this one for the monitor

Code: Select all


OT Gateway Monitor  
Recurring every 30 second(s)  
WHEN 
Everyday
 Last ran: Today 22:15 
 
            Run script:  BLB_OT_monitor_02.vb("Main","PS=1") 
             Run Event:  OT Gateway PR commands Delay: 00:00:03 
Then i have an HSTouch device which sets the "kamerthermostaat - tijdelijk" device. This device wil trigger a script to actually set the temperature

Code: Select all


Device Status Change

Set thermostaat  
Device CV Zolder Kamerthermostaat - tijdelijk changed to status *Any*  
WHEN 
Everyday
 Last ran: Today 22:13 
 
            Run script:  BLB_OT_monitor_02.vb("Main","TT=HSControl") 
            Run Event:  OT Gateway Monitor Delay: 00:00:03 
What is the best way to run the second event because it it not working when using "status change" it is also not possible to use "value change"

Re: Opentherm gateway and script integration into Homeseer

Posted: Sat Nov 09, 2013 11:26 pm
by Rutger
device value trigger is the correct one, see the screenshot I send you this evening.

Re: Opentherm gateway and script integration into Homeseer

Posted: Sat Nov 09, 2013 11:33 pm
by raymonvdm
I think i found the problem. The device value options are different and i just did not look good enough.

Al seems to be working for now but why are we sending TT=hscontrol and not TC=hscontrol ?

This is my "i`m almost now what i`m doing script

Code: Select all


Temperatuur Nacht  
Manual Only 
Last ran: Today 22:29 
 
            Run script:  BLB_OT_monitor_02.vb("Main","TC=15,5") 
                  Wait:  20 seconds 
            Run script:  BLB_OT_monitor_02.vb("Main","TC=15,5") 
 
Een probleem wat ik nu wel weer heb is dat de com poort soms in gebruik is waardoor het geheel niet meer werkt zonder herstart. Ik heb hier een keer iets voor aangepast in het script en dit ga ik weer proberen te vinden. Het idee was dat de compoort gewoon open bleef :roll:

Code: Select all

9-11-2013 22:43:13  - debugOTGW - SendMessage;Error opening COM4 ,error: Error: Port in use

Re: Opentherm gateway and script integration into Homeseer

Posted: Sat Nov 09, 2013 11:49 pm
by Rutger
It depends on your thermostat, what command you must use. The Celcia20 and my 'old' script, the TR=hscontrol is necessary. With the newest script for fw4.0a10+ only TT is enough.
If you have an iSense, you have to remove first the setpoint override, before you can set the new setpoint, but that was a year ago, so I'm not sure about that anymore.

Re: Opentherm gateway and script integration into Homeseer

Posted: Sat Nov 09, 2013 11:55 pm
by raymonvdm
My thermostat is an Honeywell Round OpenTherm (cheapest on MP with override setpoint support)

Re: Opentherm gateway and script integration into Homeseer

Posted: Mon Nov 11, 2013 10:44 pm
by hvxl
Rutger wrote:If you have an iSense, you have to remove first the setpoint override, before you can set the new setpoint, but that was a year ago, so I'm not sure about that anymore.
That is no longer necessary. The gateway will take care of it on its own since firmware 4.0a6.

Re: Opentherm gateway and script integration into Homeseer

Posted: Thu Nov 14, 2013 8:42 pm
by strake1
Hello,

A little question, what's wrong about these settings:

Updated to 4.0a11 form 3.4
Script 02L

Config file changed to telnet=true ip and port.
And the first command goes wrong and all values stays on 0.

The application monitor works well. But in homeseer:


13-11-2013 23:35:59 info OTWG monitor, Parameters used: PS=1
13-11-2013 23:36:02 info OTWG monitor, Parameters used: PR=All
13-11-2013 23:36:02 debugOTGW not recognized command:
13-11-2013 23:36:02 debugOTGW not recognized command:
13-11-2013 23:36:03 debugOTGW not recognized command:
13-11-2013 23:36:03 debugOTGW not recognized command:
13-11-2013 23:36:03 debugOTGW not recognized command:
13-11-2013 23:36:03 debugOTGW not recognized command:

With debug 3 :
13-11-2013 23:41:05 debugOTGW Debug Level: 3
13-11-2013 23:41:05 debugOTGW2 SendMessage;Message: PS=1
13-11-2013 23:41:05 debugOTGW3 SendMessageTelnet;Message: PS=1
13-11-2013 23:41:05 debugOTGW2 OTCommand: PR OTValue: all
13-11-2013 23:41:05 debugOTGW2 Send Openthermcommand: PR=all
13-11-2013 23:41:05 debugOTGW2 SendMessage;Message: PR=T
13-11-2013 23:41:05 debugOTGW3 SendMessageTelnet;Message: PR=T
13-11-2013 23:41:05 debugOTGW1 Reply: P
13-11-2013 23:41:05 debugOTGW not recognized command:
13-11-2013 23:41:05 debugOTGW2 Reply on PRC command: :
13-11-2013 23:41:05 debugOTGW2 SendMessage;Message: PR=M
13-11-2013 23:41:05 debugOTGW3 SendMessageTelnet;Message: PR=M
13-11-2013 23:41:06 debugOTGW1 Reply: P
13-11-2013 23:41:06 debugOTGW not recognized command:
13-11-2013 23:41:06 debugOTGW2 Reply on PRC command: :
13-11-2013 23:41:06 debugOTGW2 SendMessage;Message: PR=V
13-11-2013 23:41:06 debugOTGW3 SendMessageTelnet;Message: PR=V
13-11-2013 23:41:06 debugOTGW1 Reply: P
13-11-2013 23:41:06 debugOTGW not recognized command:
13-11-2013 23:41:06 debugOTGW2 Reply on PRC command: :
13-11-2013 23:41:06 debugOTGW2 SendMessage;Message: PR=O
13-11-2013 23:41:06 debugOTGW3 SendMessageTelnet;Message: PR=O
13-11-2013 23:41:06 debugOTGW1 Reply: P
13-11-2013 23:41:06 debugOTGW not recognized command:
13-11-2013 23:41:06 debugOTGW2 Reply on PRC command: :
13-11-2013 23:41:06 debugOTGW2 SendMessage;Message: PR=W
13-11-2013 23:41:06 debugOTGW3 SendMessageTelnet;Message: PR=W
13-11-2013 23:41:06 debugOTGW1 Reply: P
13-11-2013 23:41:06 debugOTGW not recognized command:
13-11-2013 23:41:06 debugOTGW2 Reply on PRC command: :
13-11-2013 23:41:06 debugOTGW2 SendMessage;Message: PR=L
13-11-2013 23:41:06 debugOTGW3 SendMessageTelnet;Message: PR=L
13-11-2013 23:41:07 debugOTGW1 Reply: P
13-11-2013 23:41:07 debugOTGW not recognized command:
13-11-2013 23:41:07 debugOTGW2 Reply on PRC command: :
13-11-2013 23:41:07 debugOTGW2 SendMessage;Message: PS=0
13-11-2013 23:41:07 debugOTGW3 SendMessageTelnet;Message: PS=0

Good suggestions are welcome.


Sent from my iPhone using Tapatalk

Re: Opentherm gateway and script integration into Homeseer

Posted: Mon Nov 18, 2013 10:17 pm
by raymonvdm
After sometime my script stops working and gives me the following error

Code: Select all

18-11-2013 21:13:34  OTmonitor error  communication: Value cannot be null.Parameter name: Argument Number is Nothing.
I think this issue is com-port related, but it also seems to be occurring since I use the script for TC=hscontrol

I also found this possible solution for the comport issue (by removing the open comport in the script and doing this using the startup.txt) Am I correct ?

http://www.domoticaforum.eu/viewtopic.p ... 579#p62829

Re: Opentherm gateway and script integration into Homeseer

Posted: Mon Nov 18, 2013 11:34 pm
by blb
Raymon,

Homeseer, serial port and me (or my script) are not real friends. In the beginning I did have the gateway directly connected via serial port on homeseer PC, but after a while the COM port did get blocked or so. I suspected it had to do with opening / closing com port every time the script runs, so I tried to open / close the come port only at start-up / close down of Homeseer. I have never got this operational very reliable. Since I'm using telnet connection (via telnet / serial port converter) I don't have this issues any-more.

the part I did have in the startup script when I was testing with it:

Code: Select all

	' script to start serial port 50 for OT Monitor
	Dim e
    	e=hs.OpenComPort 50,"9600,N,8,1",1,"BLB_OT_response_02.vb","Main"
    	If e <> "" Then
		hs.WriteLog "debugOT","Error opening COM" & SerialPort & " ,error: " & e
	Else
		hs.writelog "debugOT","opening COM" & Serialport & " port succesful"
	End If
the part I did have in the shutdown script when I was testing with it:

Code: Select all

  	' script to close serial port 50 for OT Monitor
	hs.CloseComPort 50
Maybe you have more knowledge and/or luck than me to get it working properly....

P.S. you can do telnet / serial conversion via software, e.g. freeware software from piracom. Serial port of the OTGW can be connected via com port on homeseer pc and the connection between homeseer and the OTGW is made via telnet. Not so elegant, but it works....