home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.23k stars 30.58k forks source link

SmartThings Integration stopped working #24649

Closed Crepetsky closed 5 years ago

Crepetsky commented 5 years ago

Home Assistant release with the issue: 0.94.4

Last working Home Assistant release (if known): 0.94.4

Operating environment (Hass.io/Docker/Windows/etc.): Hass.io running on Raspberry Pi 3B+

Component/platform: SmartThings Integration ( https://www.home-assistant.io/components/smartthings/ )

Today, when I checked Lovelace, all of my devices connected through SmartThings were being reported as "Entity not Available". I tried restarting both Home Assistant and the Pi that it's running on. I decided to re-install the SmartThings integration to see if that worked. I utilized the Removal Tool ( https://pypi.org/project/hass-smartthings-remove/ ) to ensure everything was properly taken out. I created a new key and was able to add the Smart App to my SmartThings Classic App. However, when I click on the Smart App, it says "Something's Wrong. We can't load your screen right now." And Home Assistant still shows none of the previously controllable entries.

I made sure that my certificates and base URL are both accessible from the outside world (they always have been, and nothing has changed.) I have otherwise made no changes to the system prior to this issue, so I am very puzzled at this point. I enabled Debugging for the SmartThings integration, and the errors are shown below:

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

Traceback (if applicable):

Error setting up entry Home for smartthings
ValueError: 'VIPER' is not a valid DeviceType

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 273, in async_setup
    hass, self)
  File "/usr/src/homeassistant/homeassistant/components/smartthings/__init__.py", line 101, in async_setup_entry
    location_ids=[installed_app.location_id])
  File "/usr/local/lib/python3.7/site-packages/pysmartthings/smartthings.py", line 77, in devices
    return [DeviceEntity(self._service, entity) for entity in resp]
  File "/usr/local/lib/python3.7/site-packages/pysmartthings/smartthings.py", line 77, in <listcomp>
    return [DeviceEntity(self._service, entity) for entity in resp]
  File "/usr/local/lib/python3.7/site-packages/pysmartthings/device.py", line 650, in __init__
    self.apply_data(data)
  File "/usr/local/lib/python3.7/site-packages/pysmartthings/device.py", line 93, in apply_data
    self._type = DeviceType(data['type'])
  File "/usr/local/lib/python3.7/enum.py", line 310, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.7/enum.py", line 564, in __new__
    raise exc

Additional information: As stated above, I didn't make any changes to the system before this occurred, so I'm not sure what caused. Any insight would be much appreciated!

ghost commented 5 years ago

Hey there @andrewsayre, mind taking a look at this issue as its been labeled with a integration (smartthings) you are listed as a codeowner for? Thanks!

This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people.

andrewsayre commented 5 years ago

What the heck is a device type VIPER? The only valid types for type are DTH or ENDPOINT...

Can you share the output of this command? It will help identify what device is having that rogue type, perhaps you can then remove it or we can update the library to ignore it.

curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" https://api.smartthings.com/v1/devices

The output is not sensitive, so you don't need to worry about redacting any of the IDs.

Crepetsky commented 5 years ago

Apologies for the giant block of text, it spit it out exactly as formatted below.

