New app — which CUSTOM DTH’s will work?

Seems like just add…

capability “Health Check”

but what should be in the ping?

I found this…

def ping() {
return zigbee.onOffRefresh() or zwave.switchMultilevelV2.switchMultilevelGet().format() or whatever makes sense for the device
}

I wonder if that is accurate… Also, not sure if the default ping value should be set somewhere, or how to do that.

For DH, check out how it is setup for z-wave devices in the SmartThings public GitHub. (I think the Nexia doorbell is z-wave?)

Alright, so I cleaned up the code and added what I think is a good Health Check. I tested in New App and all seems fine with the Nexia Doorbell.

/**
 *  Nexia Doorbell Sensor - DB100Z
 *
 *  Copyright 2016 DarwinsDen.com
 *
 *  For installation instructions, DB100Z device review information, documentation and images,
 *  or for questions or to provide feedback on this device handler, please visit: 
 *
 *      darwinsden.com/db100z
 *
 *  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.
 *
 *	Author: Darwin@DarwinsDen.com
 *	Date: 2016-03-26
 *
 *	Changelog:
 *
 *  1.4 (05/10/2018) -  Added contact sensor as capability for use with smart home monitor
 *  1.3 (09/25/2016) -  Added display of firmware version and updated to get battery level on initial installation
 *  1.2 (09/11/2016) -  Added preference option for push-to-break button (vs. default push-to-make) doorbell circuit. Note: enabling
 *                      this setting will also result in a doorbell notification if power is lost to the doorbell transformer.
 *  1.1 (05/11/2016) -  Added Button capability option.
 *	1.0 (03/26/2016) -	Initial 1.0 Release.
 *
 */
 
metadata {
	definition (name: "Nexia Doorbell Sensor", namespace: "darwinsden", author: "Darwin", mnmn:"SmartThings", vid: "generic-switch") {
		capability "Actuator"
		capability "Switch"
        capability "Momentary"
        capability "Button"
        capability "Contact Sensor"
		capability "Sensor"
		capability "Battery"
		capability "Refresh"
        capability "Configuration"
        capability "Health Check"
		
		attribute "status", "enum", ["off", "doorbell"]
        fingerprint deviceId: "0x0701", inClusters: "0x5E, 0x86, 0x72, 0x5A, 0x73, 0x80, 0x70, 0x71, 0x85, 0x59, 0x84, 0x7A"
	}

	simulator {
	}

    preferences {
		input "pushToBreak", "bool", title: "Doorbell circuit is push-to-break instead of push-to-make",  defaultValue: false,  displayDuringSetup: true, required: false	
    }
    
	tiles(scale: 2) {
    	multiAttributeTile(name:"status", type: "generic", width: 6, height: 4) {
			tileAttribute ("device.status", key: "PRIMARY_CONTROL") {
				attributeState "off", label: "Off", icon:"st.Home.home30", backgroundColor:"#ffffff"
				attributeState "doorbell", label: "Ringing", icon:"st.alarm.alarm.alarm", backgroundColor:"#53a7c0"
			}
        }

		valueTile("battery", "device.battery", decoration: "flat", inactiveLabel: false, width: 2, height: 2) {
			state "default", label:'${currentValue}% battery', unit:""
		}

		standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
			state "default", action:"refresh.refresh", icon:"st.secondary.refresh"
		}
        
        valueTile("firmwareVersion", "device.firmwareVersion", width:2, height: 2, decoration: "flat", inactiveLabel: false) {
			state "default", label: '${currentValue}'
		}

		main "status"
		details(["status", "battery", "refresh", "firmwareVersion"])
	}
}

def installed() {
	refresh()
}

def ping() {
	refresh()
}

def refresh() {
	sendEvent(name: "status", value: "off", displayed: false, isStateChange: true)
	sendEvent(name: "switch", value: "off", displayed: false, isStateChange: true)
	updated()
	configure()
}

def updated() {
	// Device-Watch simply pings if no device events received for checkInterval duration of 32min = 2 * 15min + 2min lag time
	sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID, offlinePingable: "1"])
    
	log.debug ("updating")
	if (pushToBreak) {
		state.pushToBreak = true
	}
	else {
		state.pushToBreak = false
	}
}

def configure() {
	log.debug ("configure() called")
	def commands = []
	commands << zwave.versionV1.versionGet().format()
	commands << zwave.batteryV1.batteryGet().format()
	delayBetween(commands,500)
}

