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,
tslagle13
(Tim Slagle)
April 25, 2015, 12:59am
2
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?
tslagle13
(Tim Slagle)
April 25, 2015, 1:19am
4
Send me the snippet you’re using to look up the switches.
maybe I can find a smoking gun
Is there a way to attach a file?
tslagle13
(Tim Slagle)
April 25, 2015, 1:50am
6
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: device.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;
// https://graph.api.smartthings.com/ide/doc/state
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"
break
case "motion":
vd['motion'] = s?.value == "active"
break
case "temperature":
vd['temperature'] = s?.value.toFloat()
break
case "contact":
vd['contact'] = s?.value == "closed"
break
case "acceleration":
vd['acceleration'] = s?.value == "active"
break
case "presence":
vd['presence'] = s?.value == "present"
break
case "battery":
def bat = s?.value?.toFloat();
if (bat) bat /= 100.0;
vd['battery'] = bat;
break
case "threeAxis":
vd['x'] = s?.xyzValue?.x
vd['y'] = s?.xyzValue?.y
vd['z'] = s?.xyzValue?.z
break
case "lock":
// vd['rest'] = s?
break
case "switchLevel":
//vd['level'] = s?.level
vd['level'] = device.currentValue('level')
break;
case "colorControl":
vd['saturation'] = s?.saturation
vd['hue'] = s?.hue
vd['color'] = s?.color
vd['switch'] = s?.switch
vd['level'] = s?.level
break;
case "energyMeter":
vd['energy'] = s?.energy
break;
case "button":
break;
case "relaySwitch":
break;
default:
msg("Unrecognized type ${type}")
}
} catch (e) {
vd["Error"] = e;
msg("Failure in device to JSON ${e}")
}
return jd;
}
tslagle13
(Tim Slagle)
April 25, 2015, 2:09am
8
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.
tslagle13
(Tim Slagle)
April 25, 2015, 3:04am
10
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.
It seems to have started working again spontaneously.
1 Like