{"items":[{"deviceId":"02b5cbd9-5906-4995-94fc-b0a170bd8309","name":"Sengled Element Classic","lab                                                                                            el":"Study Light 1","locationId":"c6358051-231c-49f3-90f0-d09f9cc884d2","roomId":"902ca7f6-ff9a-42                                                                                            af-9432-55399b9582fc","deviceTypeId":"52969956-9ba8-46ba-873e-1bb46cfef033","deviceTypeName":"ZigB                                                                                            ee Dimmer","deviceNetworkType":"ZIGBEE","components":[{"id":"main","capabilities":[{"id":"switch",                                                                                            "version":1},{"id":"configuration","version":1},{"id":"switchLevel","version":1},{"id":"refresh","                                                                                            version":1},{"id":"actuator","version":1},{"id":"healthCheck","version":1},{"id":"light","version"                                                                                            :1}]}],"dth":{"deviceTypeId":"52969956-9ba8-46ba-873e-1bb46cfef033","deviceTypeName":"ZigBee Dimme                                                                                            r","deviceNetworkType":"ZIGBEE","completedSetup":true,"networkSecurityLevel":"UNKNOWN","hubId":"60                                                                                            aa38d8-dfb4-4605-9e3f-40fdcfc912a5"},"type":"DTH"},{"deviceId":"0473c5c0-fdae-4a62-9000-b57af9218a                                                                                            65","name":"c2c-rgbw-color-bulb","label":"Desk Lamp","locationId":"c6358051-231c-49f3-90f0-d09f9cc                                                                                            884d2","roomId":"902ca7f6-ff9a-42af-9432-55399b9582fc","components":[{"id":"main","capabilities":[                                                                                            {"id":"switch","version":1},{"id":"switchLevel","version":1},{"id":"colorControl","version":1},{"i                                                                                            d":"colorTemperature","version":1},{"id":"refresh","version":1},{"id":"healthCheck","version":1}]}                                                                                            ],"profile":{"id":"4d24a797-e0c0-45ad-8725-04aa6eb2eeb1"},"viper":{},"type":"VIPER"},{"deviceId":"                                                                                            07e2e120-9f44-4383-8110-c91502ccab07","name":"Sengled Element Classic","label":"Hall Light","locat                                                                                            ionId":"c6358051-231c-49f3-90f0-d09f9cc884d2","roomId":"28b9f917-af9a-40c0-9113-154bf8274b94","dev                                                                                            iceTypeId":"52969956-9ba8-46ba-873e-1bb46cfef033","deviceTypeName":"ZigBee Dimmer","deviceNetworkT                                                                                            ype":"ZIGBEE","components":[{"id":"main","capabilities":[{"id":"switch","version":1},{"id":"config                                                                                            uration","version":1},{"id":"switchLevel","version":1},{"id":"refresh","version":1},{"id":"actuato                                                                                            r","version":1},{"id":"healthCheck","version":1},{"id":"light","version":1}]}],"dth":{"deviceTypeI                                                                                            d":"52969956-9ba8-46ba-873e-1bb46cfef033","deviceTypeName":"ZigBee Dimmer","deviceNetworkType":"ZI                                                                                            GBEE","completedSetup":true,"networkSecurityLevel":"UNKNOWN","hubId":"60aa38d8-dfb4-4605-9e3f-40fd                                                                                            cfc912a5"},"type":"DTH"},{"deviceId":"0b3d1361-1cd3-4fe8-a344-9b859d288a7a","name":"HS105","label"                                                                                            :"Plant Light","locationId":"c6358051-231c-49f3-90f0-d09f9cc884d2","roomId":"902ca7f6-ff9a-42af-94                                                                                            32-55399b9582fc","deviceTypeId":"2acbeff5-f018-4404-bb1d-107496daec9f","deviceTypeName":"TP-Link S                                                                                            mart Plug","deviceNetworkType":"UNKNOWN","components":[{"id":"main","capabilities":[{"id":"switch"                                                                                            ,"version":1},{"id":"refresh","version":1},{"id":"healthCheck","version":1}]}],"dth":{"deviceTypeI                                                                                            d":"2acbeff5-f018-4404-bb1d-107496daec9f","deviceTypeName":"TP-Link Smart Plug","deviceNetworkType                                                                                            ":"UNKNOWN","completedSetup":true,"networkSecurityLevel":"UNKNOWN","hubId":"60aa38d8-dfb4-4605-9e3                                                                                            f-40fdcfc912a5"},"type":"DTH"},{"deviceId":"1506af9d-37c0-4e46-9cfc-c495bc6f3d6f","name":"Multipur                                                                                            pose Sensor","label":"Back Door Sensor","locationId":"c6358051-231c-49f3-90f0-d09f9cc884d2","roomI                                                                                            d":"343b7e5f-7787-407d-a03d-ef252a6ff00d","deviceTypeId":"52517166-43f9-4cbf-8bc2-7da4e8df5614","d                                                                                            eviceTypeName":"SmartSense Multi Sensor","deviceNetworkType":"ZIGBEE","components":[{"id":"main","                                                                                            capabilities":[{"id":"temperatureMeasurement","version":1},{"id":"battery","version":1},{"id":"con                                                                                            tactSensor","version":1},{"id":"configuration","version":1},{"id":"threeAxis","version":1},{"id":"                                                                                            accelerationSensor","version":1},{"id":"refresh","version":1},{"id":"sensor","version":1},{"id":"h                                                                                            ealthCheck","version":1}]}],"dth":{"deviceTypeId":"52517166-43f9-4cbf-8bc2-7da4e8df5614","deviceTy                                                                                            peName":"SmartSense Multi Sensor","deviceNetworkType":"ZIGBEE","completedSetup":true,"networkSecur                                                                                            ityLevel":"UNKNOWN","hubId":"60aa38d8-dfb4-4605-9e3f-40fdcfc912a5"},"type":"DTH"},{"deviceId":"164                                                                                            cda7a-8428-4843-8e3c-6a57d1b9bbcd","name":"Sengled Element Classic","label":"Bedroom Light 1","loc                                                                                            ationId":"c6358051-231c-49f3-90f0-d09f9cc884d2","roomId":"fce73b02-6249-45c9-83dc-f6d80aed2aa7","d                                                                                            eviceTypeId":"52969956-9ba8-46ba-873e-1bb46cfef033","deviceTypeName":"ZigBee Dimmer","deviceNetwor                                                                                            kType":"ZIGBEE","components":[{"id":"main","capabilities":[{"id":"switch","version":1},{"id":"conf                                                                                            iguration","version":1},{"id":"switchLevel","version":1},{"id":"refresh","version":1},{"id":"actua                                                                                            tor","version":1},{"id":"healthCheck","version":1},{"id":"light","version":1}]}],"dth":{"deviceTyp                                                                                            eId":"52969956-9ba8-46ba-873e-1bb46cfef033","deviceTypeName":"ZigBee Dimmer","deviceNetworkType":"                                                                                            ZIGBEE","completedSetup":true,"networkSecurityLevel":"UNKNOWN","hubId":"60aa38d8-dfb4-4605-9e3f-40                                                                                            fdcfc912a5"},"type":"DTH"},{"deviceId":"2ecd1bed-ab50-4833-a113-26b68fb4d521","name":"HS105","labe                                                                                            l":"Octopi","locationId":"c6358051-231c-49f3-90f0-d09f9cc884d2","roomId":"902ca7f6-ff9a-42af-9432-                                                                                            55399b9582fc","deviceTypeId":"2acbeff5-f018-4404-bb1d-107496daec9f","deviceTypeName":"TP-Link Smar                                                                                            t Plug","deviceNetworkType":"UNKNOWN","components":[{"id":"main","capabilities":[{"id":"switch","v                                                                                            ersion":1},{"id":"refresh","version":1},{"id":"healthCheck","version":1}]}],"dth":{"deviceTypeId":                                                                                            "2acbeff5-f018-4404-bb1d-107496daec9f","deviceTypeName":"TP-Link Smart Plug","deviceNetworkType":"                                                                                            UNKNOWN","completedSetup":true,"networkSecurityLevel":"UNKNOWN","hubId":"60aa38d8-dfb4-4605-9e3f-4                                                                                            0fdcfc912a5"},"type":"DTH"},{"deviceId":"367b886d-077e-49f3-9e2a-8f41449f131b","name":"KL130","lab                                                                                            el":"Bed Light","locationId":"c6358051-231c-49f3-90f0-d09f9cc884d2","roomId":"902ca7f6-ff9a-42af-9                                                                                            432-55399b9582fc","deviceTypeId":"18b81a19-8f36-4945-b8c2-7d4dde5d977f","deviceTypeName":"TP-Link                                                                                             Smart Color Bulb","deviceNetworkType":"UNKNOWN","components":[{"id":"main","capabilities":[{"id":"                                                                                            switch","version":1},{"id":"switchLevel","version":1},{"id":"refresh","version":1},{"id":"colorCon                                                                                            trol","version":1},{"id":"colorTemperature","version":1},{"id":"healthCheck","version":1},{"id":"c                                                                                            olorMode","version":1}]}],"dth":{"deviceTypeId":"18b81a19-8f36-4945-b8c2-7d4dde5d977f","deviceType                                                                                            Name":"TP-Link Smart Color Bulb","deviceNetworkType":"UNKNOWN","completedSetup":true,"networkSecur                                                                                            ityLevel":"UNKNOWN","hubId":"60aa38d8-dfb4-4605-9e3f-40fdcfc912a5"},"type":"DTH"},{"deviceId":"3e2                                                                                            579c7-4d52-457c-a9e2-5717a3318039","name":"Sengled Element Classic","label":"Bedroom Light 2","loc                                                                                            ationId":"c6358051-231c-49f3-90f0-d09f9cc884d2","roomId":"fce73b02-6249-45c9-83dc-f6d80aed2aa7","d                                                                                            eviceTypeId":"52969956-9ba8-46ba-873e-1bb46cfef033","deviceTypeName":"ZigBee Dimmer","deviceNetwor                                                                                            kType":"ZIGBEE","components":[{"id":"main","capabilities":[{"id":"switch","version":1},{"id":"conf                                                                                            iguration","version":1},{"id":"switchLevel","version":1},{"id":"refresh","version":1},{"id":"actua                                                                                            tor","version":1},{"id":"healthCheck","version":1},{"id":"light","version":1}]}],"dth":{"deviceTyp                                                                                            eId":"52969956-9ba8-46ba-873e-1bb46cfef033","deviceTypeName":"ZigBee Dimmer","deviceNetworkType":"                                                                                            ZIGBEE","completedSetup":true,"networkSecurityLevel":"UNKNOWN","hubId":"60aa38d8-dfb4-4605-9e3f-40                                                                                            fdcfc912a5"},"type":"DTH"},{"deviceId":"5f154d2c-b44d-4994-837c-6d3d4538b019","name":"c2c-switch",                                                                                            "label":"Monitors","locationId":"c6358051-231c-49f3-90f0-d09f9cc884d2","roomId":"902ca7f6-ff9a-42a                                                                                            f-9432-55399b9582fc","components":[{"id":"main","capabilities":[{"id":"switch","version":1},{"id":                                                                                            "refresh","version":1},{"id":"healthCheck","version":1}]}],"profile":{"id":"7eaca7e4-dd01-4711-8e2                                                                                            0-1a869bb44b1b"},"viper":{},"type":"VIPER"},{"deviceId":"853752d4-088d-4bd2-90d2-8e920890ae66","na                                                                                            me":"c2c-switch","label":"Plant Light","locationId":"c6358051-231c-49f3-90f0-d09f9cc884d2","roomId                                                                                            ":"65c27859-4dac-4eb3-be59-09f7f01cf37a","components":[{"id":"main","capabilities":[{"id":"switch"                                                                                            ,"version":1},{"id":"refresh","version":1},{"id":"healthCheck","version":1}]}],"profile":{"id":"7e                                                                                            aca7e4-dd01-4711-8e20-1a869bb44b1b"},"viper":{},"type":"VIPER"},{"deviceId":"a35a5955-c5c2-4d52-a2                                                                                            6b-c3116efa8d6b","name":"c2c-switch","label":"3D Printer","locationId":"c6358051-231c-49f3-90f0-d0                                                                                            9f9cc884d2","roomId":"704a0a70-b22a-4a81-aa0b-08729061f24d","components":[{"id":"main","capabiliti                                                                                            es":[{"id":"switch","version":1},{"id":"refresh","version":1},{"id":"healthCheck","version":1}]}],                                                                                            "profile":{"id":"7eaca7e4-dd01-4711-8e20-1a869bb44b1b"},"viper":{},"type":"VIPER"},{"deviceId":"b3                                                                                            1f1d85-2f56-42b4-9d4e-3ceb313157d6","name":"HS105","label":"Monitors","locationId":"c6358051-231c-                                                                                            49f3-90f0-d09f9cc884d2","roomId":"902ca7f6-ff9a-42af-9432-55399b9582fc","deviceTypeId":"2acbeff5-f                                                                                            018-4404-bb1d-107496daec9f","deviceTypeName":"TP-Link Smart Plug","deviceNetworkType":"UNKNOWN","c                                                                                            omponents":[{"id":"main","capabilities":[{"id":"switch","version":1},{"id":"refresh","version":1},                                                                                            {"id":"healthCheck","version":1}]}],"dth":{"deviceTypeId":"2acbeff5-f018-4404-bb1d-107496daec9f","                                                                                            deviceTypeName":"TP-Link Smart Plug","deviceNetworkType":"UNKNOWN","completedSetup":true,"networkS                                                                                            ecurityLevel":"UNKNOWN","hubId":"60aa38d8-dfb4-4605-9e3f-40fdcfc912a5"},"type":"DTH"},{"deviceId":                                                                                            "d0444b0a-12e0-4450-bbfa-83c0a7527b6e","name":"Sengled Element Classic","label":"Study Light 2","l                                                                                            ocationId":"c6358051-231c-49f3-90f0-d09f9cc884d2","roomId":"902ca7f6-ff9a-42af-9432-55399b9582fc",                                                                                            "deviceTypeId":"52969956-9ba8-46ba-873e-1bb46cfef033","deviceTypeName":"ZigBee Dimmer","deviceNetw                                                                                            orkType":"ZIGBEE","components":[{"id":"main","capabilities":[{"id":"switch","version":1},{"id":"co                                                                                            nfiguration","version":1},{"id":"switchLevel","version":1},{"id":"refresh","version":1},{"id":"act                                                                                            uator","version":1},{"id":"healthCheck","version":1},{"id":"light","version":1}]}],"dth":{"deviceT                                                                                            ypeId":"52969956-9ba8-46ba-873e-1bb46cfef033","deviceTypeName":"ZigBee Dimmer","deviceNetworkType"                                                                                            :"ZIGBEE","completedSetup":true,"networkSecurityLevel":"UNKNOWN","hubId":"60aa38d8-dfb4-4605-9e3f-                                                                                            40fdcfc912a5"},"type":"DTH"},{"deviceId":"e4df0115-16ca-46b3-8f6d-447257e0e15e","name":"c2c-switch                                                                                            ","label":"Octopi","locationId":"c6358051-231c-49f3-90f0-d09f9cc884d2","roomId":"704a0a70-b22a-4a8                                                                                            1-aa0b-08729061f24d","components":[{"id":"main","capabilities":[{"id":"switch","version":1},{"id":                                                                                            "refresh","version":1},{"id":"healthCheck","version":1}]}],"profile":{"id":"7eaca7e4-dd01-4711-8e2                                                                                            0-1a869bb44b1b"},"viper":{},"type":"VIPER"},{"deviceId":"ea905ec4-32bc-4216-8414-16edea8604ab","na                                                                                            me":"MQTT Bridge","label":"MQTT Bridge","locationId":"c6358051-231c-49f3-90f0-d09f9cc884d2","roomI                                                                                            d":"902ca7f6-ff9a-42af-9432-55399b9582fc","deviceTypeId":"3e26b2a8-26bd-4893-8b60-f2c1f10eee23","d                                                                                            eviceTypeName":"MQTT Bridge","deviceNetworkType":"UNKNOWN","components":[{"id":"main","capabilitie                                                                                            s":[{"id":"notification","version":1}]}],"dth":{"deviceTypeId":"3e26b2a8-26bd-4893-8b60-f2c1f10eee                                                                                            23","deviceTypeName":"MQTT Bridge","deviceNetworkType":"UNKNOWN","completedSetup":false,"networkSe                                                                                            curityLevel":"UNKNOWN","hubId":"60aa38d8-dfb4-4605-9e3f-40fdcfc912a5"},"type":"DTH"},{"deviceId":"                                                                                            fac92d75-fb42-4d18-bf97-9d9771fd3a0e","name":"HS105","label":"3D Printer","locationId":"c6358051-2                                                                                            31c-49f3-90f0-d09f9cc884d2","roomId":"902ca7f6-ff9a-42af-9432-55399b9582fc","deviceTypeId":"2acbef                                                                                            f5-f018-4404-bb1d-107496daec9f","deviceTypeName":"TP-Link Smart Plug","deviceNetworkType":"UNKNOWN                                                                                            ","components":[{"id":"main","capabilities":[{"id":"switch","version":1},{"id":"refresh","version"                                                                                            :1},{"id":"healthCheck","version":1}]}],"dth":{"deviceTypeId":"2acbeff5-f018-4404-bb1d-107496daec9                                                                                            f","deviceTypeName":"TP-Link Smart Plug","deviceNetworkType":"UNKNOWN","completedSetup":true,"netw                                                                                            orkSecurityLevel":"UNKNOWN","hubId":"60aa38d8-dfb4-4605-9e3f-40fdcfc912a5"},"type":"DTH"}],"_links
andrewsayre commented 5 years ago

Yeah looks like something changed in the API. You have a number of devices showing up as type VIPER. No idea what that is... here's one of the devices -- is there anything special/different than others? How is it connected to SmartThings?

    {
      "deviceId": "0473c5c0-fdae-4a62-9000-b57af9218a 65",
      "name": "c2c-rgbw-color-bulb",
      "label": "Desk Lamp",
      "locationId": "c6358051-231c-49f3-90f0-d09f9cc 884d2",
      "roomId": "902ca7f6-ff9a-42af-9432-55399b9582fc",
      "components": [
        {
          "id": "main",
          "capabilities": [
            {
              "id": "switch",
              "version": 1
            },
            {
              "id": "switchLevel",
              "version": 1
            },
            {
              "id": "colorControl",
              "version": 1
            },
            {
              "i d": "colorTemperature",
              "version": 1
            },
            {
              "id": "refresh",
              "version": 1
            },
            {
              "id": "healthCheck",
              "version": 1
            }
          ]
        }
      ],
      "profile": {
        "id": "4d24a797-e0c0-45ad-8725-04aa6eb2eeb1"
      },
      "viper": {},
      "type": "VIPER"
    }
andrewsayre commented 5 years ago

I've reached out to ST, but meanwhile will start working on a fix to handle it.

Crepetsky commented 5 years ago

The Desk Lamp is a TP-Link RGB Bulb plugged into an ordinary socket. If it helps, that one is connected to Smart Things via the TP-Link SmartThings Manager Smart App.

andrewsayre commented 5 years ago

ST confirmed this is a valid type that now shows up in the API. I've updated the library and opened #24659 and it should get pulled into the next beta and released with 0.95.0.

andrewsayre commented 5 years ago

0.95 beta 1 is out and contains a fix for this.

Crepetsky commented 5 years ago

0.95 beta 1 is out and contains a fix for this.

Working like a charm, now. Thanks so much!