Custom Virtual Dimmer Switch Stopped working after hub udate

Hi all. I have a custom app called home cloud hub which was ported over from SmartThings. It was working perfectly until I updated the hub firmware. If I go into the device and push any button the device never changes and nothing is ever logged within Hubitat.

I've tried to create the device again, but it still does not work. If I change the device to a Hubitat Default Virtual Switch Driver on and off works fine.

I do see other attributes being updated in the device events, but On and Off do not ever update. I can change dimmer level, however.

Does anyone have ideas on what the problem could be?

Here is the code:

/**
 *  AT&T Digital Life System
 *
 *
 *  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.
 *
 *
 *  Version history
 *
 *	v0.1.08.12.18 - Ported to hubitat. commented out smartThings specific items.
 *  v0.1.04.06.16 - Removed Location Mode capability - might interfere with Rule Machine
 *  v0.1.03.24.16 - Published device as switch to allow easy manipulation via rules - on() sets it to away
 *                  and off() sets it to home. Also published commands setMode(mode), home(), away(), stay().
 *					You can now also use it as a "Switch Level" by setting the level to 0 for home, 1 for stay
 *                  and 2 or more for away.
 *  v0.1.03.22.16 - Initial beta release
 *
 */
metadata {
	definition (name: "AT&T Digital Life System", namespace: "Keo", author: "Joe Rosiak", oauth: true) {
		capability "Actuator"
        capability "Refresh"
        capability "Configuration"
        capability "Switch"
        capability "Switch Level"
        attribute "digital-life-mode", "enum", ["Home", "Stay", "Instant", "Away"]
        attribute "id", "string"
        attribute "module", "string"       
        attribute "type", "string"
        attribute "system-status", "enum", ["Home", "Home Bypass", "Home ExitDelay", "Stay", "Stay AlarmPending", "Away", "Away AlarmPending", "Instant", "Instant AlarmPending"]
        attribute "arm-state", "string"
        attribute "alarm-mode", "string"
        attribute "bypassed-device-list", "string"
        attribute "alarmed-device-list", "string"
        attribute "armed-stay-device-list", "string"
        attribute "armed-away-device-list", "string"
        attribute "armed-instant-device-list", "string"
        attribute "alarm-timeout", "number"
        attribute "entry-delay", "number"
        attribute "exit-delay", "number"
        attribute "abort-timeout", "number"
        
        command "home"
        command "stay"
        command "away"
        command "setMode"
        
        command "describeAttributes"
	}
}

// parse events into attributes
def parse(String description) {
}

def describeAttributes(payload) {
	payload.attributes = [
    	[ name: "system-status",	type: "enum",	options: ["Home", "Home Bypass", "Home ExitDelay", "Stay", "Stay AlarmPending", "Away", "Away AlarmPending", "Instant", "Instant AlarmPending"]	],
    	[ name: "digital-life-mode",	type: "enum",	options: ["Home", "Stay", "Instant", "Away"]	],
    ]
    return null
}

def configure(mode) {
	setMode(mode)
}

def setLevel(level) {
	if (level < 0) {
    	level = 0
    }
    if (level > 3) {
    	level = 3
    }
	switch (level) {
    	case 0:
        	home()
            break
    	case 1:
        	stay()
            break
    	case 2:
        	instant()
            break
    	default:
        	away()
            break
    }
}

def setMode(mode) {
	switch (mode.toLowerCase()) {
    	case 'home':
    	case 'disarm':
    	case 'disarmed':
    	case 'off':
        	home()
            break
    	case 'stay':
    	case 'night':
        	stay()
            break
    	case 'instant':
        	instant()
            break
    	case 'away':
        	away()
            break
    }
}

def on() {
	stay()
}

def off() {
	home()
}

def home() {
	parent.proxyCommand(device, 'digital-life-mode', 'Home');
}

def stay() {
	parent.proxyCommand(device, 'digital-life-mode', 'Stay');
}

def instant() {
	parent.proxyCommand(device, 'digital-life-mode', 'Instant');
}

def away() {
	parent.proxyCommand(device, 'digital-life-mode', 'Away');
}

Ok..... This is so weird... After Level settings on the dimmer level within the device a few times everything started working again.

If you still want to investigate the issue, you will probably need to post the parent app/driver. None of your methods in the driver update its attributes with a sendEvent. If there is anything in the parent that relies on a specific attribute value (level for example), you may run into issues.

I remember when I initially started porting drivers, HE was a bit more finicky about how it seemed to handle attribute values. I forget the details of the differences now, but I did have to make small changes.

1 Like

So this has happened again and as it turns out none of my device are showing state changes and even some of my automations are failing.

I started a thread last week about a slow hub, so I am wondering if these are related now.

You mentioned in the other thread that you had virtual drivers that were not showing state changes. Were you referring to the one above? Are there others?

Please provide the details of what drivers aren't updating (include code of one of them if possible) and what states in particular (on/off? .. custom attribute?).

As I mentioned before the driver above does not do any sendEvents that are necessary to update the states of the device. It is possible that the parent app/driver that it is talking to is doing the sendEvents but since we cannot see the code, we have no idea.

The other drivers I was referring to are stock drivers both virtual and non-virtual. IT seems like all of the devices are impacted at some level.

I just rebooted my hub and now the first device I tried "Zooz Power Switch" is working again.

Do you need me to list all of my device?

Nope...I misunderstood your previous posts. I thought that it was a bunch of virtual drivers that were not updating. However, if there is a poorly written driver or app that is slamming the hub with errors or loops, it could also manifest as missed events as well. It might be tricky to track down. Have you disabled the Echo Speaks and Digital life apps to see if there is improvement?

Yes. The hub was still slow and devices weren't updating. After disabling all of the apps it took 5 minutes or so for the hub to respond better, but the devices were still not responding. I rebooted and then all of my devices started updating.

The only thing that seemed to respond during this time was my hue devices.

After disabling the apps, it's always a good idea to reboot. If there is code stuck in a loop, it will continue until you reboot. Leave them disabled for a day or 2. If the hub stays stable, to enable them one at a time. If the hun becomes unresponsive again...you've found your culprit.

1 Like