Announcement

Collapse
No announcement yet.

New HomeTroller Pi headaches

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

  • NutsyHome
    replied
    Here's a .vb script that's working on my Pi unit, the lines that start with ' are commented out, either as notes or prior debugging support... Sometimes the fix is as simple as putting a quote or parenthesis in the right place...

    Code:
    Sub Main(parm as object)
    Dim ColorString as String
    Dim Color as Integer
    Dim WattsNow as Double
    'Old 47=Watts variable, 46=Amps1, 42=Amps2, 44=Watts1, 40=Watts2
    'New 56=Watts variable, 46=Amps , , 44=Watts
    
    'hs.WriteLog("Energy", "Energy.vb running")
    
    ''WattsNow = hs.deviceValue(44) + hs.DeviceValue(40)
    WattsNow = hs.deviceValue(44)
    hs.SetDeviceValueByRef(56, WattsNow, True)
    
    
    ''hs.WriteLog("Energy", "Current Power " & WattsNow & " watts. Water Heater=" & hs.CounterValue("Hot Water Minutes"))
    
    ' If WattsNow > hs.GetVar("maxamps") then
    ' hs.SaveVar("maxamps", WattsNow)
    ' hs.WriteLog("Energy", "MaxAmps updated to " & hs.GetVar("maxamps"))
    ' End if
    
    If WattsNow > 2000 then
    ColorString = "Red"
    Color = 1
    Else If WattsNow > 1000 then
    ColorString = "Yellow"
    Color = 5
    Else If WattsNow > 100 then
    ColorString = "Green"
    Color = 2
    Else
    ColorString = "Blue"
    Color = 3
    End If
    
    Dim devValue As Integer = hs.DeviceValue(41)
    
    ''hs.writelog("HSM Test", "Current: " & devValue & ", Target: " & Color & ", " & ColorString)
    
    If Color <> devValue Then
    hs.CAPIControlHandler(hs.CAPIGetSingleControl(41, false, ColorString, false, true))
    End If
    
    End Sub

    Leave a comment:


  • pete17c
    started a topic New HomeTroller Pi headaches

    New HomeTroller Pi headaches

    Just started tinkering with a HSPi and I'm getting nowhere trying to run a very basic script. I set up a virtual device and I run this script manually

    Sub Main(parms As Object)

    hs.SetDeviceValueByName("test"), ON

    End Sub

    but the 'test' device never changes state, and the log is giving me some errors
    12/11/2021 9:36:18 AM

    HomeSeer
    Error
    Compiling script test.vb: 'End Namespace' must be preceded by a matching 'Namespace'.

    12/11/2021 9:36:18 AM

    HomeSeer
    Error
    Compiling script test.vb: Identifier expected.

    12/11/2021 9:36:18 AM

    HomeSeer
    Error
    Compiling script test.vb: Identifier expected.

    12/11/2021 9:36:18 AM

    HomeSeer
    Error
    Compiling script test.vb: Expected 'End'.

    12/11/2021 9:36:18 AM

    HomeSeer
    Error
    Compiling script test.vb: Expected 'End'.

    12/11/2021 9:36:18 AM

    HomeSeer
    Error
    Compiling script test.vb: End of statement expected.

    12/11/2021 9:36:16 AM

    HomeSeer
    Event
    Running script in background (test): test.vb

    12/11/2021 9:36:16 AM

    HomeSeer
    Event
    Event Trigger "HVAC test"

    12/11/2021 9:36:16 AM

    HomeSeer
    Event
    Event HVAC test triggered by the events page 'Run' button.

    Any pointers to get me moving would be appreciated.
Working...
X