Smartthings CLI history export problem

Hello,

I’m trying to export the history with the Smartthings CLI with no luck. I’m just getting a file with just a pair of curly brackets.

smartthings devices:history deviceID -L 100 -j -o test.json

Any ideas what could be going on?

Yes, it is:

devices:history

I think you might have a old version of the CLI. The latest version is 1.1.2 and was released at the end of January. The history has been there a lot longer than that though.

1 Like

Doing it for me too. OK with API. I’ll log it as a bug.

It was driving me crazy.

The bug has been fixed in the latest version (1.1.3) which was released earlier today.

Thanks, do you know a way to output the history as it does on terminal?

I haven’t found a useful way of doing it, no.

You mean something like this?

bep@debian10:~$ smartthings devices:history 95130d4e-f4ee-4c39-b624-ad6013361692
────────────────────────────────────────────────────────────────────────────────────────────────────
 Time                    Component  Capability                           Attribute       Value      
────────────────────────────────────────────────────────────────────────────────────────────────────
 3/24/2023, 3:47:55 PM   main       platinummassive43262.unlockCodeName  unlockCodeName  "Locked"   
 3/24/2023, 3:47:55 PM   main       lock                                 lock            "locked"   
 3/24/2023, 3:45:44 PM   main       platinummassive43262.unlockCodeName  unlockCodeName  "manual"   
 3/24/2023, 3:45:43 PM   main       lock                                 lock            "unlocked" 
 3/24/2023, 12:59:12 PM  main       platinummassive43262.unlockCodeName  unlockCodeName  "Locked"   
────────────────────────────────────────────────────────────────────────────────────────────────────

Yes, I do.

Looks like the CLI itself does the formatting of the JSON when the output location is standard out. Whether I pipe it through tee, use the -o option, or direct standard out to a file, it always comes out as JSON.

Could this be requested? It’s much easier to use sed or awk with it than with JSON or YAML.

I’m sure you can put in a feature request.

I don’t have a github account so I can’t.