meg768 / homebridge-ikea-tradfri-gateway

homebridge-ikea-tradfri-gateway
GNU General Public License v3.0
73 stars 25 forks source link

Brightness doesn't change when changing colour at same time #79

Open Fourthbus opened 2 years ago

Fourthbus commented 2 years ago

Similar to #30

When I change brightness and colour at the same time, only the colour of my bulb changed. Brightness doesn't change but it's displayed incorrectly.

Log print, light bulb brightness actually stays constant:

[25/10/2021, 12:28:56] [Trådfri Gateway] Updating power to ON on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:56] [Trådfri Gateway] Updating brightness to 100% on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:56] [Trådfri Gateway] Updating active status to ALIVE on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:56] [Trådfri Gateway] Updating color temperature to 367.52 on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:56] [Trådfri Gateway] Updating power to ON on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:56] [Trådfri Gateway] Updating brightness to 1.2% on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:56] [Trådfri Gateway] Updating active status to ALIVE on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:56] [Trådfri Gateway] Updating color temperature to 367.52 on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:56] [Trådfri Gateway] Updating power to ON on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:56] [Trådfri Gateway] Updating brightness to 1.2% on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:56] [Trådfri Gateway] Updating active status to ALIVE on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:56] [Trådfri Gateway] Updating color temperature to 240.44 on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:58] [Trådfri Gateway] Updating power to ON on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:58] [Trådfri Gateway] Updating brightness to 1.2% on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:58] [Trådfri Gateway] Updating active status to ALIVE on lightbulb 'Desk lamp aux'
[25/10/2021, 12:28:58] [Trådfri Gateway] Updating color temperature to 367.52 on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Setting power to ON on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Setting brightness to 100 on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Setting color temperature to 21% on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Updating power to ON on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Updating brightness to 100% on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Updating active status to ALIVE on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Updating color temperature to 367.52 on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Updating power to ON on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Updating brightness to 100% on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Updating active status to ALIVE on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Updating color temperature to 215.96 on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Updating power to ON on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Updating brightness to 100% on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Updating active status to ALIVE on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:01] [Trådfri Gateway] Updating color temperature to 332.24 on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:03] [Trådfri Gateway] Updating power to ON on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:03] [Trådfri Gateway] Updating brightness to 100% on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:03] [Trådfri Gateway] Updating active status to ALIVE on lightbulb 'Desk lamp aux'
[25/10/2021, 12:29:03] [Trådfri Gateway] Updating color temperature to 215.96 on lightbulb 'Desk lamp aux'
Fourthbus commented 2 years ago

Problem solved by forcing any setColorTemperature command to delay 1 second, in ./src/warm-white-lightbulb.js from line 59 to 65:

setTimeout(() => {
        this.platform.gateway.operateLight(this.device, {
            colorTemperature: percent
        })
        .then(() => {
            if (callback)
                callback();
        })
}, 1000)