Announcement

Collapse
No announcement yet.

Read current setpoint to a device

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Read current setpoint to a device

    I'm using the trane z-wave tstats and they are working fine with the plug in and all. I have a large house with hydronic floor heating in multiple zones (9 zones and 9 tstats). In this type of system there is a signifcant delay from the time the thermostat calls for heat (ie, set point > current temp), and once the set point is reached and the tstat stops calling for heat, there is still a lot of thermal energy in the hydronic system that continues to radiate heat in the room and push the temperature above the set point. I'm using mcsTemp to chart the temperature in each room by reading the thermostat which has a device which shows the current temperature, and from other 1wire and HSM multisensors.

    I would also like to chart the current tstat set point with the temperature reading, but there is no device where I can read that from (and in to mcsTemp).

    I'd like some help in writing a script that would read the set point and store it in a device at a regular interval, but I am clueless when it comes to writing scitps...

    the next step would also be to get a notification if someone changes the set point at the tstat itself (do deviate from the set schedule).

    thanks,

  • #2
    You and I must be working on the same problem.

    Save this code with a .vb extension and run it. It will created a device named "My Heat Setpoint" with a HCDC of "T1" -- if you already have devices in the "T" House code change it to some unused house code before you run it.

    The heat setting of your first thermostat will be stored in T1's value. You should be able to loop around all your thermostats to create devices to hold whatever values you want -- cool set, current temp, etc.

    I am working on a database solution to this problem -- storing various setpoints, temp readings, modes, etc. -- because storing values in devices is only a small scale solution and won't save a time series for me. I am looking at .ini's, .csv's and, .mdb's as a database storage solution. The .ini can be implemented in HS, but the other two get me deeper into vb.net...where all my free time will soon be consumed.


    Code:
     
    'globals
    Dim myDevName As String = "My Heat Set Point" 'creates this device, if it is not found
    Dim myHC As String = "T"             'using this house code
    Dim myDC As String = "1"             'and this device code
    Dim myLog As String = "my log entry"   'identifier for HS log entry
     
    Sub Main(ByVal parms As Object)
        Dim HCDC As String
        Dim dvRef As Integer
        Dim dv As Scheduler.Classes.DeviceClass
        Dim oTPI As Scheduler.HSPI_ZWAVETHERM.HSPI
        Dim i As Integer
     
        HCDC = myHC & myDC
     
        'set up virtual device 
        dvRef = HS.GetDeviceRefByName(myDevName)
        If dvRef = -1 Then     'device does not exist
          dvRef = HS.NewDeviceRef(myDevName)
          dv = HS.GetDeviceByRef(dvRef)
          dv.hc = myHC 'Does not check to see if device already exists with this HCDC combo.
          dv.dc = myDC 'Homeeseer will create two or more devices with same HCDC so pick wisely...
          dv.dev_type_string = "Virtual"
        Else
          dv = HS.GetDeviceByRef(dvRef)
        End If
     
     
        'get heat set point and write to device value
        oTPI = HS.Plugin("ZWave Thermostats")
        If oTPI Is Nothing Then
          HS.WriteLog(myLog, "Plugin not found -- Aborting Sub.")
          Exit Sub
        End If
        i = 1 'you can loop around i for each of the thermostats
        Try
          HS.SetDeviceValue(HCDC, CInt(oTPI.GetHeatSet(i, 1)))
          HS.SaveEventsDevices()
          'now make sure it works
          HS.WriteLog(myLog, "The value stored in the device is: " & HS.DeviceValue(HCDC).ToString)
        Catch ex As Exception
          HS.WriteLog(myLog, "Something went wrong in setting or retrieving the device value")
        End Try
     
    End Sub

    Comment

    Working...
    X