daltskin / SmartThingsTerminal

SmartThings Terminal is a cross platform CLI tool for the SmartThings API - interact with your smart home from the command line.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Key devices on id not name

daltskin opened this issue · comments

It's not crashing anymore but it gives the following error:

Unknown error calling API: An item with the same key has already been added.
Key: XXX iPhone

Originally posted by @rboy1 in #6 (comment)

commented

This is an issue with the ST new app. It automatically creates a mobile presence device but it doesn’t show the device and hence there’s no way to change the name.
So if you’re using the Classic app and the new app at the same time ST will create two presence sensors with the same name.

If you’re creating a map consider using the device ID instead which is unique.

commented

It working now but it's still crashes on other operations. Here are 2 instances:

  1. When I click on full screen and then I click on a menu item using a mouse

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at SmartThingsTerminal.Scenarios.Devices.UpdateSettings[T](Object selectedItem)
at SmartThingsTerminal.Scenario.<>c__DisplayClass68_01.<GetClassListView>b__0(ListViewItemEventArgs args) at Terminal.Gui.ListView.OnSelectedChanged() at Terminal.Gui.ListView.MouseEvent(MouseEvent me) at Terminal.Gui.View.OnMouseEvent(MouseEvent mouseEvent) at Terminal.Gui.Application.ProcessMouseEvent(MouseEvent me) at Terminal.Gui.WindowsDriver.Terminal.Gui.IMainLoopDriver.MainIteration() at Terminal.Gui.MainLoop.MainIteration() at Terminal.Gui.Application.RunLoop(RunState state, Boolean wait) at Terminal.Gui.Application.Run(Toplevel view, Boolean closeDriver) at SmartThingsTerminal.Scenario.Run() at SmartThingsTerminal.Program.Init(Options opts) at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult1 result, Action`1 action)
at SmartThingsTerminal.Program.Main(String[] args)

  1. When keep the down arrow key pressed to scroll through the devices quickly:

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at SmartThingsTerminal.Scenarios.Devices.UpdateSettings[T](Object selectedItem)
at SmartThingsTerminal.Scenario.<>c__DisplayClass68_01.<GetClassListView>b__0(ListViewItemEventArgs args) at Terminal.Gui.ListView.OnSelectedChanged() at Terminal.Gui.ListView.MoveDown() at Terminal.Gui.ListView.ProcessKey(KeyEvent kb) at Terminal.Gui.View.ProcessKey(KeyEvent keyEvent) at Terminal.Gui.View.ProcessKey(KeyEvent keyEvent) at Terminal.Gui.Toplevel.ProcessKey(KeyEvent keyEvent) at Terminal.Gui.View.ProcessKey(KeyEvent keyEvent) at Terminal.Gui.Toplevel.ProcessKey(KeyEvent keyEvent) at Terminal.Gui.Application.ProcessKeyEvent(KeyEvent ke) at Terminal.Gui.WindowsDriver.Terminal.Gui.IMainLoopDriver.MainIteration() at Terminal.Gui.MainLoop.MainIteration() at Terminal.Gui.Application.RunLoop(RunState state, Boolean wait) at Terminal.Gui.Application.Run(Toplevel view, Boolean closeDriver) at SmartThingsTerminal.Scenario.Run() at SmartThingsTerminal.Program.Init(Options opts) at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult1 result, Action`1 action)
at SmartThingsTerminal.Program.Main(String[] args)

I also noticed that when the full screen button is pressed on the command prompt the console goes full screen but it the cursor loses track/context of it's location which then renders it unsable until you quit and restart again.

commented

Hmm, I think I know why the second crash is happening. It's not the keypress but when it reached some devices it crashes. I have multiple locations in my account, if I select a device from a different location (any device) it crashes with this trace )this one happened when I used a mouse to select a device in a non default location:

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at SmartThingsTerminal.Scenarios.Devices.UpdateSettings[T](Object selectedItem)
at SmartThingsTerminal.Scenario.<>c__DisplayClass68_01.<GetClassListView>b__0(ListViewItemEventArgs args) at Terminal.Gui.ListView.OnSelectedChanged() at Terminal.Gui.ListView.MouseEvent(MouseEvent me) at Terminal.Gui.View.OnMouseEvent(MouseEvent mouseEvent) at Terminal.Gui.Application.ProcessMouseEvent(MouseEvent me) at Terminal.Gui.WindowsDriver.Terminal.Gui.IMainLoopDriver.MainIteration() at Terminal.Gui.MainLoop.MainIteration() at Terminal.Gui.Application.RunLoop(RunState state, Boolean wait) at Terminal.Gui.Application.Run(Toplevel view, Boolean closeDriver) at SmartThingsTerminal.Scenario.Run() at SmartThingsTerminal.Program.Init(Options opts) at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult1 result, Action`1 action)
at SmartThingsTerminal.Program.Main(String[] args)

@rboy1 thanks for raising this. However, I've not been able to recreate this issue today - I also have multiple locations (2).

I've added some additional error handling and creating a new issue to track this: #13 - so the next release will hopefully address this (lmk if it doesn't).

commented

I only see the osx binary builds for 0.12.4 and don't see any win 10 builds

Builds are now available.

commented

Working fine now, no crashes and the data is showing up. On suggestion, it would be nice to sort the list by name since with 300 devices it can get cumbersome to locate them

@rboy1 Thanks for the feedback - just done this tonight in the latest release :)