How to CORRECTLY pair a Aeotec Recessed Door Sensor 7 with a hub

I purchased several of these G7 versions because I had a previous generation sensor and was happy with it. I almost returned them because they would all pair, but wouldn’t work - the status would change once and then stay stuck. The problem is the S2 security. If you pair them using the instructions, or by using the app and selecting the “Recessed Door Sensor Gen 5/7” device, you will be prompted to scan the QR code on the box. This will set the device to use S2 security which will pair, but FAIL to work correctly, at least it did on my SmartThings Hub V3 running Firmware Version 000.029.00008.

Solution:You have to force the sensor to connect using the unsecured protocol!

Note: If you already paired the sensor using the S2 security (i.e. you scanned the box QR code), you must delete it from the Hub before adding it unsecured.
To delete it:

  1. Click the sensor’s icon in the SmartThings app
  2. Click on the vertical dots (…) in the upper right-hand corner and then select “Edit”
  3. Click “Delete device” and then “Delete” on the confirmation popup
  4. Quickly push and release the tiny button on the front of the sensor (and I do mean quickly) - it should start flashing slowly and then go out.
  5. The app should show the device was deleted. Click “Done”

To Pair the sensor:

  1. Open your Recessed Door sensor cap and pull out the sensor “guts” per the instructions and remove the battery (remove the plastic battery tab if it’s stuck to the battery)
  2. Put the battery back in the sensor (it’ll flash red and then go out)
  3. Open the SmartThings App (I use the newest version, not the Classic app)
  4. Click the “+” in the upper right-hand corner
  5. Click “Device”
  6. Click “Scan” in the upper right-hand corner (it should now show “Scanning…”)
  7. Quickly push and release the tiny button on the front of the sensor (and I do mean quickly) - it should start flashing quickly, then turn solid red, then go out. If it doesn’t, try removing the battery for 15 seconds and then putting it back in.
  8. The app should now show the “Aeotec Recessed Door Sensor” and a “Rename” button. Click the “Rename” button to rename the sensor to something useful, like “Front Door”.
  9. Click the back arrow (<) in the upper Left-hand corner to go back to the “Add Device” screen.
  10. Click the back arrow (<) in the upper Left-hand corner again to go back to your devices.
  11. Scroll until you find the “No room assigned” group and the sensor should be listed.
  12. Press and hold the sensor icon, select “Move to other room”, select the room from the list, and click “Move”.
  13. Put the sensor back together and snap on the cap. Use the magnet to see that it’s working by watching the status on the device’s icon in the app. It should show Closed when the magnet is near and Open when it’s away.

Install in the door per instructions and enjoy!

Time will tell if the battery life is as good as they claim.

8 Likes

Thanks!

I’m going to take a look at this sensor. I’ve got a custom iron front door and no way a surface mount sensor is going on it.

The roller latch has popped open on is twice in high winds when the lock wasn’t engaged. Unknown to us, it happened at 4:30am today. We’re out in the country so just happy a family of raccoons didn’t happen by! :joy:

@SBarcus - I just experienced the same exact issue. I am guessing that the default Z-Wave Door/Window Sensor DTH doesn’t support secure messaging required by S2. I emailed ST support to see if true and when they plan on updating the DTH. Compared to the previous generation (unless changes were made to ST since I last paired an old generation version of this sensor), the G7 includes/excludes easily and with no issues at all. All my G5 versions were always a nightmare and required a large number of attempts. Now if we can get S2 working on the G7… I might consider replacing them all.

This is what it says when I got it to work without S2:

Thank you for this post! Was so frustrating getting these to work until scanned Per your instructions. They all work fine now!

Any word from ST about this?

Response from support was useless. I would not hold my breath on this. Who knows, maybe once ST moves away from the current IDE and Groovy based DTHs maybe the replacement will fully support S2. In the end it works, even though it isn’t encrypted…

Bought the recently released series 7. Found the device however wouldn’t show current state. Had to be emailed a custom DTH from Aeotec for it to work. Disappointing as i wanted it to run local… I emailed back asking when this would be fixed but they just ignored by reply and closed the ticket down.

Thanks for the guide. This was pretty frustrating to troubleshoot.

AverageJoe90 - Can you share the custom device handler?

Trying to work out how to post it in one of those boxes! I have it though! Once its been connected for a while I changed it to ‘Z-Wave Door/Window Sensor’ and its worked flawlessly since.

/**
 *  Copyright 2015 SmartThings
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 *  Z-Wave Door/Window Sensor
 *
 *  Author: SmartThings
 *  Date: 2013-11-3
 */

metadata {
	definition(name: "Aeotec Recessed Door Sensor Gen5/7", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.sensor.contact", runLocally: false, minHubCoreVersion: '000.017.0012', executeCommandsLocally: false, genericHandler: "Z-Wave") {
		capability "Contact Sensor"
		capability "Sensor"
		capability "Battery"
		capability "Configuration"
		capability "Health Check"

		fingerprint mfr: "0086", prod: "0102", model: "0059", deviceJoinName: "Aeotec Recessed Door Sensor"
		fingerprint mfr: "0086", prod: "0002", model: "0059", deviceJoinName: "Aeotec Recessed Door Sensor"
		fingerprint mfr: "0086", prod: "0002", model: "0078", deviceJoinName: "Aeotec Door/Window Sensor Gen5" //EU
		fingerprint mfr: "0371", prod: "0102", model: "0007", deviceJoinName: "Aeotec Door/Window Sensor 7" //EU
		fingerprint mfr: "0371", prod: "0002", model: "0007", deviceJoinName: "Aeotec Door/Window Sensor 7" //US          
		fingerprint mfr: "0371", prod: "0102", model: "00BB", deviceJoinName: "Aeotec Recessed Door Sensor 7" //US
		fingerprint mfr: "0371", prod: "0002", model: "00BB", deviceJoinName: "Aeotec Recessed Door Sensor 7" //EU
	}

	// simulator metadata
	simulator {
		// status messages
		status "open": "command: 2001, payload: FF"
		status "closed": "command: 2001, payload: 00"
		status "wake up": "command: 8407, payload: "
	}

	// UI tile definitions
	tiles(scale: 2) {
		multiAttributeTile(name: "contact", type: "generic", width: 6, height: 4) {
			tileAttribute("device.contact", key: "PRIMARY_CONTROL") {
				attributeState("open", label: '${name}', icon: "st.contact.contact.open", backgroundColor: "#e86d13")
				attributeState("closed", label: '${name}', icon: "st.contact.contact.closed", backgroundColor: "#00A0DC")
			}
		}
		valueTile("battery", "device.battery", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
			state "battery", label: '${currentValue}% battery', unit: ""
		}

		main "contact"
		details(["contact", "battery"])
	}
}