def zwaveEvent(physicalgraph.zwave.commands.wakeupv2.WakeUpNotification cmd) {
	def event = createEvent(descriptionText: "${device.displayName} woke up", displayed: false)
	def result = []
    
	// Request battery info on wake up if levels have not been received within last 24 hours
	if (!state.lastBatteryReport || (new Date().time) - state.lastBatteryReport > 24*60*60*1000) {
		result += response(zwave.batteryV1.batteryGet().format())
		result += response("delay 1200")
	}
	result += response(zwave.wakeUpV1.wakeUpNoMoreInformation().format()) 
	return result
}

def zwaveEvent(physicalgraph.zwave.commands.versionv1.VersionReport cmd) {	
	//updateDataValue("applicationVersion", "${cmd.applicationVersion}")
	log.debug ("received Version Report")
	log.debug "applicationVersion:      ${cmd.applicationVersion}"
	log.debug "applicationSubVersion:   ${cmd.applicationSubVersion}"
	state.firmwareVersion=cmd.applicationVersion+'.'+cmd.applicationSubVersion
	log.debug "zWaveLibraryType:        ${cmd.zWaveLibraryType}"
	log.debug "zWaveProtocolVersion:    ${cmd.zWaveProtocolVersion}"
	log.debug "zWaveProtocolSubVersion: ${cmd.zWaveProtocolSubVersion}"
	setFirmwareVersion()
	createEvent([descriptionText: "Firmware V"+state.firmwareVersion, isStateChange: false])
}

// Unexpected command received
def zwaveEvent (physicalgraph.zwave.Command cmd) {
	log.debug("Unhandled Command: $cmd")
	return createEvent(descriptionText: cmd.toString(), isStateChange: false)
}

def switchOffVerification() {
	if (state.bellIsRinging) {
		log.debug("${device.displayName} switchOffVerification setting switch off")
		sendEvent(name: "status", value: "off", descriptionText: "Button released via verification check", isStateChange: true)
	}
	state.bellIsRinging = false
	sendEvent(name: "status", value: "off", displayed: false, isStateChange: true)
	sendEvent(name: "switch", value: "off", displayed: false, isStateChange: true)
	sendEvent(name: "contact", value: "closed", displayed: false, isStateChange: true)      
}

//Battery Level received
def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
	def result = null
	state.lastBatteryReport = new Date().time
	def batteryLevel = cmd.batteryLevel
	log.info("Battery: $batteryLevel")
	result = createEvent(name: "battery", value: batteryLevel, unit: "%", descriptionText: "Battery%: $batteryLevel", isStateChange: true)   
	return result
}

//Notification received
def zwaveEvent(physicalgraph.zwave.commands.notificationv3.NotificationReport cmd) {
	def result = []

	// if the bell is not already ringing, record as a button press. We can't always trust an event of 1 to be a 
	// button press if messages arrive out of order or are missed

	if (!state.bellIsRinging) { 
		if (!pushToBreak | cmd.event == 0) //Event 1 will never be a doorbell trigger for a push to break circuit
		{
			// bell is not ringing - signal a button press
			state.bellIsRinging = true 
			log.debug("${device.displayName} notification event = $cmd.event triggered switch on")
			runIn(10, switchOffVerification) //set to turn off switch in 10 seconds in case the button release event is missed   
			result += createEvent(name: "status", value: "doorbell", descriptionText: "Button pressed", isStateChange: true)
			result += createEvent(name: "switch", value: "on", displayed: false, isStateChange: true)
			result += createEvent(name: "momentary", value: "pushed", displayed: false, isStateChange: true)
			result += createEvent(name: "button", value: "pushed", data: [buttonNumber: "1"], displayed: false, isStateChange: true)
			result += createEvent(name: "contact", value: "open", displayed: false, isStateChange: true)             
        }
	} else {
		// bell is ringing - signal a button release
		state.bellIsRinging = false
		log.debug("${device.displayName} notification event = $cmd.event triggered switch off")
		result += createEvent(name: "status", value: "off", descriptionText: "Button released", isStateChange: true)
		result += createEvent(name: "switch", value: "off", displayed: false, isStateChange: true)
		result += createEvent(name: "contact", value: "closed", displayed: false, isStateChange: true)             
    }
	return result
}

def setFirmwareVersion() {
	def versionInfo = ''
	if (state.firmwareVersion) {
		versionInfo=versionInfo+"Firmware V"+state.firmwareVersion
	}
	else {
		versionInfo=versionInfo+"Firmware unknown"
	}
	sendEvent(name: "firmwareVersion",  value: versionInfo, isStateChange: true)
}

