All Zigbee buttons showing 0% Batteries (7 September 2018) Solved

Release notes on the Apache Groovy site are here if anyone’s wondering.

What I’m wondering…

The Apache site lists 2.5.2 as the latest 2.5.x build. Is there a SmartThings-specific release notes for yesterday’s update that would cover changes most likely to affect ST device handlers and SmartApps?

2.5.6 Grails
2.4.10 Groovy

Big changes to JsonSlurper (use the JsonSlurperClassic if you’re having issues) but I believe that ST’s engineers are taking care of most differences internally for the transition to be smooth but if you do come across an issue post it back here.

4 Likes

Hi RBoy this has gone over my head, all I know is this line

def body = new groovy.json.JsonSlurper().parseText(parsedEvent.body)

Isn’t giving me the result it used too

Can you post the contents of parsedEvent.body

Its a Philips hue bridge

https://pastebin.com/raw/L4mcVB78

You can try using:

def body = new groovy.json.JsonSlurperClassic().parseText(parsedEvent.body)

What exactly is the issue? I don’t see any obvious issues.

1 Like

yup I worked that bit out about a hour ago
had to change this

def itemDiscoveryHandler(evt) {

 	logMessage("evt = ${evt}", "trace")
    def bulbs = evt.jsonData[0]
    def scenes = evt.jsonData[1]
    def groups = evt.jsonData[2]
    def schedules = evt.jsonData[3]
    def mac = evt.jsonData[4]

to

def itemDiscoveryHandler(evt) {
	
	def data = parseJson(evt.data)
	logMessage("evt = ${data}", "trace")
    
    def bulbs = data[0]
    def scenes = data[1]
    def groups = data[2]
    def schedules = data[3]
    def mac = data[4]

Its not my code originally but to me I’m surprised it ever worked
But its working again and thats all that matters cheers for your help would never of worked it out if you hadnt posted about the classic json function a few hours ago.

1 Like

Since I can’t replicate the evt here can you post back what’s the difference being reported/printed between evt.jsonData and parseJson(evt.data)

Tagging @Brad_ST and @gausnes FYR

Should evt.jsonData be different from parseJson(evt.data)?

with the original code i get the following in IDE

5c7e145a-165a-47cb-992f-b74a756c8c10 1:01:11 AM: error org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '[{1={id=1, label=Spare Room 1, state={alert=none, bri=178, mode=homeautomation, on=false, reachable=true}, type=Dimmable light}, 10={id=10, label=Office 3, state={alert=none, bri=178, mod…[TRUNCATED]

5c7e145a-165a-47cb-992f-b74a756c8c10 1:01:11 AM: trace evt = physicalgrap…[TRUNCATED]

I think jsonData has been made defunct and possibly because of this casting may not be handled by the platform now.

Maybe Luke or Brad can confirm.

EDIT: This may be of significance since many apps like CoRE and WebCoRE also still use evt.jsonData

Are you still seeing GroovyCastException? We patched an issue introduced on Thursday that affected community developed SmartApps and DeviceTypeHandlers late last night. This is what I’m seeing

2 Likes

If I still use the code posted above in my smartapp I still get the following error

error org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object

1 Like

Is this happening on a DeviceTypeHandler, if so we did not patch the cluster that handles events for community developed DeviceTypeHandlers? Could you send me your username I would like to look at the error messages that your account is generating.

My nyce hinge sensors have been bouncning between 0% and 100% since this issue first cropped up.

1 Like