Announcement

Collapse
No announcement yet.

Has anybody had sucess with the hs energy functions

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

    Has anybody had sucess with the hs energy functions



    This procedure is used to set the type of energy consumption or energy producing device for the reference ID dvRef in the energy database. This procedure is also used to create an initial energy object in the system if one does not exist. The energy object's device name, location, and location2 properties will also be updated whenever this procedure is called.


    Public Function Energy_SetEnergyDevice(ByVal dvRef As Integer, _
    ByVal DeviceType As enumEnergyDevice) As Boolean


    I can't get the following to return true using an existing device or a ne devref what am I doing wrong? any help would be gratefully received.


    Sub Main(ByVal Parms As Object)

    Dim a as boolean
    a = hs.Energy_SetEnergyDevice(147,62)
    hs.writelog ("Power Now", a) 'write power
    End Sub

    #2
    I'm also trying to add my devices to HS Energy charts, but the charts device list doesn't show my devices.

    What do I have to do? So far I what I do:
    1. Set device API to DeviceTypeInfo.eDeviceAPI.Energy
    2. Set device type to eDeviceType_Energy.Watts
    3. Call Energy_SetEnergyDevice()

    What am I missing?

    Click image for larger version

Name:	HsEnergy.png
Views:	232
Size:	251.7 KB
ID:	1341202

    Comment


      #3
      Sorry I gave up I did manage to create some Thing that registered in the data base and recall the data but I could never get the energy calculator functions to work properly. Iโ€™m away right now but will post what I did b4 I gave up!

      Comment


        #4
        rjh any advice?

        Comment


          #5
          Only thing I can remember is that the meter disappeared on restart and you create it again Iโ€™ll look at the code when I get back. I never succeed in registering a device that graphs power but clearly some plugins do mainly the zwave one. Rfxcom creates a power objects but these are not recognised by hs. Sorry I canโ€™t be of more help !

          Comment


            #6
            rjh - can you please provide an example of what I need to do to see my devices in HS Energy monitor?

            Comment


              #7
              I am interested as well.
              I have 2 devices that are registering. One that is not showing up. > This is on the Energy tab on Web interface.

              Whats interesting to me, Is on the default, generic OLD HSTouch Android App, all three will show up on the Energy tabs on my mobile devices.

              Probably somethign simple I am missing, but I can NOT figure out what it is.

              Comment


                #8
                Energy accumulates the KWH as reported by the device so for the device to appear on the Energy page you need to set the device type to:

                Energy API, Type: KWH

                You need to report your KWH data with a call to hs.Energy_AddData.

                Here is the code in the Z-Wave plugin that adds KWH data:

                Code:
                Dim ED As New EnergyData(IIf(RateType = ZW_METER_RATES.EXPORT_PRODUCED, enumEnergyDirection.Produced, enumEnergyDirection.Consumed))
                                        Try
                
                                            ' only log energy consumed
                                            ' Prev_Value holds the previous reading which is the total energy used so far
                                            ' 
                                            'LogWarning("DEBUG Energy: Amt=" & V.ToString & ", Amt Pre=" & Prev_Value.ToString & ", Delta=" & Delta.ToString & ", Rate=" & dvChild.ZWData.Meter_Energy_Rate.ToString & ", RateType(Direction)=" & RateType.ToString & " For " & DeviceName(dvChild))
                                            'W = 1000 ร— kWh / h
                                            'Dim h As Double
                                            'Try
                                            '    h = Delta / 3600
                                            'Catch ex As Exception
                                            '    h = 0
                                            'End Try
                                            'Try
                                            '    ED.Amount = (1000 * V) / h
                                            'Catch ex As Exception
                                            '    ED.Amount = 0
                                            'End Try
                
                                            ' device gives us the kwh used for the Delta period
                
                                            ED.Amount = V - Prev_Value
                                            ED.Amount_End = DateTime.Now
                                            If ED.Amount > 20 Then
                                                ' assunme bad data ignore
                                            ElseIf ED.Amount < 0 AndAlso Math.Abs(ED.Amount) > 20 Then
                                                ' bad negative amount
                                            Else
                                                ED.Amount_Start = DateTime.Now.Subtract(New TimeSpan(0, 0, Delta))
                                                ED.dvRef = dvChild.dvRef
                                                ED.Rate = IIf(dvChild.ZWData.Meter_Energy_Rate = 0, 0, dvChild.ZWData.Meter_Energy_Rate)    ' set rate to 0 if not set and the rate will be set to the HS settings rate
                                                If Not hs.Energy_AddData(dvChild.dvRef, ED) Then
                                                    Devices_70_DoEnergyDevice(dvChild)
                                                    If Not hs.Energy_AddData(dvChild.dvRef, ED) Then
                                                        LogWarning("Failed to add energy data received for " & DeviceName(dvChild) & " to HomeSeer.")
                                                    End If
                                                End If
                                            End If
                
                
                                        Catch ex As Exception
                                            LogError("Exception adding energy data received for " & DeviceName(dvChild) & " to HomeSeer.")
                                        End Try

                Originally posted by alexbk66 View Post
                rjh - can you please provide an example of what I need to do to see my devices in HS Energy monitor?
                ๐Ÿ’‍โ™‚๏ธ Support & Customer Service ๐Ÿ™‹‍โ™‚๏ธ Sales Questions ๐Ÿ›’ Shop HomeSeer Products

                Comment


                  #9
                  Thanks rjh I'll give it a try. I didn't realise I have to add data myself, but makes sense.

                  Comment

                  Working...
                  X