How to assign code to existing device?

First post, so please be gentle… After years of free use, I’m given up on Wink Hub’s new subscription service model. So purchased latest Smart Hub, successfully added WAPIRZ-1 motion sensor as generic z-wave device. Motion and temperature are working but not battery level.

I’ve read through docs.smartthings, logged into My Devices, and can see my motion sensor properties. I searched this forum and found some code that is supposed to enable battery:

But someone else commented that the code is not formatted properly and gave a link but found an empty page:

Q: Can anyone help identify what’s wrong with the code?
Q: I’m confused on how to assign or attribute the modified code to my current generic z-wave motion sensor?

Thank you for any help
Mike

Here are some step by step instructions on how to install device handler and assign them to devices.

http://www.rboyapps.com/InstallDH.htm

Thanks! Since this is my first try, I wanted to try adding a new device for my GoControl Siren. I found some “good” code, successfully added the new Device Handler and clicked Publish. It’s now showing under my “Device Handlers” as “Published” on the admin webpage, but when I open Add Device in the ST app on my phone, I cannot locate it anywhere. What am I missing?

See step 9 on the link above.

Yes, that’s exactly what I’m trying to do…
-open ST app
-go to devices
-press “+” to add a device
-cannot find the newly created/published Device (GoControl Mutlifunction Siren)
-search for “siren”, come’s up with all the default sirens that were listed previous to creating/pulishing my new Device Handler

You need to pair your zwave device and it will automatically assign the device handler

Now pair your device with the hub (see the SmartThings manual for pairing instructions)

Where I got confused is the term “pair”, because there is no pair function in the ST app. So I had to perform “add device” and just use “generic zwave” as the type. The app then found the siren very quickly and did automatically set it to the newly created Device Handler!