def parse(description) {
	def result = null
	log.debug (description)
	if (description.startsWith("Err")) {
		result = createEvent(descriptionText: description, isStateChange: true)
	} else if (description != "updated") {
		def cmd = zwave.parse(description, [0x71: 3, 0x80: 1])
		if (cmd) {
			result = zwaveEvent(cmd)
		} else {
			log.debug("Couldn't zwave.parse '$description'")
		}
	}
	return result
}

I know the tiles do not work in the new app and the firmware won’t show up, or the custom setting, but I left it to be compatible with the old app until we learn how to do that stuff in the new app.

I’m going to see about fixing up the Aeotec Doorbell I use, then maybe see if I can find anything to make more progress on the Keypad, but unless I stumble upon a hidden vid that is type keypad, no progress can be made there, it’s working as a motion like others have done here already.

Hi Yves,

Like rey_rios I’m also an early contributor (December 2015) but the last update I got via email was 5.0 and I’m not sure what you mean by an ‘original sellfy download link’. Was hoping to get your Next device package as well if I could get some direction too. Thanks.

Larry

Hi, since the V5 major upgrade, you need to contribute to the code by using my e-commerce solution (sellfy). I don’t send email updates anymore as it’s time consuming and people were complaining to being ‘spammed’.

The code has changed quite a lot since V4, and the new code supports also the new Samsung app (for the basic attributes and interaction). The new code supports many features and commands there were not available earlier in V4/V5.0 (about 3 years ago). For more details, refer to the ST community wiki:

http://thingsthataresmart.wiki/index.php?title=My_Ecobee_Device#Information

So, please contribute to the code at my store in order to get any minor updates in the future (with the sellfy download link).

Regards.

Thanks, for clarifying. Happy to contribute – clearly a lot of work going into these solutions. Thanks!

1 Like

BTW, the Nest DTH implementation is also very comprehensive, and you have access to some complimentary smartapps for the most common use cases at my github for the Nest and Ecobee:

http://thingsthataresmart.wiki/index.php?title=My_Next_Tstat

http://thingsthataresmart.wiki/index.php?title=My_Next_Alarm

http://thingsthataresmart.wiki/index.php?title=MyNextCam
Ecobee:

Nest:

Regards.

For someone in this forum. Does anyone know the three parameters for music players? I have fixed my Kasa/TP-Link items (still in-test). Now for the Samsung Multiroom Speakers.

Dave

Finally got the TP-Link / Kasa devices working.

I am using the RG Linear GD00Z Garage Door Opener DTH for Linear/Go Control GD00Z Garage Door Opener. What should be the vid set int he DTH for this to show up and work in the STSC App?

Try this, works for mine:

vid: “generic-contact-2”, ocfdevicetype: “oic.d.garagedoor”, mnmn: “SmartThings”

Don’t forget to add:

capability: “health check”

That seems to allow the new app to see it and show open/close (at least a improvement) but doesn’t allow control. Assuming since the vid is “contact” and needs “switch”?

1 Like

OK try “generic-switch” or “generic-lock-2”, didn’t think, mine is just a contact on the door, not a controller.

i believe “generic-contact-4” has door control

1 Like

Yeah, that helped. Although now it shows open/closed in main tile (correct) but two separate switches, one called “Door Control” and one called “Garage Door Control”. Door control doesn’t work but does show status, Garage Door Control does open and close the door (MyQ Lite). So thanks…progress at least.

EDIT: Removed the capability of “Door Control” and left “Garage Door Control” thinking that would fix it but it didn’t, just made it angry and now says “Couldn’t connect to Garage Door Opener. Try again later.” so put it back in and don’t get the error but do have the switch doubled up. I’ll keep playing with it.

Correct, but it doesn’t seem to allow the user to use the control on the main UI page, one has go into the page to use the controls.

BTW what does “generic-lock-2” do?

Found these while hunting which I’m guessing SmartThings is using as a reference?

Might be helpful as I see some in here not yet in their GitHub. This appears to be a master list they are using…would really be nice if a staff member could comment or just give us the littlest bit of guidance.

Combining these with health check code (based on the code here) seems to be at least guiding me in the right direction.

4 Likes

interesting list. It seems to be missing some that they are currently using. x.com.st.d.siren for example

Yeah but its a least something since no one at ST is saying anything. Also, fun fact, I’m having devices get stuck in the new app and force stop/clear cache isn’t fixing it. I’ve had to delete and re-add devices for the new DTH to get picked up. So that’s fun.