This page lists the groovy code and installation instructions to install a custom device handler over your SmartThings hub and form part of the larger Home Energy Meter Gen5 user guide.


For users using SmartThings Hub, HEM Gen5 may require custom device type support until SmartThings adds native compatibility with the sensor.


Notes - We have received reports that SmartThings has officially integrated Home Energy Meter Gen5 ZW095, you do not need this custom device handler for compatibility but we highly recommend that you use this to get the full function of HEM Gen5.


SmartThings Hub Instructions for creating your own Device Handler.

http://docs.smartthings.com/en/latest/device-type-developers-guide/quick-start.html


HEM Gen5 Github code by ClassicGod.

https://github.com/ClassicGOD/SmartThingsPublic/blob/master/devicetypes/classicgod/aeotec-hem-gen5.src/aeotec-hem-gen5.groovy (Main device handler)


https://github.com/ClassicGOD/SmartThingsPublic/blob/master/devicetypes/classicgod/aeotec-hem-gen5.src/aeotec-hem-gen5-child-device.groovy (Device handler for child devices)

 


Installing the Device Handler.


In the below steps, you will need to install 2 separate devices handlers individually. Steps 4 - 13 will advise the device handlers to install specifically, while step 17 is where you would need to install the parent device handler named "Aeotec HEM Gen5".



Follow the steps below:


  1. Login to Web IDE (https://graph.api.smartthings.com/)
  2. Click on "My Locations" and select the gateway location
  3. Click on "My Device Handlers" tab.
  4. Create a new Device Handler by  clicking on "New Device Handlers" button in the upper-right  corner.
  5. Click on "From Code."
  6. Copy ClassicGod code from Github, and paste it into the code section. (From this link for the main device handler: https://github.com/ClassicGOD/SmartThingsPublic/blob/master/devicetypes/classicgod/aeotec-hem-gen5.src/aeotec-hem-gen5.groovy).

    PRO TIP - 
    • Click on the “Raw” button which exposes only code in github.
    • Then CTRL + a (highlight all), 
    • Then CTRL + c (copy highlighted).
    • Click on the empty code box on SmartThings IDE
    • Then press CTRL + v (paste all copied code)
  7. Click Save, wait until the spinning circle finishes which indicates a successful save.
  8. Click on Publish -> Publish for me.
  9. Click on "My Device Handlers" tab.
  10. Create a new Device Handler by  clicking on "New Device Handlers" button in the upper-right  corner.
  11. Click on "From Code."
  12. Copy ClassicGod code from Github, and paste it into the code section. (From this link for the main device handler: https://github.com/ClassicGOD/SmartThingsPublic/blob/master/devicetypes/classicgod/aeotec-hem-gen5.src/aeotec-hem-gen5-child-device.groovy).

    PRO TIP - 
    • Click on the “Raw” button which exposes only code in github.
    • Then CTRL + a (highlight all), 
    • Then CTRL + c (copy highlighted).
    • Click on the empty code box on SmartThings IDE
    • Then press CTRL + v (paste all copied code)

  13. Click Save, wait until the spinning circle finishes which indicates a successful save.
  14. Click on Publish -> Publish for me.
  15. Install it on your HEM Gen5 by going to "My Devices" page in the IDE
  16. Find your HEM Gen5 and select it.
  17. Go to the bottom of the page for the current HEM Gen5 and click on "Edit."
  18. Find the "Type" field and select your device handler. (Scroll to the very bottom and select "HEM Gen5")
  19. Click on "Update"
  20. Click Save.



Configuring HEM Gen5

Make sure that you configure the internal settings through the HEM Gen5 preference page otherwise the HEM Gen5 will not report. There are a few notable settings, 3 separate groups for setting what sensors you want reported, and another 3 settings that determine how fast each group reports.

  1. Open up SmartThings App
  2. Go to the Home page where all the devices are listed
  3. Open up the main Home Energy Meter Gen5 node
  4. At the top right corner, there should be a gear icon. Click on this icon to open the preference page
  5. Scroll down and activate the settings you want for your HEM Gen5.
  6. Click Save when you are finished.




Troubleshooting - If HEM Gen5 isn't reporting.


Fix Group Association settings of the HEM Gen5 reports using Z-Wave Tweaker


This will guide you through assigning Group Association using Z-Wave Tweaker in SmartThings IDE. In the video below, from 0:00 to 1:40, will show you how to properly assign SmartThings to Group 1 and determine if the messages are going through correctly.



Steps


The steps to install Z-Wave Tweaker (You only need to do this once, if already installed, skip this section):

  1. Login to your SmartThings IDE
  2. Click on My Locations and then select your gateway
  3. Select “My Device Handlers” then click on “Add new Device Handler
  4. Select “From Code
  5. Go into the Z-Wave Tweaker Code, and copy all of the code from line 0 to the very last line. (can be found here directly: https://github.com/codersaur/SmartThings/blob/master/devices/zwave-tweaker/zwave-tweaker.groovy 24)
    • PRO TIP - 
      • Click on the “Raw” button which exposes only code in github
      • Then CTRL + a (highlight all), 
      • Then CTRL + c (copy highlighted).
  6. Paste this into your SmartThings IDE.
    • Click on the empty code box on SmartThings IDE
    • Then press CTRL + v (paste all copied code)
  7. Select Save.
  8. Then click on Publish -> “Publish for me”


Now install Z-Wave Tweaker over HEM Gen5 (starting video from 0:25):

  1. (Important - Live Logging) Remember to open a tab for "Live Logging" so that you can keep watch over the logs.
  2. Click on “My Devices
  3. Look for your  HEM Gen5 and click on it
  4. Scroll to the bottom then click “Edit
  5. Find “Type” and bring out the drop down menu
  6. First make note of the original device handler that you were using (you will need to revert back to the original device handler later)
  7. Find “Z-Wave Tweaker” and select it
  8. click on “Update”
  9. (Important - Live Logging) - Ensure that you see "(debug)" Update detected: DeviceUpdated xxxxxxxxxxxxxxxxxxxx"
  10. (Important - Live Logging) - Click on the name of your HEM Gen5 to filter out logs to only show the HEM Gen5 logs.


Assign Group Association using SmartThings IDE (starting video from 0:46)

  1. (Follow up from previous section) Following the previous steps from section (Now install Z-Wave Tweaker over HEM Gen5), you should now be in the main page of the HEM Gen5. 
    • If you are on a separate page, then do this:
      • Select "My Devices"
      • Click on your HEM Gen5 name
  2. On "Preferences (edit)" click on (edit).
  3. Find "CONFIGURE ASSOCIATION GROUP" and input "1" into the box.
    • leave "Association Group Members" empty, we want to clear out any association first.
  4. Click on "Save"
  5. (Live Logging) - make sure that Group 1 clears out, the logs on "Live Logging" should appear like this:

    Specific logs to look for:
    (info) Sync Complete
    (info) Association Group #1 contains destinations: [] (hexadecimal format)
    (info) Association Group #1 has name: LifeLine

    (Troubleshoot 1) - If you do not see this, perform steps #2 and #4 (skip step 3)
    (Troubleshoot 2) - If you are still not getting these logs, your HEM Gen5 may be too far, move the HEM Gen5 closer to your SmartThings hub
    (Troubleshoot 3) - If that still does not work, move your HEM Gen5 within 10 ft of your hub and exclude then re-include and then start back from step #1.

  6. On "Preferences (edit)" click on (edit).
  7. Find "Association Group Members" and input "01" into the box.
  8. Click on "Save"
  9. (Live Logging) - make sure that the HEM Gen5 syncs, the logs on "Live Logging" should appear like this:

    Specific logs to look for:
    (info) Sync Complete.
    (info) Association Group #1 contains destinations [01] (hexadecimal format)
    (info) Association Group #1 contains destinations [] (hexadecimal format)
    (info) sync(): Syncing Association Group #1 using Multi-Channel Association commands. New Destinations: [01]

    (Troubleshoot 1) - If you do not see this, perform steps #6 and #8 (skip step 7)
  10. Change to your desired "Device Handler" this would indicate that the HEM Gen5 is assigned properly.