Skip to content

Missing desired_state payload? #12

@scoobyshi

Description

@scoobyshi

It seems as though in the API calls made via wink-js, it is not getting the "desired_state" node in the JSON response, see this example from the debug logs:

{"object_type":"light_bulb","object_id":"133xxxx","uuid":"cdb488fc-7d56-4c61-b7fe-xxx","icon_id":"71","icon_code":"light_bulb-light_bulb",
"desired_state":{},"last_reading":{"connection":true,
.
.

When I hit the API directly (outside of Wink-JS, eg using Postman), even using the same authentication token, URL, endpoint, etc, (eg https://winkapi.quirky.com/users/me/wink_devices), I get the expected desired_state.

The consequence of this missing node is that it triggers confusion in apps downstream that might expect this node present (eg homebridge-wink), based on a query to the wink API. I'm not sure if it's something Wink changed, or in how exactly wink-js is querying the API, but it is strange. The only difference I can see between hitting the API directly and wink-js is the model, but all it does is inflate the response and isn't touching this node...

Having said all that, according to the Wink documentation, we should expect that the desired state is only set during a request and otherwise cleared: http://docs.winkapiv2.apiary.io/#reference/device/desired-state-and-last-reading/retrieve-all-devices-of-user, "When the device acknowledges that the state has been applied, the server will clear the field from desired_state."; In which case the anomaly is the direct to API queries. Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions