[OBSOLETE] Aeotec Home Energy Meter Gen 5 composite DTH

Check out the new version of the DTH (both Gen 5 and G2, and child devices) i just posted on GitHub - I added “resetMeter” command to it so it should now be compatible with this smart app.

Wow, that would be awesome. (Where do you guys find the time to do things like this?)

My intended usage and background info: As you know by now, I have 2 HEMS - one attached to the (3-phase) mains and a second connected to the (3-phase) generator.

The capacity of my generator is not sufficient to power all appliances in my home (I did not know better and should have purchased a single phase generator - single phase power would have suited my requirements much better).

My intention was to use the HEM connected to the generator to turn off devices/appliances (or prevent them from being turned on) as the limit of each phase of the generator comes close. E.g. I know which devices/appliances get their power from the blue phase. The downstairs water heater is one of these and on it easily consumes 4 Amp. The maximum current available for each phase is 8 Amps e.g. My idea was to monitor each phase and once it exceeds say 4 Amp, it should turn off the downstairs water heater (or disable the piston which schedules the on/off times of the water heater.)
To accomplish this, the HEM will have to frequently send out updates to ensure it turns off high consumption devices before the maximum current is reached. What I did not realise is that the HEMS creates a massive amount of traffic and with 2 HEMS on the network, devices start to respond slowly or not at all.
A solution would be to turn off reporting of the HEM connected to the mains when the generator starts producing power and vice verse as far as the HEM connected to the generator’s current, is concerned.
The perfect solution would, therefore, be to turn all reporting of the Mains HEM off and return all settings as they were (whatever they had been) when the HEM reporting is turned back on again.
As far as the Generators HEM is concerned (and I suppose this is all you had asked), I believe it would be important to accomplish my goal, to get frequent reports on the Watts and Amps used in respect of each clamp.
I suppose one could use the current registered by the generator’s HEM as the trigger for the switch over. Or else, I have a Fibaro binary switch which I could connect in some or other way to the generator’s control panel, which could probably flip a virtual switch. I’m sure that would be possible - I will just have to figure out how to connect the binary switch to the generator’s control panel.

I created a peace of code that when added to the DTH should allow you to set the parameters of the HEM from CoRE.

To do this you should add this in “definiction” section of DTH (near the top, after capabilities)

command "setParameter"

and at the end of the DTH add:

def setParameter(Integer nr, Integer value) {
	def parameter = parameterMap().find { it.num == nr }
    if (parameter != null) {
        return encap(zwave.configurationV2.configurationSet(configurationValue: intToParam(value, parameter.size), parameterNumber: nr, size: parameter.size))
    }
}

after that you have to remove and re-add the device from CoRE available devices list to make CoRE refresh the command list for the device.

In WebCore you set it like on the picture below. You add 2 Integer parameters using the Parameters button near the bottom (next to Delete) first one is the number of parameter you want to change, second one is the new value.

This is untested but should work.
Please note that due to limitations imposed by SmartThings I can’t update the values visible in settings of the device.

1 Like

I’m very excited about this. Do I understand correctly that the values displayed under settings for the device in the ST App, will no longer reflect the actual settings which were set by webCoRE? Will the values in the IDE display the true settings?
I’ve done this, but because of the above, I can’t tell if it is working. I’ll work a way to test if it is working.
Is it possible to change parameters which do not have numbers next to them, like these e.g.:

You are right the values in IDE and in DTH will not reflect current values.

Those are parameters 101 to 103. For ease of use I created switches because calculating raw value is to complicated for average user.

Unfortunately you will have to calculate the value for them yourself to set them by core.

This manual contains a table that will tell you how to calculate them: https://aeotec.freshdesk.com/helpdesk/attachments/6009584508
(look for section “Configuration Values for Parameter 101‐103:”)

or to make it easier for you here you have the values for every setting:

