Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Unable to set multiple attributes at once (deviceSets) #15

@Saphirah

Description

@Saphirah

I have multiple lamps grouped in a device set. When i try the following code:

const client = await getDirigeraClient();
const attributes = {
  lightLevel: 20,
  colorHue: 100,
  colorSaturation: 1,
};
const sets = (await client.deviceSets.list()).filter((set) => set.name === "Lamps");
await client.deviceSets.setAttributes({
  id: sets[0].id,
  attributes,
  transitionTime: 1000,
});

Only the first attribute (in this case lightLevel) is updated. The hue and saturation remains unchanged.
When i swap the attribute order:

const attributes = {
  colorHue: 100,  
  lightLevel: 20,
  colorSaturation: 1,
};

Only hue is updated.
To my understanding in the API documentation, one should be able to update multiple attributes at once, right?

In your code, you send the whole attributes object, so i am assuming it is a limitation by the Dirigera hub.
In this case, maybe the setAttributes function should be improved, to only accept one attribute and one value.

Or am i misusing the function? Cheers!

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