lpgera / dirigera

An unofficial TypeScript client library for IKEA's DIRIGERA smart home hub
https://www.npmjs.com/package/dirigera
MIT License
47 stars 2 forks source link

transitionTime does not seem supported #4

Closed KiterWork closed 6 months ago

KiterWork commented 6 months ago

Heyo! Ive been messing around with the library and found out that client.devices.setAttributes never takes the transitionTime attribute into consideration. My code is as follows

await client.devices.setAttributes({
        id: 'deviceid',
        attributes: {"lightLevel": 9, transitionTime: 100000}
      })

But the time taken is approximately 1 second regardless of the time provided in transitionTime. I cant seem to figure out any further way to log internal errors, so i hope you are able to point me in the right direction

KiterWork commented 6 months ago

image looks like this could be the culprit?

KiterWork commented 6 months ago

Update i got it to work with the following code

await client.deviceSets.setAttributes({
        id: deviceSets[0].id,
        attributes: {
            lightLevel: 1
        },
        transitionTime: 10000
    })

Seems like theres something different in client.devices.setAttributes versus client.deviceSets.setAttributes

KiterWork commented 6 months ago

Final update before closing: the docs are messed up, the syntax should be updated. lll make a pr.

lpgera commented 6 months ago

Sorry for the inconvenience, and thanks for your investigation! I hope I'll have time to check your findings and the PR by tomorrow! 🙂

KiterWork commented 6 months ago

Hey! I forgot to update here, but i was a total idiot and the code is totally fine in the docs. The issue was that the setAttributes section didnt include example code so i didnt know i had to split the transitiontime outside of the attributes object.

lpgera commented 6 months ago

The issue was that the setAttributes section didnt include example code so i didnt know i had to split the transitiontime outside of the attributes object.

Noted! I'll try to make this clearer in the future.

I'm curious, are you using TypeScript in your own code? That, while doesn't replace a good documentation, but should help with these types of problems a little bit:

image