1		Report Accumulated kWh of whole HEM
2		Report Instantaneous Watts of whole HEM.
4		Report Instantaneous Voltage of whole HEM.
8		Report Instantaneous Current (Amperes) of whole HEM.
256		Report Instantaneous Watts of Channel 1.
512		Report Instantaneous Watts of Channel 2.
1024	Report Instantaneous Watts of Channel 3.
2048	Report Accumulated kWh of Channel 1.
4096	Report Accumulated kWh of Channel 2.
8192	Report Accumulated kWh of Channel 3.
65536	Report Instantaneous Voltage of Channel 1.
131072	Report Instantaneous Voltage of Channel 2.
262144	Report Instantaneous Voltage of Channel 3.
524288	Report Instantaneous Current (Amperes) of Channel 1.
1048576	Report Instantaneous Current (Amperes) of Channel 2.
2097152	Report Instantaneous Current (Amperes) of Channel 3.

you just add together the values for options you want to enable and that is your value :stuck_out_tongue:

1 Like

This works great! Thank you once again - I appreciate this immensely.

I suppose, just going into the Settings and pressing “Done” will set the HEM according to the settings of all parameters as they are displayed in the app? So one could either use this to make quick changes or stay away from the settings section if you don’t want to mess up the settings set by webCoRE?

It will be very easy to get the HEM of the generator to only report data when needed - I’m only going to enable reporting in respect of the total Watts of the main device of the generator’s HEM. All I have to do then is to set up a piston which will change the parameters to enable other reports of that HEM if the cumulative Watts exceed a e.g. a 1000 - that should be an indication that there is a power outage and the generator is running (and to start monitoring devices.)
What I also need to do is to figure out how to get the state of all devices with webCore before I start turning them off, so that I can turn them back on when the mains power is restored.

Will this work with any DTH if the same code is added to the DTH?

Edit: I was wondering - one the parameters are set for high frequency reports, is all that is required to disable report not to change parameter 3 to “0” and par 111 to a high number like 1000000? That should stop frequent reports? To enable frequent reports, one will only have to set par 3 to “1” and par 111 to “10” e.g.?

Am I correct to assume that the other parameters will remain unchanged?

Once again thanks very much.

In theory if you don’t change the values in settings the DTH will not know that they have changed so will not send them to the HEM. In other words simply clicking Done will not reset the values to ones in the settings.

This code will work with most of mine DTH (it uses some of function present in my device handlers) but will not work with other device handlers, sorry.

@EDIT - this should work in theory. :slight_smile:

I’m new here and trying to get this up and running. I have the HEM connected to the smart things hub. But I have not been able to get a wattage out of it. I do see a voltage. And I’m also getting a sync incomplete… any help would be appreciated.

What HEM version? Gen 5 or G2? Is it connected in secure mode?

Its a Gen 5 not sure how to tell if its connected in secure mode.

You can check it in the Raw Description in My Devices > Aeotec HEM Gen5 it should begin with “zw:Ls” if it’s just “zw:L” the meter is not in secure mode and Gen 5 version of the meter will not accept configuration when not in secure mode. To add the meter to your network in secure mode you have to:

From first post in this thread :wink: :

To make sure you included your HEM securely remove it from the network and then re-add it pressing the buton on the HEM twice.

Raw Description
zw:Ls type:3101 mfr:0086 prod:0102 model:005F ver:1.31 zwv:3.92 lib:03 cc:5E,86,72,98,56 ccOut:5A sec:32,60,70,59,85,7A,73 role:05 ff:9000 ui:9000 epc:2 ep:[‘3101 32’]

So it is in secure mode.

But im still getting sync incomplete. i have also put the timegroup 2 and 3 to 0 as that was what i was reading was the problem for someone esle.

The meter doesn’t accept 0 for those parameters, try some other value.

ok so i changed it to 36000,

Here is the log for the sync.

