Implementing Notification on Power Meter with multiple clamps

You need to select an attribute....

I don't have one of these but know a few people here do, so they might be able to say more. Otherwise, what attributes are you looking for? These are the names under "Current States." Unless your driver uses "child devices" (one device per clamp, in which case you probably wouldn't have this issue in the first place), I assume it might use custom attributes for each side. Notifications only works with stock attributes (like power), but Rule Machine can be made to work with any attribute, stock or custom. I can help more if I know how the device actually reports (the above information) if no one else chimes in.

So like this (Pick which ever attribute)

Really easy. Two different drivers you can use for the v1 HEM (I have three of them and use two of them exactly like you do).

This driver originally written by @mike.maxwell and later modified by @ogiewon works by pressing a button when the wattage drops below a defined value. However, you can also use Rule Machine to monitor the state of the device. Also really easy to modify this driver and adjust things like the device name as it shows up, the polling time, and I also modified it to press a button when an appliance starts too (but I don't really use that function anymore).

And this driver ported by @jrfarrar also works and gives separate, plus combined clamp readings. I use this one for whole home energy monitoring on one of my Aeon v1 HEMs, but I have also used it with Rule Machine and the other two HEMs to get the watt readings from individual clamps for use in Rule Machine rules.

Wish they'd update the one for HEM v5 :face_with_hand_over_mouth:

This driver doesn't work?

or this one? I saw your reply on the thread to add it to HPM, but I didn't see you mention it not working unless I missed something.

I'm using codahq's right now. Both seem error prone but work fine for what I use it for (washer and dryer) And my otherone monitors whole house, and 3rd monitor water heaters (I have dual tanks)

Yeah, the drivers for v1 also generated errors, but I just ignored them and set that hub to reboot every week. :rofl:

1 Like

I am using a driver that is the same or similar to the one that SmartHomePrimer noted in his post above. The driver created several variables associated with the meter: energyOne, energyTwo which are the KWH for each clamp. It also created powerOne and powerTwo which are the current watts for each clamp. I am looking to create a notification for powerOne that monitors the Hottub. However, I cannot access these variables from the Rule Machine or the Notifications App. Is there a way to access these variables to make them available to the Apps?

Do they show up under custom attribute in rule machine?

Where do I find custom attribute in rule machine?

It's a capability.

1 Like

Now I found it. Thanks for that information. I see the custom power value is defined as a string so the comparison does not let me do a less than comparison. I will need to make some changes to allow for that.

If you're using it as a trigger as shown in my example above, you should certainly be able to use > as part of the compared attribute.

So this is interesting: If I chose Capability and select attribute 'power' I have comparison selection of =,!=,<,>....etc.

However if I chose custom capability for the same attribute 'power' I have comparison selection of =,!=, contains, changed, is empty. No < or > then comparison. So my previous post of thinking I had to have a integer and not a string does not seem to be the solution. Is this some limitation of the custom attribute comparison for some reason?

Not sure.. When I did custom I just manually inserted the >50 as the comparative number

What is the actual driver you are using? A link to the code would be helpful. My guess is that the author did not declare the type of these custom attributes as number, so you don't get numeric comparison options in Rule Machine. This could be worked around in the actions, but it would be better to address this at the driver level.

bertabcd1234, I believe you are correct and the Capability trigger section must either assume or convert the string variable where the Custom capability does not. I am using the code that SmartHomePrimer linked in his post above, I compared the code and it is the same:
(https://raw.githubusercontent.com/jrfarrar/hubitat/master/devicehandlers/Aeon/HEM%20v1/HEMv1%20Individual%20Clamp.groovy)

All of the attributes are defined as strings so I will have to play around with the code to change that if that is what is needed.

I did test rlithgow1's suggestion of just entering >50 in the comparative number but that does not evaluate correctly either.

Yeah, RM assumes the type for stock attributes but relies on the driver (or standard capability definition--you can use "custom" attribute for anything, including stock attributes) for the custom attribute selection. I can't imagine why anyone would want power (watts) as a string, but it looks like that author made very sure it was delivered as such. It would probably just be a few lines of code to change--both the attribute definition and the lines surrounding the powerOne and powerTwo calculations/conversions in the zwaveEvent(hubitat.zwave.commands.multichannelv3.MultiChannelCmdEncap cmd) method.

To work as- is, you'd have to trigger on (any) change, then use use RM actions to save the value to a numeric value by way of string conversion (this is an option for numeric variables in RM). You can then do the comparisons based on that variable in your actions. Not as elegant, but not impossible.

So I did define a new attribute as a number, p1num... testing. I have modified the code in the method that you referenced to update the attribute. The new attribute appears correctly on the Current States list in the device. And more importantly, I have defined a rule in RM with the new custom attribute and it allows me to do the comparison as a number. Success. Thanks a bunch for the insight.

So if I may, the next step is notifications. It appears that Notifications will not allow custom attributes to be used (?) so I will need to use RM to generate my notification. I like the features in Notifications that allow you to define the number of notifications and how often and etc. Is there a preferred method or way in RM to do something similar. Right now RM generates the notification once a minute or more. I assume this is based on the value change that I am monitoring.