From 323bb83ef50c80b558a667fccb4d237b4130a664 Mon Sep 17 00:00:00 2001 From: Jamie D Date: Wed, 1 Jul 2020 21:04:44 +0100 Subject: [PATCH] Fix initial load --- README.md | 15 ++++++++++----- SmartThingsTerminal/Scenarios/Devices.cs | 7 ++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4e14acb..0565ccc 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ # Overview -SmartThings Terminal is a cross platform CLI tool for the SmartThings API, providing a simple GUI terminal for navigating devices and settings within your SmartThings environment. The functionality of this CLI is driven by the supporting [SmartThingsNet](https://github.com/daltskin/SmartThingsNet) dotnet sdk, which uses the underlying [SmartThings API](https://smartthings.developer.samsung.com/docs/api-ref/st-api.html). +SmartThings Terminal is a cross platform CLI tool for the SmartThings API, providing a simple GUI terminal for navigating devices and settings within your SmartThings environment. The functionality of this CLI is driven by the supporting [SmartThingsNet](https://github.com/daltskin/SmartThingsNet) dotnet sdk, which uses the underlying [SmartThings API](https://smartthings.developer.samsung.com/docs/api-ref/st-api.html). This tool is aimed at the SmartThings developer ecosystem to get quick insight into their smart home environments. # Features @@ -30,18 +30,23 @@ Simply run from your command prompt providing your access token. If you don't h ![screenshot](docs/pat.png) +## Command line + +Using the -t (or --accesstoken) argument, provide your personal access token from the above into the STT tool eg: + ```bash -./STT -t {GUID} +$ ./STT -t {accesstoken} ``` -Or you can jump straight into a specific screen by providing the screen name: + +Alternatively, you can jump straight into a specific screen by providing the screen name using the -s (or --screen) argument using one of the following values: | devices | installedapps | locations | rules | scenes | schedules | subscriptions | -example: +eg: ```bash -./STT -t {GUID} -s devices +$ ./STT -t {accesstoken} -s devices ``` diff --git a/SmartThingsTerminal/Scenarios/Devices.cs b/SmartThingsTerminal/Scenarios/Devices.cs index 2ec9c04..8fe921c 100644 --- a/SmartThingsTerminal/Scenarios/Devices.cs +++ b/SmartThingsTerminal/Scenarios/Devices.cs @@ -129,7 +129,12 @@ public override void Setup() if (_viewDevices.Count > 0) { - CurrentView = CreateJsonView(_viewDevices?.FirstOrDefault().Value?.ToJson()); + var firstItem = _viewDevices?.FirstOrDefault().Value; + if (firstItem != null) + { + CurrentView = CreateJsonView(firstItem.ToJson()); + UpdateSettings(firstItem); + } } }