Hi I’m currently writing a Telegram Bot to control features from Rest API.
And I’d like to have the right buttons for the different devices, like choose of temperature only for lights with temperature, color only for color lights etc.
But as I found out the only thing to distinguish if the device has brightness is via parsing the type. But that seems unreliable? Cause diffent switches has probably diffent type namings. So is there a general function to see if the device brightness can be controlled?
If it report bri it is controllable, if bri is not available you can’t control brightness.
1 Like
Using the type is not so bad.
“Color dimmable light” will be dimmable
“On/Off light” will be not
I m agree, some devices have issue, but will be device/deconz fault not your plugin.
The @Robban technic is flawless, take care covering can have the state/bri too.
You are right, I forgot that in Golang every deserialized field will be initialized with its default value when it’s not a pointer. So I didn’t realized that the devices has no bri field in the state! That should work.
1 Like