This is a little bug.
The light is off.
If you set the brightness to 254 for a light, the light will be switched on, but the State will remain off.
So, this code will never work...
if light.IsOn() {
light.Off()
} else {
light.Bri(254)
}
problem seems to be that the BriContext Method on the light object will not parse the response of the bridge. NOr does it directly change to state.on parameter. (Because it's not possible to set the bri to a light with state off...)
This is a little bug. The light is off. If you set the brightness to 254 for a light, the light will be switched on, but the State will remain off. So, this code will never work...
problem seems to be that the BriContext Method on the light object will not parse the response of the bridge. NOr does it directly change to state.on parameter. (Because it's not possible to set the bri to a light with state off...)