OpenBK7231T_App
OpenBK7231T_App copied to clipboard
automatically turn off the bulb when brightness is below 1, turn on w…
…hen above 1 I really liked the feature in Tasmota and thought it would be practical here as well. What do you think of this implementation and do you even want this feature?
Idea is good, but it seems you are doing it incorrectly. You are just setting g_led_enableAll to 0, but you do not broadcast it's change over MQTT. Is this intended?
It wasn't intended, missed that one. I think I got it working now by running the "LED_SendEnableAllState()" function.
Hmm it seems better. Do you think this behaviour should be always on, or will we add a flag for that? With CFG_HasFlag or whatever it was called....
I would add a flag, I even have some code for that already. It includes turning on when the temperature/color changes.
I now added a flag "[LED] always turn on bulb when color changes" (OBK_FLAG_LED_ON_CHANGE_TURN_ON) that when checked turns the lamp on when: color/temperature/brightness is changed. One feature I put on at default is turning the lamp off when brightness is 0 and once the brightness is above 0 turning the lamp on once. So it wouldn't turn on when changing the brightness from 20 to 30 for example (Can also be changed, but I thought it made sense. + HA only sets the brightness to 1 at minimum, so it wouldn't trigger turning it off.).
I might have destroyed your indentation, working on it.
Current version doesn't seem to build?
Don't know what happened there, I reset to an older commit.
There are still some things that are needed to be fixed. https://github.com/openshwprojects/OpenBK7231T_App/pull/216/commits/8789093124512df8cdf38f833e6ce2cb9dfe74bc In this commit, you are using "char * last_led_color = "#ffffff";" and trying to compare it with given args string "c != last_led_color &&", but it will never work correctly because in C language you are just comparing the pointer values that way (addresses in the memory). Futhermore, you are not writing to "last_led_color " so I think that "last_led_color " can be removed.
Removed last_led_color and the check. Tested and seems to be working.
I now updated my branch to the newest and implemented it again. To conclude: I added a flag ([LED] always turn on bulb when color changes), which always turns on the bulb when there is any state change (color/temperature/brightness). When the flag is turned off, the light turns only off when the brightness is below 1 and only turns on once when the last brightness is 0 and the current is above 0. I tested again with my lamp and everything seems to be working.
I'll recheck this tomorrow and most likely merge it then. Thanks
I am not sure if the "basecolor" command can turn on the led. Can Home Assistant send a "basecolor" command to bulbs on reboot, even if they are turned off?
For me, when the lights are turned off, I am only able to either change the brightness or use the on/off switch. The other controls are not even showed. Maybe it is somehow possible, I'll look into that.
Tasmota has this on as a default since it makes logical sense but you can disable the auto on to do things like change the color of a light without turning it on so it will be set when you do turn it on, like if you have lights simulate sunrise or go cooler temp during the day then warm at night.
https://tasmota.github.io/docs/Lights/#disable-auto-power-on
For me, when the lights are turned off, I am only able to either change the brightness or use the on/off switch. The other controls are not even showed. Maybe it is somehow possible, I'll look into that.
Home assistant is limited in it's default cards for lights like that. but you can do it in the webui for tasmota or mqtt/etc.