3adf8a71-18ca-4f50-8952-b276b77d1168 10:34:07 AM: info Aeotec HEM Gen5 Sync Incomplete
3adf8a71-18ca-4f50-8952-b276b77d1168 10:34:07 AM: info Aeotec HEM Gen5 - Executing syncCheck()
3adf8a71-18ca-4f50-8952-b276b77d1168 10:34:00 AM: info Aeotec HEM Gen5 - MeterReport received, ep: 1 value: 119.952 V
3adf8a71-18ca-4f50-8952-b276b77d1168 10:34:00 AM: debug Aeotec HEM Gen5 - Parsed MultiChannelCmdEncap MeterReport(deltaTime: 0, meterType: 1, meterValue: [0, 1, 212, 144], precision: 3, previousMeterValue: [0, 0, 0, 0], rateType: 1, scale: 4, scale2: false, scaledMeterValue: 119.952, scaledPreviousMeterValue: 0.000, size: 4)
3adf8a71-18ca-4f50-8952-b276b77d1168 10:34:00 AM: debug Aeotec HEM Gen5 - Parsed Crc16Encap into: MultiChannelCmdEncap(bitAddress: false, command: 2, commandClass: 50, destinationEndPoint: 0, parameter: [161, 100, 0, 1, 212, 144, 0, 0, 0, 0, 0, 0], sourceEndPoint: 1)
3adf8a71-18ca-4f50-8952-b276b77d1168 10:34:00 AM: debug Aeotec HEM Gen5 - Parsed SecurityMessageEncapsulation into: Crc16Encap(checksum: 18856, command: 13, commandClass: 96, data: [1, 0, 50, 2, 161, 100, 0, 1, 212, 144, 0, 0, 0, 0, 0, 0])
3adf8a71-18ca-4f50-8952-b276b77d1168 10:34:00 AM: debug Aeotec HEM Gen5 - Parsed: SecurityMessageEncapsulation(commandByte: [96, 13, 1, 0, 50, 2, 161, 100, 0, 1, 212, 144, 0, 0, 0, 0, 0, 0, 73, 168], commandClassIdentifier: 86, commandIdentifier: 1, reserved13: 0, secondFrame: false, sequenceCounter: 0, sequenced: false)
3adf8a71-18ca-4f50-8952-b276b77d1168 10:34:00 AM: debug Aeotec HEM Gen5 - Parsing: zw device: 09, command: 9881, payload: 00 56 01 60 0D 01 00 32 02 A1 64 00 01 D4 90 00 00 00 00 00 00 49 A8
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:59 AM: info Aeotec HEM Gen5 - MeterReport received, ep: 1 value: 119.952 V
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:59 AM: debug Aeotec HEM Gen5 - Parsed MultiChannelCmdEncap MeterReport(deltaTime: 0, meterType: 1, meterValue: [0, 1, 212, 144], precision: 3, previousMeterValue: [0, 0, 0, 0], rateType: 1, scale: 4, scale2: false, scaledMeterValue: 119.952, scaledPreviousMeterValue: 0.000, size: 4)
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:59 AM: debug Aeotec HEM Gen5 - Parsed Crc16Encap into: MultiChannelCmdEncap(bitAddress: false, command: 2, commandClass: 50, destinationEndPoint: 0, parameter: [161, 100, 0, 1, 212, 144, 0, 0, 0, 0, 0, 0], sourceEndPoint: 1)
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:59 AM: debug Aeotec HEM Gen5 - Parsed SecurityMessageEncapsulation into: Crc16Encap(checksum: 18856, command: 13, commandClass: 96, data: [1, 0, 50, 2, 161, 100, 0, 1, 212, 144, 0, 0, 0, 0, 0, 0])
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:59 AM: debug Aeotec HEM Gen5 - Parsed: SecurityMessageEncapsulation(commandByte: [96, 13, 1, 0, 50, 2, 161, 100, 0, 1, 212, 144, 0, 0, 0, 0, 0, 0, 73, 168], commandClassIdentifier: 86, commandIdentifier: 1, reserved13: 0, secondFrame: false, sequenceCounter: 0, sequenced: false)
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:59 AM: debug Aeotec HEM Gen5 - Parsing: zw device: 09, command: 9881, payload: 00 56 01 60 0D 01 00 32 02 A1 64 00 01 D4 90 00 00 00 00 00 00 49 A8
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:59 AM: info Aeotec HEM Gen5 - MeterReport received, ep: 0 value: 0.000 kWh
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:59 AM: debug Aeotec HEM Gen5 - Parsed Crc16Encap into: MeterReport(deltaTime: 5, meterType: 1, meterValue: [0, 0, 0, 0], precision: 3, previousMeterValue: [0, 0, 0, 0], rateType: 1, scale: 0, scale2: false, scaledMeterValue: 0.000, scaledPreviousMeterValue: 0.000, size: 4)
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:59 AM: debug Aeotec HEM Gen5 - Parsed SecurityMessageEncapsulation into: Crc16Encap(checksum: 21144, command: 2, commandClass: 50, data: [33, 100, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0])
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:59 AM: debug Aeotec HEM Gen5 - Parsed: SecurityMessageEncapsulation(commandByte: [50, 2, 33, 100, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 82, 152], commandClassIdentifier: 86, commandIdentifier: 1, reserved13: 0, secondFrame: false, sequenceCounter: 0, sequenced: false)
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:59 AM: debug Aeotec HEM Gen5 - Parsing: zw device: 09, command: 9881, payload: 00 56 01 32 02 21 64 00 00 00 00 00 05 00 00 00 00 52 98
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:57 AM: info Aeotec HEM Gen5 - Parameter timeGroup2 value is 36000 expected 36000
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:57 AM: debug Aeotec HEM Gen5 - Parsed SecurityMessageEncapsulation into: ConfigurationReport(configurationValue: [0, 0, 140, 160], parameterNumber: 112, reserved11: 0, scaledConfigurationValue: 36000, size: 4)
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:57 AM: debug Aeotec HEM Gen5 - Parsed: SecurityMessageEncapsulation(commandByte: [112, 4, 0, 0, 140, 160], commandClassIdentifier: 112, commandIdentifier: 6, reserved13: 0, secondFrame: false, sequenceCounter: 0, sequenced: false)
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:57 AM: debug Aeotec HEM Gen5 - Parsing: zw device: 09, command: 9881, payload: 00 70 06 70 04 00 00 8C A0
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:56 AM: info Aeotec HEM Gen5 - encapsulating command using Secure Encapsulation, command: ConfigurationGet(parameterNumber: 113)
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:56 AM: info Aeotec HEM Gen5 - encapsulating command using Secure Encapsulation, command: ConfigurationSet(configurationValue: [0, 0, 140, 160], defaultValue: false, parameterNumber: 113, reserved11: 0, scaledConfigurationValue: 36000, size: 4)
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:56 AM: info Aeotec HEM Gen5 - encapsulating command using Secure Encapsulation, command: ConfigurationGet(parameterNumber: 112)
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:56 AM: info Aeotec HEM Gen5 - encapsulating command using Secure Encapsulation, command: ConfigurationSet(configurationValue: [0, 0, 140, 160], defaultValue: false, parameterNumber: 112, reserved11: 0, scaledConfigurationValue: 36000, size: 4)
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:56 AM: info Aeotec HEM Gen5 - sending config.
3adf8a71-18ca-4f50-8952-b276b77d1168 10:33:56 AM: info Aeotec HEM Gen5 - Executing updated()

I looked over it but not sure what im looking for?

Try again. DTH did not receive response with value for parameter 113 (It happens quite often with this device).

It is still saying sync incomplete. I do have it just on the counter for now. to configure it. I haven’t actually put the clamps on the wires yet. That should affect it right?

It definitely should start giving you readings :slight_smile:

Does the work with the V1, or does anyone know of a similar composite handler for the V1?

When I use direct GitHub integration I’m unable to create the child DTH (main one creates fine); it reports this:
image
Any idea what’s going on? Cutting and pasting the child DTH code seems to work OK (and thanks!)

Have no idea - I’m from EU so I’m posting the code on GitHub manually as integration is (was?) not available here. Sorry.