Changing device type through API...not sure where to start

Hi everyone, I’m trying to see if there is a way I can update a device type through the API. There seems to be a bug with the yeelight connector causing the devices go offline after a certain time (there are a couple of threads about this). We found out that over time the device type gets changed to placeholder and needs to be changed to ‘Simulated RGBW Bulb’ for the device to work again.
I’m trying to see if I can create a process that will do this automatically.

I created a token with access to the device permissions and my idea is to do a POST request to: https://graph-na04-useast2.api.smartthings.com/device/update
This is the same request that is done through the website. I’m sending the token in the header as Bearer and the id (device id) and type.id in the form data, however i’m getting a 403 error.
Is this the right approach or should I be doing something completely different?

I’m not trying to create anything fancy, just really a quick code in python that will be able to change the device type on demand for all my bulbs to ‘RGBW Simulated Bulbs’

Hi, there! The deviceType shown in the Groovy IDE tool for the Cloud-To-Cloud connectors is Placeholder because that property is only used for the DTH-based devices.
The deviceType update from the IDE triggers a Connection refresh with the Yeelight Cloud but it’s not used. If you get the devices list from the API, you’ll see how the property “deviceTypeName” is not included.
Take a look at this sample of another Cloud-To-Cloud connector:

{
    "deviceId": "xxxx-xxxxx-xxxx",
    "name": "deviceName",
    "label": "deviceLabel",
    "manufacturerName": "xxxx",
    "presentationId": "xxxx-xxxxx-xxxx",
    "locationId": "xxxx-xxxxx-xxxx",
    "roomId": "xxxx-xxxxx-xxxx",
    "components": [
        {
            "id": "main",
            "capabilities": [
                ...
            ],
            "categories": [
                {
                    "name": "Others",
                    "categoryType": "manufacturer"
                }
            ]
        }
    ],
    "profile": {
        "id": "xxxx-xxxxx-xxxx"
    },
    "viper": {
        "manufacturerName": "xxx",
        "modelName": "xxx"
    },
    "type": "VIPER",
    "restrictionTier": 0
}

What you can do is:

  1. In the mobile app, go to Menu > Settings > Linked Services
  2. Click on the Yeelight connector
  3. It could ask you to login again, after that, it’ll trigger the refresh and the devices should appear “online” again.

Note: The connection loss with these devices is a known issue and our engineering team is working on that along with the partner’s team. However, I suggest you contact the Manufacturer (Yeelight) Support and see if they can provide any feedback.

Hi, first of all thanks for the answer! Unfortunately the solution of refreshing the yeelight connector doesnt work. I would have to delete it and add it again, but I lose all my automations in the process :frowning:
Is there no way I can change the device type through the REST API? I felt i was close by doing that POST request to that URL and its just something with my authentification

Sadly, no. That URL can only be used in the Groovy IDE environment.
If you try to update the device changing this value from the API, for example:

{
  "label": "DeviceLabel",
  "locationId": "xxxx-xxxx-xxxx",
  "deviceTypeName":"Simulated RGBW Bulb",
  "deviceTypeId":"xxxx-xxxx-xxxx"
}

These values are not considered and the deviceType goes back to “placeholder” (if another one was selected) in the Groovy IDE tool.
If it would be only an Authentication problem, the error would be 401 - Unauthorized.

Thanks for clarifying! I’m glad that the engineering team is aware of the connection loss so i’m hoping this will get solved soon, right now the only way to fix it without losing your automations seems to be changing the type back to “Simulated RGBW Bulb” in the web interface