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

Error while trying to enumerate devices

rboy1 opened this issue · comments

commented

When I try enumerate all devices it throws an error:

Error Object reference not set to an instance of an object

Also when enumerating subscriptions it gives and Error 403 Error calling ListSubscriptions

commented

Everything else is working, but devices are the key ones

commented

Error is coming from line 32 of devices.cs

if (STClient.GetAllDevices().Items?.Count > 0)

It looks like Items is null, the underlying SmartThingsNet library isn't able to enumerate

Updated SDK, this should now be resolved

commented

Yes that fixes one issue, but noticed another one causing a crash. Not all devices have rooms which is causing a crash in devices.cs line 153

roomName = STClient.GetAllRooms(device.LocationId).Items.Where(r => r.RoomId.ToString().Equals(device.RoomId))?.FirstOrDefault().Name;

commented

Fix here:
#33

commented

It works fine with your SDK update and the patch above. Will you be releasing a new version?

Your fixes are merged!