@sahamilton9864 (Sahamilton9864) posted a new topic, subject "Sengled Plug Accumulated Energy Usage Help". It read:

   The Sengled Smart Plug (Model: E1c-NB7) says it reports both Average power usage, as well as cumulative power consumption. I'm trying to get this to show the cumulative usage, but the Generic Zigbee Outlet only provinces the average.
    
    Is there a different driver or app (Custom or otherwise) that would allow me to see the total usage?
    
    Ultimately what i'm trying to do is keep tabs on the Kwh usage of my PC over a months period. I got these devices because they said they were energy monitors (which... technically they are doing i suppose)

Then @ha_migrant said

    I have this exact plug too and assumed it can't do cumulative. However upon seeing your message I looked in the user manual and I see it does indeed mention "average power and cumulative power consumption". Which is odd because I have seen neither of those, only current power usage. I'm using "Generic Zigbee Outlet" and don't see anything else that might offer other functionality.

Then @dylan.c (Dylan C) said

    Worst case you could write a rule. I don't think it would be the most efficient, but it would work....
    
    First create a global variable to store the total power... let's call it varKWH. You'll also want **some** local variables in the rule since Rule Machine can only perform one math operation at a time. We'll call these **watts,** var1 and var2.
    
    Trigger: Periodic... slower would be better but have to be fast enough to catch any changes in power use. For this example I'll use 5 minutes.
    
    Rule:  
    **0\. Set watts = sensor value**
    
      1. Variable math... var1 = **watts** ÷ 1000 (convert watts to kilowatts)
      2. More math... var2 = var1 x 0.0833 (note that 5 minutes equals 0.0833 hours)
      3. And even more math... varKWH = varKWH + var2
    
    
    
    And if you want you could add another step to calculate cost...

So @sahamilton9864 (Sahamilton9864) replied

    I appreciate your suggestion. My only concern with this option is that the power fluctuates. Unless i'm misunderstanding the rule you created, it would take the momentary wattage and multiply it from 5min, to assume the accumulated power over the entire hour.

Then @dylan.c (Dylan C) said

    Yes... sort of. It "assumes" that the power is constant over that 5 minute interval, but it takes 12 readings per hour.
    
    So if your load is 1000 watts (1 kilowatt), it will calculate as follows each time it runs.
    
    1000 ÷ 1000 x 0.0833 = 0.0833 kWh
    
    Over 12 intervals (1 hour) the value of the global variable would be 0.9996 kWh. As you can see the is a slight rounding error.
    
    The faster the load changes, the less accurate this method gets, requiring more frequent triggering and increasing demand on the hub. How frequent can you sample/trigger before that is a problem? Your guess is as good as mine.
    
    Also note that I had to add another step and local variable in my rule noted above. Rule Machine needs the sensor value assigned to a variable before it can do math with it.

After which, @sahamilton9864 (Sahamilton9864) added

    The only issue i'm having now is the rule doesn't update on it's own. If i tell it to run, it will do as advertised. but if i just let it sit, nothing happens after 5 minutes.

To which @sahamilton9864 (Sahamilton9864) replied

    nvm... i'm an idiot. I set it to run every hour at ":05" instead of every 5 minutes.

To which @waynespringer79 (Waynespringer79) replied

    Fibaro Wall Plugs is what I use, it handles this quite well. FYI, they are cheaper via the smartest house EBAY page instead of their website.
    
    fibaro wall plug1442×449 23.6 KB
    
    Having many of these throughout the house allows me to in real time see my current wattage usage and monthly energy accumulation.  
    
    
    energy chart1815×948 103 KB

After which, @dylan.c (Dylan C) added

    sahamilton9864:
    
    > I set it to run every hour at ":05" instead of every 5 minutes
    
    I did the same thing the first time I used Periodic triggers also...

To which @bobbyD (Hubitat Support) replied

    


{'source': 'discourse', 'url': 'https://community.hubitat.com/t/sengled-plug-accumulated-energy-usage-help/72591', 'title': 'Sengled Plug Accumulated Energy Usage Help', 'views': 505, 'has_accepted_answer': False, 'word_count': 655, 'like_count': 0, 'reply_count': 5, 'participant_count': 4, 'posts': 10, 'tags': '', 'author': '@sahamilton9864 (Sahamilton9864)', 'participants': '@sahamilton9864 (Sahamilton9864), @ha_migrant, @dylan.c (Dylan C), @waynespringer79 (Waynespringer79), @bobbyD (Hubitat Support)', 'image_url': [None], 'created_at': '2021-05-13T23:53:24.019Z', 'last_posted_at': '2022-09-17T12:28:37.974Z'}