private getCommandClassVersions() {
	[0x20: 1, 0x25: 1, 0x30: 1, 0x31: 5, 0x80: 1, 0x84: 1, 0x71: 3, 0x9C: 1]
}

def parse(String description) {
	log.debug ""+description
	def result = null
	if (description.startsWith("Err 106")) {
		if (zwaveInfo?.zw?.endsWith("s")) {
			log.debug description
		} 
	} else if (description != "updated") {
		def cmd = zwave.parse(description, commandClassVersions)
		if (cmd) {
			result = zwaveEvent(cmd)
		}
	}
	log.debug "parsed '$description' to $result"
	return result
}

def installed() {
	log.debug "installed()"
	// Device-Watch simply pings if no device events received for 482min(checkInterval)
	sendEvent(name: "checkInterval", value: 2 * 4 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
	// this is the nuclear option because the device often goes to sleep before we can poll it
	sendEvent(name: "contact", value: "open", descriptionText: "$device.displayName is open")
	sendEvent(name: "battery", unit: "%", value: 100)
}

def updated() {
	log.debug "updated()"
	// Device-Watch simply pings if no device events received for 482min(checkInterval)
	sendEvent(name: "checkInterval", value: 2 * 4 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
}

def configure() {
	log.debug "configure()"
	commands([
        zwave.configurationV1.configurationSet(parameterNumber: 4, size: 2, scaledConfigurationValue: 0),
        zwave.configurationV1.configurationSet(parameterNumber: 5, size: 1, scaledConfigurationValue: 1),
        zwave.configurationV1.configurationGet(parameterNumber: 4),
        zwave.configurationV1.configurationGet(parameterNumber: 5)
    ])
}

def sensorValueEvent(value) {
	if (value) {
		createEvent(name: "contact", value: "open", descriptionText: "$device.displayName is open")
	} else {
		createEvent(name: "contact", value: "closed", descriptionText: "$device.displayName is closed")
	}
}

def zwaveEvent(physicalgraph.zwave.commands.notificationv3.NotificationReport cmd) {
	log.debug ""+cmd
	def result = []
	if (cmd.notificationType == 0x06 && cmd.event == 0x16) {
		result << sensorValueEvent(1)
	} else if (cmd.notificationType == 0x06 && cmd.event == 0x17) {
		result << sensorValueEvent(0)
	} 
	result
}

def zwaveEvent(physicalgraph.zwave.commands.wakeupv1.WakeUpNotification cmd) {
	log.debug "Wakeup Report"
	def event = createEvent(descriptionText: "${device.displayName} woke up", isStateChange: false)
	def cmds = []
    
	cmds << zwave.batteryV1.batteryGet()

	def request = []
	if (cmds.size() > 0) {
		request = commands(cmds, 1000)
		request << "delay 2000"
	}
    
	request << zwave.wakeUpV1.wakeUpNoMoreInformation().format()

	[event, response(request)]
}

def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
	log.debug "Battery Report"
	def map = [name: "battery", unit: "%"]
	if (cmd.batteryLevel == 0xFF) {
		map.value = 1
		map.descriptionText = "${device.displayName} has a low battery"
		map.isStateChange = true
	} else {
		map.value = cmd.batteryLevel
	}
	state.lastbat = now()
	[createEvent(map)]
}

def zwaveEvent(physicalgraph.zwave.commands.securityv1.SecurityMessageEncapsulation cmd) {
	def encapsulatedCommand = cmd.encapsulatedCommand(commandClassVersions)
	if (encapsulatedCommand) {
		zwaveEvent(encapsulatedCommand)
	}
}

def zwaveEvent(physicalgraph.zwave.Command cmd) {
	createEvent(descriptionText: "$device.displayName: $cmd", displayed: false)
}

def zwaveEvent(physicalgraph.zwave.commands.configurationv2.ConfigurationReport cmd) {
    log.debug "${cmd.configurationValue}"
}


private command(physicalgraph.zwave.Command cmd) {
	if (zwaveInfo?.zw?.endsWith("s")) {
		zwave.securityV1.securityMessageEncapsulation().encapsulate(cmd).format()
	} else {
		cmd.format()
	}
}

private commands(commands, delay = 200) {
	delayBetween(commands.collect { command(it) }, delay)
}

Thanks you for posting!

3 Likes

@SBarcus - Thanks so much for taking the time to post these detailed instructions! After a frustrating hour trying on my own and then with ST support, i found your post and within minutes have the Aeotec Recessed Door Sensor 7 working perfectly! Thanks again!

So, almost a year later, has this S2/ QR pairing been fixed by ST?

S2 pairing should work fine, the problem here is unfortunately with the device itself and is able to be resolved by a firmware update.

Check out: Update Recessed Door Sensor 7 V1.05 : Aeotec Help Desk