Device events() method cannot get all types of events

I write a SmartApp to retrieve device events by using the and use the evt.descriptionText and evt.description to get the event description.

def event_list =

// subscribe more than one contact sensors
for ( int i=0; i < event_list.size(); i++) 
{     for (int j=0; j < event_list[i].size(); j++)
      {   log.debug "${event_list[i][j].descriptionText}"
          log.debug "${event_list[i][j].description}"

For my SmartSense Multi sensors, the description method returns

contactState: 1, accelerationState: 0, temp: 199, battery: 1C, rssi: 64, lqi: 255

while the descriptionText returns only

MySmartSenseMulti1 was 20°C.

By using the method, all the events from the events() method are only the temperature events. The IDE -> My Device -> MySmartSenseMulti -> List Event, the event name shows not only the temperature, but also include lqi, rssi, battery.

Is it possible to get all event history not only one type of event? Or is there any device method can translate the content of description into description text. (I’ve tried to use myDevice.parse(str), but it encountered method/property not support error during runtime.

Hi Wan_Rong_Jih, I don’t know Groovy very well so take that into account when reading my words (they may be worthless). Is your valid code? The for loop looks like it’s missing something. Like a definition for event_list[i], then then something similar for the second J loop.

for (i = 0; i <3; i++) {
   System.out.println("Hello World")

Yours looks like this:

    def event_list =

    // subscribe more than one contact sensors
    for (int i=0; i {
        for (int j=0; j { 
            log.debug "${event_list[i][j].descriptionText}"
            log.debug "${event_list[i][j].description}"

I’d say that Groovy is giving you exactly what you are asking for, log entries of event_list[0][0]. I think you need to define the for loops differently. Sorry i couldn’t be of more help at this time.

Thanks @ncherry . Despite the mistake of copy/paste (the code has been corrected, it caused by the ‘<’ need space to show.). Either SmartApp IDE editor or the live logging does not have any error about my code, but the results of descriptionText do not fully translate the values of description.

Could anyone help me to get the full description of event logs?

I still cannot get all the event types, nor parse the description to full description text. Anyone could help?

After check events on my phone, I know why the descriptionText can only display the temperature event for SmartSense Multi. As the descriptionText returns the description of the event that is to be displayed to the user in the mobile application and the temperature event is the only type of event that SmartSense Multi on mobile devices.

Hi Wan_Rong_Jih,
I am trying to get all events from history and trying to display decriptionText in mobile.

i have used your code:
def event_list = //here i am getting list of event in below format

event_list =[[,,,,,,,,,], [,,,,,,,,,]]

for ( int i=0; i < event_list.size(); i++)
{ for (int j=0; j < event_list[i].size(); j++)
{ log.debug "${event_list[i][j].descriptionText}"
log.debug “${event_list[i][j].description}”
java.lang.NullPointerException: Cannot invoke method size() on null object @ line 155

Could you please help on this?

My code is a partial of SmartApp…
It seems that the Definition section and Preference section are missed.
SmartThings API documents will show you the SmartApp structure.

I just copy pasted a part of my smartapp…

Do you have any idea ? how to parse the event list?

Ex logs:

If you read SmartThings Developer Documents thoroughly, you will get the results successfully.

I do not understand the meaning of “how to parse the event list?” Do you mean parsing the returned event string? If it is, it’s hard for SmartApp to perform grammar/syntax parse, you should download the results and parsing them on your local machine.

Yes, parsing the returned event string
Thank you for your reply.