Announcement

Collapse
No announcement yet.

count my current consumed energy

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

  • count my current consumed energy

    See my last post for my script , need some help



    is it possible to count my current consumed electricity ?
    i have a virtual that shows the current watts... i want to look the daily consume .. i have a script that writes to csv

    I use plugwise

    can anyone help me ?

    regards
    Last edited by Malosa; September 21st, 2016, 07:27 AM.
    Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
    Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




    HS3Pro 3.0.0.531 on windows 7 ultimate X64 on hp quadcore laptop 8 GB.

  • #2
    Anyone ?

    i just want to see what i consume in a day...

    i have 4 virtual devices

    1. current electricity : 631W DEVID 3330

    2. Total peak : 1,777.64kWh DEVID 3327

    3. Total Off peak : 2,223.13kWh DEVID 3326

    4. A virtal device DEVID 3329


    Total off peak counts from 21.00 - 07.00




    what script can i use for it ?
    Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
    Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




    HS3Pro 3.0.0.531 on windows 7 ultimate X64 on hp quadcore laptop 8 GB.

    Comment


    • #3
      Does nobody have a script for energy usage?
      Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
      Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




      HS3Pro 3.0.0.531 on windows 7 ultimate X64 on hp quadcore laptop 8 GB.

      Comment


      • #4
        I have edited this script :

        but it gives me this error , and i dont know what i missed in here ...

        PHP Code:
        p-21 14:38:45         Error    Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\sip_music.vbException has been thrown by the target of an invocation


        PHP Code:
        Const IniFile As String "PowerMeter.ini" 

        dim MeterDev As string hs.PluginFunction("Plugwise Pro""""GetTotalPower", {"3382"})

        dim TodayDev As String "PWR-TDY" 
        dim YesterdayDev As String "PWR-YDAY" 
        dim ThisWeekDev As String "TWD" 
        dim LastWeekDev As String "PWR-LASTWK" 

        Sub UpdateValues(Optional ByVal parms As String ""

            
        'Get current and last readings then calculate used value 
            Dim LastRead As Integer 
            Dim CurntRead As Integer 
            Dim Used As Integer 

            Try 
                LastRead = CInt(hs.GetINISetting("PowerMeter", "LastRead", "0", IniFile)) 
                CurntRead = hs.DeviceValue(MeterDev) 
                If CurntRead >= LastRead Then 
                    Used = CurntRead - LastRead 
                    hs.SaveINISetting("PowerMeter", "LastRead", CStr(CurntRead), IniFile) 
                Else 
                    hs.WriteLog("PowerMeter", "Error. Current reading is less than last reading!") 
                End If 
            Catch ex As Exception 
                hs.WriteLog("PowerMeter", "Error getting current reading " & ex.ToString) 
                Exit Sub 
            End Try 

            '
        Update devices 
            Dim NewValue 
        As Integer 
            Dim LastValue 
        As Integer 
            Dim NewString 
        As String 

            
        'For today device 
            LastValue = hs.DeviceValue(TodayDev) 
            NewValue = LastValue + Used 
            NewString = CStr(FormatNumber(NewValue / 100, 2)) & " kWh" 
            hs.SetDeviceValue(TodayDev, NewValue) 
            hs.SetDeviceString(TodayDev, NewString, True) 

            '
        For this week device 
            LastValue 
        hs.DeviceValue(ThisWeekDev
            
        NewValue LastValue Used 
            NewString 
        CStr(FormatNumber(NewValue 1002)) & " kWh" 
            
        hs.SetDeviceValue(ThisWeekDevNewValue
            
        hs.SetDeviceString(ThisWeekDevNewStringTrue

        End Sub 

        Sub ResetCounters
        (Optional ByVal Parms As String ""

            
        Dim Hr As Single Hour(Now()) 
            
        Dim Mi As Single Minute(Now()) 
            
        Dim Mt As Single Month(Now()) 
            
        Dim Dy As Single Day(Now()) 
            
        Dim WkStDay As String "2" 'Monday 

            '
        A little check to make sure this function is only run between 00:00:00 and 00:01:00 
            
        If Hr And Mi 1 Then 

                
        'Reset day counters 
                hs.SetDeviceValue(YesterdayDev, hs.DeviceValue(TodayDev)) 
                hs.SetDeviceString(YesterdayDev, hs.DeviceString(TodayDev), True) 
                hs.SetDeviceValue(TodayDev, 0) 
                hs.SetDeviceString(TodayDev, "0 kWh", True) 
                hs.WriteLog("PowerMeter", "Day counters have been reset.") 

                '
        Reset week counters 
                
        If CStr(Weekday(Now())) = WkStDay Then 
                    hs
        .SetDeviceValue(LastWeekDevhs.DeviceValue(ThisWeekDev)) 
                    
        hs.SetDeviceString(LastWeekDevhs.DeviceString(ThisWeekDev), True
                    
        hs.SetDeviceValue(ThisWeekDev0
                    
        hs.SetDeviceString(ThisWeekDev"0 kWh"True
                    
        hs.WriteLog("PowerMeter""Week counters have been reset."
                
        End If 

                If 
        Dy 1 Then 
                    
        'Put code here for month devices reset 
                    hs.WriteLog("PowerMeter", "Month counters have been reset.") 
                End If 

                If Dy = 1 And Mt = 1 Then 
                    '
        Put code here for year devices reset 
                    hs
        .WriteLog("PowerMeter""Month counters have been reset."
                
        End If 
            Else 
                
        hs.WriteLog("PowerMeter""Error. Counters can only be reset between 00:00:00 and 00:01:00"
            
        End If 

        End Sub 
        Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
        Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




        HS3Pro 3.0.0.531 on windows 7 ultimate X64 on hp quadcore laptop 8 GB.

        Comment

        Working...
        X