Is there a problem with your servers?

I’m getting server timeouts and not seeing my log messages.

I get

8939625a-28c5-4a69-9ab7-763e1374cf48 8:38:28 PM: error java.util.concurrent.TimeoutException: Execution time exceeded 20 app execution seconds: 279654641403814 @ line 328
8939625a-28c5-4a69-9ab7-763e1374cf48 8:37:18 PM: error java.util.concurrent.TimeoutException: Execution time exceeded 20 app execution seconds: 279621418142158 @ line 328

When I request a listing of my “switch” devices. But other devices work but live logging is not showing me the messages from my app like it used to so I"m running blind. And how to I translate that GUID into the real source of the error,

This normally happens when A command gets stuck.

Is this custom code? If so I’d check that out. See what its doing st that time and why it might be getting stuck. Might be some sort of endless loop.

1 Like

The code has been running for months and works fine for device types other than “switch”. How can I send you a pointer to the code?

Send me the snippet you’re using to look up the switches.

maybe I can find a smoking gun :slight_smile:

Is there a way to attach a file?

You should be aBle to copy and paste it into the forum and block it as code

It’s 661 lines of code … not sure if the isolated parts make as much sense but… for now …

def _api_list() {
try {
	if (params.type == "ui") {
		return [msg: "ui is not a type"]
	//msg "_api_list for ${params.type}"
    def jx = _devices_for_type(params.type).collect{
		_device_to_json(it, params.type)
	return jx;
catch (e) {
	msg("_api_list error ${e}")
	return [msg: "Error ${e}"]


private _device_to_json(device, type) {
// msg("_device_to_json ${device} ${type}")
if (!device) {
return [“error”: “No Device”, “type”: type]

def vd = [:]
def cs = [:]
def ls = [:]
def jd = [id:,
	label: device.label,
	type: type,
	displayName: device.displayName,
	value: vd,
    current: cs,
	latest: ls,
	nid: device.deviceNetworkId];

// jd[“sa”] = device.supportedAttributes;
// jd[“sc”] = device.supportedCommands;


try {

// msg "Mapping over ${stateNames()}"
stateNames().each {
if (device.currentState(it)) cs[it] = device.currentState(it);
// if (device.latestState(it)) ls[it] = device.latestState(it);
catch (e) {
cs[‘error’] = e;

try {
	def s = device.currentState(type)
	vd['timestamp'] = s?.isoDate
	vd['value'] = s?.value
	vd['name'] = s?.name
	//vd['s'] = s; -- seems to sometimes screw-up posting?
	//vd['d'] = device
	//vd['supported'] = device.supportedAttributes
	if (s?.hasProperty('level')) vd['level'] = s?.level
	switch (type) {
		case "switch":
			vd['switch'] = s?.value == "on"
		case  "motion":
			vd['motion'] = s?.value == "active"
		case  "temperature":
			vd['temperature'] = s?.value.toFloat()
		case  "contact":
			vd['contact'] = s?.value == "closed"
		case  "acceleration":
			vd['acceleration'] = s?.value == "active"
		case  "presence":
			vd['presence'] = s?.value == "present"
		case  "battery":
		    def bat = s?.value?.toFloat();
			if (bat) bat /= 100.0;
			vd['battery'] = bat;
		case  "threeAxis":
			vd['x'] = s?.xyzValue?.x
			vd['y'] = s?.xyzValue?.y
			vd['z'] = s?.xyzValue?.z
		case "lock":
		// vd['rest'] = s?
		case "switchLevel":
			//vd['level'] = s?.level
			vd['level'] = device.currentValue('level')
		case "colorControl":
			vd['saturation'] = s?.saturation
			vd['hue'] = s?.hue
			vd['color'] = s?.color
			vd['switch'] = s?.switch
			vd['level'] = s?.level
		case "energyMeter":
			vd['energy'] = s?.energy
	    case "button":
		case "relaySwitch":
			msg("Unrecognized type ${type}")
} catch (e) {
	vd["Error"] = e;
	msg("Failure in device to JSON ${e}")
return jd;


Don’t see any issues glancing over it.

Can you comment out that line? Does it run then?

It runs fine for all device types other than “switch”. So my assumption is something is wrong in the land of SmartThings.

Probably not. Since I can’t see the entire code I’m having a hard time seeing what’s going on. I’d reach out to support.

ALready sent a note to support. I can send you all the code but you won’t find anything new. Given that it’s been running for months and broke without my touching anything and only for a certain class of functions and I get an error trying to look at the app on my phone it all points to a broken server.

If you’re curious here is a temporary link to look at a copy of the code!64225&authkey=!ADtcuzGe8BF7Dbk&ithint=file%2CGroovy

It seems to have started working again spontaneously.

1 Like