I don’t know what the HEM defaults to (I think 120v but not certain) however you can change the ‘assumed voltage’ which the HEM uses for it’s energy calculations. This is specific to v1 as I believe the HEM v2 actually measures the line voltage directly.
When looking at the code on github, line 785 (as of this post) the following configuration value will be found:
zwave.configurationV1.configurationSet(parameterNumber: 1, size: 2, scaledConfigurationValue: 240).format(), // assumed voltage
If you change the ‘240’ to ‘120’ (or whatever your actual voltage is) then it should work correctly. However when I was on this learning adventure I do remember the HEM being cranky with it’s settings. So, be sure and validate the calculated wattage with another device to make sure the HEM is accepting the updated voltage setting.
Edit: I’ve updated the main post notating the option for 120v versus 240v.
The one I use doesn’t report each individually but it doesn’t have a hard coded 120 or 240 scaledconfig either. I wonder if your code is handling this completely differently from jscgs350’s code? I’m using just his one device handler for all my HEMv1’s with both voltages being monitored (more or less) accurately.
Can you change yours to work like his and retain both readings? I like having only one DH per device if possible, less chance of me screwing things up.
I have the one DH right now for all my devices, I would like to use this new one for one of the devices. If either DH can be made to have a settable option for one or two clamp monitoring, I’d only need one DH. That’s what I was trying to get at.
Couple questions on this DH:
-could this be used with one 120v (ex: sump pump) and one 240v (ex: dryer) device?
-could this be used to set a virtual switch indicating when given device is on? Then I could use the switch to notify when dryer is done, or to keep track of how many cycles my sump pump is running per hour.
I think I see what you mean now…
Perhaps it would just (not to suggest it would be easy, since I’m not a coder yet) be a matter of combining the code from both DHes into a single DH, and have a ‘button’ in the device to determine which set of code to use (i.e. whether the DH should act as a single or a double clamp DH).
Spent some time with the code and fixed the issues. I also set up the Line Voltage Value and Line Names as user preferences to avoid multiple handlers for more than one instances of deployment. I think I broke the Cost and kWH tiles but I’ll take a look at those tomorrow.
Thanks!! Will update and try this today. Very cool to have this so customizable from the app.
EDIT:
Updated to your new version, edited settings to set the voltage and name the clamps, but for some reason the device page isnt updated when I return to it from settings in the app. The two clamp boxes are empty (no name/no usage) and the Total box shows “Total 10 watts.”
Thinking I may have to exclude and re-add the device to clear the cobwebs out.
EDIT 2:
I excluded the HEM, then added it back to the network and immediately changed the DTH to the updated (Omyn) version. Shut down and restarted ST app, and new DH is active for the device, and I hit Reset and then configured clamp names, voltage to 120, and set reporting to 5s.
The two clamp fields still remain blank (no clamp label or energy reading), total watts shows “Total 10 watts” and doesn’t change when I turn power on/off on the monitored device (washer).
Just for kicks I changed Voltage to 240 for a bit and the watts reading doubled (10 to 20) but nothing else changed, changed back to 120 and went back to 10 watts.
Hm… not too sure yet. I bought 5 of the power monitors to monitor high usage appliances at the breaker. So far I have 2 configured physical and both are working with the updated code. I also don’t have too much experience (less than 12 hours) programming in smartthings or parsing zwave so I’m kind of winging it there too. It looks like the issue, based on the event log, is it’s not sending the L1 and L2 wattage and if it is, it’s not sending it in an expected format.
Have you let the device sit for a bit in order to catch up with itself? I found sometimes it takes some time for that to occur. Also, try sending a higher load through the wires than 10 watts combined. All of my test lines have >100W loads while testing.
A little better results in some ways, but not quite there yet.
I can see results for both clamps now, but a few weird things still:
Clamp labels don’t appear - they are there (I entered them in settings and can see them in device info in IDE) but don’t appear in the device screen in the app.
Readings are still a little funny, see screen shots. The readings don’t seem to update when things change (turned off dryer on clamp 2 about 20 minutes ago and clamp 2 still reads 506 watts (though total current reading is 5, which is accurate). Is the last clamp reading supposed to persist?
It’s odd that it works for you and the same code won’t for me. For all we know this is an issue w/my meter and not your code - maybe we should wait until someone else tries it to confirm this isn’t a “just-me” issue.
Yes that is the correct device handler name. When working correctly, the bottom row should have a reset/refresh/configure button as shown in the original post but it seems to not be working properly.
-Based on my understanding of how this code works, no. The voltage setting applies to both clamps.
-It’s certainly possible, but it would require a coder and I’m a far cry from a real coder.
Hi Omyn – Unfortunately it appears that this code is officially broken based on your and others feedback. I’m updating the original post as soon as I submit this reply.
Omyn, thank you for taking the time to modify the code. Personally I’m not a programmer and simply borrowed the original code from another author (credit and links in the OP) so you’ve done us all a favor here. Thank you!
Dana, I’ll go grab my HEMv1 and try this code and see what result I get. Just have to go find it and get it wired up. Will reply once done with what result I get using Omyn’s code.