SmartThings Integration Problem - cannot add entries

I had to redo the SmartThings integration and cannot getting it to work.

Deleted the database, devices file, ran the removal app successfully. It does add the integration but I get the following error

Traceback (most recent call last):

  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 217, in async_setup

    hass, self

  File "/usr/src/homeassistant/homeassistant/components/smartthings/__init__.py", line 127, in async_setup_entry

    devices = await api.devices(location_ids=[installed_app.location_id])

  File "/usr/local/lib/python3.7/site-packages/pysmartthings/smartthings.py", line 88, in devices

    return [DeviceEntity(self._service, entity) for entity in resp]

  File "/usr/local/lib/python3.7/site-packages/pysmartthings/smartthings.py", line 88, in <listcomp>

    return [DeviceEntity(self._service, entity) for entity in resp]

  File "/usr/local/lib/python3.7/site-packages/pysmartthings/device.py", line 656, in __init__

    self.apply_data(data)

  File "/usr/local/lib/python3.7/site-packages/pysmartthings/device.py", line 93, in apply_data

    self._type = data["type"]

KeyError: 'type'

The smartthings devices do not get added to the environment. Any ideas would be appreciated

1 Like

@Michael_Azzopardi I am having the exact same issue. I had to redo my SmartThings integration this morning and I ran into that problem.

I have tried deleting and adding the integration several times, all with the same result.

FWIW: I spun up a docker image with the latest 0.114.4 and it was working there.

My other image was 0.112.5 and I was unable to upgrade it past that version with pip3 as that was the highest version available.

Follow-up: @Michael_Azzopardi I reverted from my Docker setup as I’m running it on a Mac and I don’t have the needed network access in Docker.

Since PIP isn’t allowing me to install past 0.112.5 I went to Github and grabbed the component code for SmartThings and added it to “custom_components” for my instance and reran it. Once I did this everything came back online.

I hope this helps you out.

Hi, I’m having this same issue but I don’t understand how you went about working around it. Could you explain how and what you did for a newbie whose new to both Home Assistant and programming as a whole?

@AkshatShah1 what version of Home Assistant are you running?

How do you maintain your configuration for Home Assistant, via the internet browser or via configuration files in the Home Assistant config folder?

I typically use the web interface but I do have the Samba addon configured so I do have access to the config folder if necessary.

You’ll need to download the source code for Home Assistant core to get the component. Most likely the easiest way to do this is to go to the following URL and click the green “Code” button and select “Download Zip”. https://github.com/home-assistant/core

Once this is downloaded unzip the code then navigate to the components folder. The path will be like homeassistant -> components -> smartthings

Keep this folder open and then open the configurations folder for Home Assistant, this is the root folder for where the configurations are (you'll know you're in the correct folder if you see your configuration.yaml file). Once there create a new folder called custom_components.

Now copy the smartthings folder, from the Home Assistant code you downloaded earlier, into the custom_components folder. You should see the smartthings folder inside of the custom_components folder now.

Once you’ve done this you should be able to restart your Home Assistant instance and you should now be using the code that you downloaded.

An important note: This is a band-aid solution and every time you update, in the future, you’ll want to remove (a rename might work) this folder to test if the problem was solved in the update. The MAJOR problem with solution is that it overrides the built-in component with the code you have locally, and unless you plan on downloading the code with future updates then you’ll not get the latest updates.

Thank you so much for your incredibly detailed response! However I guess I just got lucky as when I launched the Home Assistant web interface, I saw that there was a core update and after installing it, my smartthings devices showed up!

@AkshatShah1 that makes it a lot easier then :slight_smile:

Happy automating!

Yes it does and thank you, you too!

1 Like