Issue recognizing held button events


#1

I’ve updated several DTH’s mainly for Jasco switches, to fix button press issues and make them compatible with the new SmartThings app and smartlighting app. The new app requires button action values, like “pushed” or “held” to be stored as a JSON object now (see developer doc here https://smartthings.developer.samsung.com/docs/api-ref/capabilities.html )

supportedButtonValues

List of valid button attribute values

  • *Type: ** JSON_OBJECT * *Required: ** Yes

Webcore does not appear to be fully compatible with this JSON button value. A simple piston based on a button being held is failing

The log shows what is pasted below - the held event triggers the piston, but the line “is held” = “is held” is evaluating as false for some reason, when it really is true. Anyone have any idea what’s going wrong here? I have another DTH that is just “pushed” with no held that works fine. It seems having the two values together on one button is messing up webcore. Log:

+2ms	╔Received event [Living room lamp].button = held with a delay of 166ms
+44ms	║RunTime Analysis CS > 20ms > PS > 8ms > PE > 16ms > CE
+46ms	║Runtime (37539 bytes) successfully initialized in 8ms (v0.3.110.20191009) (44ms)
+47ms	║╔Execution stage started
+57ms	║║Comparison (enum) held gets (string) held = false (3ms)
+58ms	║║Condition #2 evaluated false (7ms)
+59ms	║║Condition group #1 evaluated false (state did not change) (8ms)
+61ms	║╚Execution stage complete. (14ms)
+62ms	╚Event processed successfully (62ms)

#2

Is buttonNumber definitely set to 2 in the event data? It may be checking the index at the same time as the value but just not mentioning it in the log.


#3

I just checked that and that was it - buttons got reversed my switch got inverted while I was changing settings around. Boy do I feel silly, lol. Its working fine now.