resoai / TileBoard

A simple yet highly configurable Dashboard for HomeAssistant
MIT License
1.63k stars 278 forks source link

Control RGBW led strips #792

Open christophebaraer opened 2 years ago

christophebaraer commented 2 years ago

Recently wired a RGBW LED strip to a Shelly RGBW controller and added the entity to a LIGHT tile. The config I have is the following :

{
                position: [0, 1],
                title: 'Led strip',
                id: 'light.ledstrip_gameden',
                type: TYPES.LIGHT,
                state: switchPercents('brightness', 255, true),
                states: {
                    on: "On",
                    off: "Off"
                },
                icons: {
                    on: "mdi-lightbulb-on",
                    off: "mdi-lightbulb",
                },
                sliders: [{
                        title: 'Brightness',
                        field: 'brightness',
                        max: 100,
                        min: 0,
                        step: 10,
                        request: {
                            type: "call_service",
                            domain: "light",
                            service: "turn_on",
                            field: "brightness_pct"
                        }
                    },
                    {
                        title: 'Color temp',
                        field: 'color_temp',
                        max: 588,
                        min: 153,
                        step: 15,
                        request: {
                            type: "call_service",
                            domain: "light",
                            service: "turn_on",
                            field: "color_temp"
                        }
                    }
                ],
                colorpicker: true
            }

Using the + / - to increase or decrease the brightness only works when either the RGB channels are on but doesn't when the White channel is used.

I was wondering about the required changes in my configuration to support increasing / decreasing the brightness of the White channel ?

alphasixtyfive commented 2 years ago

It might be to do something with how brightness is calculated:

(brightness / 255 * 100 / 10) * 10

https://github.com/resoai/TileBoard/blob/master/scripts/controllers/main.js#L1247