logo elektroda
logo elektroda
X
logo elektroda

Smart Light Bulb - how to configure it to be always on, no toggle button of control from toggle

MnM1 2175 21
ADVERTISEMENT
  • #1 20705860
    MnM1
    Level 10  
    Hopefully a simple question :)

    I need to have some smart light bulbs to be always on when I press the ON button on a smart light switch.

    I also need the light bulb to remember its last brightness, temperature, color, etc.

    And the third requirement is NOT to have an ON/OFF toggle switch, but retain the LED Dimmer/Brightness, LED RGB Color, and LED Temperature Sliders.

    The idea behind this is that when I press the ON button on a light switch (zigbee smart light switch), the smart light bulb will:

    1. always turn on
    2. always remember the previous values for brightness, temperature, RGB color, etc but not the power state (see point 1 above)
    3. there will be no way to switch the light off (via its web interface, Alexa, Home Assistant, or any other means) except from 
       the smart light switch button
    4. Have all these options in Home Assistant - e.g. a light bulb in Home Assistant will not have an option to turn it on or off 
       but will have all the other usual options for brightness, RGB color, scenes, temperatures, etc. Only the light switch button 
       will turn the bulb on and off.


    My guess for points 1 and 2 is to:

    - in Configure Startup set correct channel (Channel 0) to 1
    - Enable Flag 12
    


    But I am not sure how to remove the toggle control (point 3 above).

    For point 4 above, am I correct in assuming that if no toggle is present on the device, the MQTT will present the device to Home Assistant the same way and will not have an on/off option?
  • ADVERTISEMENT
  • #2 20706018
    p.kaczmarek2
    Moderator Smart Home
    That's a very strange requirement. I don't think it's supported out of the box.

    Why do you want to hide the toggle button of the bulb?

    Maybe I could add a flag for this, this would not be hard, but it would require changing code in few places (on/off display, commands, etc), and I need to know first what is the use case for that, there must be some motivation for us to support it. What are the chances that someone else will need this feature?

    Also...

    MnM1 wrote:

    3. there will be no way to switch the light off (via its web interface, Alexa, Home Assistant, or any other means) except from
    the smart light switch button
    4. Have all these options in Home Assistant - e.g. a light bulb in Home Assistant will not have an option to turn it on or off
    but will have all the other usual options for brightness, RGB color, scenes, temperatures,
    etc. Only the light switch button
    will turn the bulb on and off.

    This can be very easily if you use manual YAML integration instead of the Home Assistant Discovery.
    Helpful post? Buy me a coffee.
  • #3 20706067
    MnM1
    Level 10  

    For me, there is a use case for this - and maybe there will be more in the future from other people too.

    As you can see from my OP, I have smart lights and smart switches.
    The smart switches are Zigbee, so no OBK controls on these devices.

    While there are multiple reasons, the main reason is to keep the family happy. They are used to walking into a room and telling Alexa to turn the lights on or off.

    With smart switches and smart lights, one cannot toggle the smart lights off as the smart switch expects load/resistance on the electric wire (I don't have/use neutral wires).

    I already had some issues where I have dimmed the smart light to the lowest possible value, then the switch turned off. When I tried to turn the light on (from the switch), nothing happened. The light acts like it's dead - no Wi-Fi, no AP rescue mode (I tried many times to get it into rescue mode but no luck).
    I know the light is not actually dead (it has been used only for about 2 months) and I have many other lights that were bought at the same time and they work fine. Other family members managed to do the same thing by asking Alexa to turn off the light that was dimmed by about 30%. Alexa turned off the light and the switch turned off. Lights never came back to life.

    I managed to rescue a couple of dead lights (by turning off/on a few times all the buttons from a 4-way configuration - 3 buttons controlling one light). 2 lights eventually came back with all the settings that they had. But I still have a couple that are not coming back. Have moved the :dead: lights in the same place as the rescued lights and tried again. But nothing happened.

    So my request will sort out the above issue and keep my lights alive.

    Another issue is that the family is used to turning on the lights by saying "Alexa, turn on lights" when they walk into a room.
    As lights are assigned to rooms, Alexa knows which lights to turn on. This can't work anymore with the smart switches, if I want the smart switch to control the on/off for lights.
    While there is an option to add a switch to a light group in HA and have the switch turn on the light/s, it might create a similar condition like the one above when the lights are turned off. If the command issued to Alexa is to turn off the lights and the lights respond first, then it will create the exact above scenario all over again.
    If the switch responds first, then it should be OK. But there is no way to control which device responds first.

    So for me, the best option is to have the switch in control and turn off/on the lights. It will eliminate a lot of issues.

    Hope all this makes sense.

    You have mentioned that through YAML integration, I can have lights in HA without the option to turn them off. Would you have an example of such YAML that I can test with?
  • ADVERTISEMENT
  • #4 20707234
    p.kaczmarek2
    Moderator Smart Home
    Ok, so we can try to start with this YAML and later I will add necessary changes, if they are required.

    I think the basic yaml is here:
    https://www.elektroda.com/rtvforum/topic3880540.html
    I think the basic YAML is also generated on Home Assistant page in obk.
    but HA will not accept it, you will have to convert it to new format:
    Helpful post? Buy me a coffee.
  • #5 20707255
    MnM1
    Level 10  

    OK - I will do this a bit later on (at work now).
    Thank you for working with me on this.
  • #6 20711705
    MnM1
    Level 10  
    OK - I have added a new test downlight to HA via mqtt template as opposed to auto discovery. Please note that I have many other downlights integrated in HA via the auto discovery method.
    I can see it in HA - and it has the ON/OFF toggle still there (just like all the other downlights added with auto discovery).

    What should be the next step?
  • ADVERTISEMENT
  • #7 20711820
    p.kaczmarek2
    Moderator Smart Home
    What is your current YAML? Let's try remove the state topic so it is always on. I am not sure how will HA react in this scenario.
    Helpful post? Buy me a coffee.
  • #8 20711846
    MnM1
    Level 10  
    This the code I am using:

    mqtt:
      light:
        - unique_id: "DownLight-80_light"
          name: "Downlight-80"
          rgb_command_template: "{{ '#%02x%02x%02x0000' | format(red, green, blue)}}"
          rgb_value_template: "{{ value[0:2]|int(base=16) }},{{ value[2:4]|int(base=16) }},{{ value[4:6]|int(base=16) }}"
          rgb_state_topic: "Home/DownLights/Spare/Downlight80/led_basecolor_rgb/get"
          rgb_command_topic: "cmnd/Home/DownLights/Spare/Downlight80/led_basecolor_rgb"
          command_topic: "cmnd/Home/DownLights/Spare/Downlight80/led_enableAll"
          state_topic: "Home/DownLights/Spare/Downlight80/led_enableAll/get"
          availability_topic: "Home/DownLights/Spare/Downlight80/connected"
          payload_on: "1"
          payload_off: "0"
          brightness_command_topic: "cmnd/Home/DownLights/Spare/Downlight80/led_dimmer"
          brightness_state_topic: "Home/DownLights/Spare/Downlight80/led_dimmer/get"
          brightness_scale: 100
          color_temp_command_topic: "cmnd/Home/DownLights/Spare/Downlight80/led_temperature"
          color_temp_state_topic: "Home/DownLights/Spare/Downlight80/led_temperature/get"



    So this is the line you want me to remove:

    state_topic: "Home/DownLights/Spare/Downlight80/led_enableAll/get"


    Anything else I should remove?

    How about the light config in OBK? Anything I should do there before I make changes in the YAML?
  • ADVERTISEMENT
  • #9 20711851
    p.kaczmarek2
    Moderator Smart Home
    I would suggest removing everything with "led_enableAll" in the MQTT topic. Then save, reboot HA and check if it's still possible to turn it off.

    Nothing to do on OpenBeken, well, maybe except adding something like:
    
    led_enableAll 1
    

    to short startup command or autoexec.bat

    As I said, I didn't check it on my side, so we're experimenting together. Try what I said and we'll see how it goes.
    Helpful post? Buy me a coffee.
  • #10 20711867
    MnM1
    Level 10  
    I understand :)

    Will do the suggested steps now. Will let you know shortly

    Added after 8 [minutes]:

    OK so I commented out like below

    mqtt:
      light:
        - unique_id: "DownLight-80_light"
          name: "Downlight-80"
          rgb_command_template: "{{ '#%02x%02x%02x0000' | format(red, green, blue)}}"
          rgb_value_template: "{{ value[0:2]|int(base=16) }},{{ value[2:4]|int(base=16) }},{{ value[4:6]|int(base=16) }}"
          rgb_state_topic: "Home/DownLights/Spare/Downlight80/led_basecolor_rgb/get"
          rgb_command_topic: "cmnd/Home/DownLights/Spare/Downlight80/led_basecolor_rgb"
          #command_topic: "cmnd/Home/DownLights/Spare/Downlight80/led_enableAll"
          #state_topic: "Home/DownLights/Spare/Downlight80/led_enableAll/get"
          availability_topic: "Home/DownLights/Spare/Downlight80/connected"
          payload_on: "1"
          payload_off: "0"
          brightness_command_topic: "cmnd/Home/DownLights/Spare/Downlight80/led_dimmer"
          brightness_state_topic: "Home/DownLights/Spare/Downlight80/led_dimmer/get"
          brightness_scale: 100
          color_temp_command_topic: "cmnd/Home/DownLights/Spare/Downlight80/led_temperature"
          color_temp_state_topic: "Home/DownLights/Spare/Downlight80/led_temperature/get"


    I think that's all I need to do?

    However as soon as I comment out command_topic I get an error:

    Screenshot of MQTT configuration for a light with the error Missing property 'command_topic'.

    And of course the configuration is invalid message in HA's Check and Restart page
  • #11 20711888
    p.kaczmarek2
    Moderator Smart Home
    Oh no, it looks like that the Home Assistant guys are forcing us to have command topics for every light! This is not good.

    Your use case is so unique that they didn't expect nobody to try that...

    Well, the docs confirm:
    https://www.home-assistant.io/integrations/light.mqtt/
    Fragment of documentation on MQTT configuration in Home Assistant.
    Maybe we can try to do the work around.

    So:
    - keep state_topic set like it always was
    - set "command_topic" to something like "this/topic/does/not/exist" etc etc so it goes into the ether... so light never receives the commands for ON or OFF...
    Helpful post? Buy me a coffee.
  • #12 20711896
    MnM1
    Level 10  
    One question - should the light be configured to connect to mqtt? in the Config>>Configure MQTT page?
  • #13 20711901
    p.kaczmarek2
    Moderator Smart Home
    Of course, otherwise there will be no communication at all.
    Helpful post? Buy me a coffee.
  • #14 20711912
    MnM1
    Level 10  
    OK the new YAML is like this now:

    mqtt:
      light:
        - unique_id: "DownLight-80_light"
          name: "Downlight-80"
          rgb_command_template: "{{ '#%02x%02x%02x0000' | format(red, green, blue)}}"
          rgb_value_template: "{{ value[0:2]|int(base=16) }},{{ value[2:4]|int(base=16) }},{{ value[4:6]|int(base=16) }}"
          rgb_state_topic: "Home/DownLights/Spare/Downlight80/led_basecolor_rgb/get"
          rgb_command_topic: "cmnd/Home/DownLights/Spare/Downlight80/led_basecolor_rgb"
          command_topic: "cmnd/Home/DownLights/Spare/Downlight80/this/command/topic/is_not_Used"
          state_topic: "Home/DownLights/Spare/Downlight80/led_enableAll/get"
          availability_topic: "Home/DownLights/Spare/Downlight80/connected"
          payload_on: "1"
          payload_off: "0"
          brightness_command_topic: "cmnd/Home/DownLights/Spare/Downlight80/led_dimmer"
          brightness_state_topic: "Home/DownLights/Spare/Downlight80/led_dimmer/get"
          brightness_scale: 100
          color_temp_command_topic: "cmnd/Home/DownLights/Spare/Downlight80/led_temperature"
          color_temp_state_topic: "Home/DownLights/Spare/Downlight80/led_temperature/get"


    Rebooted HA and the light is there. Turn it on/off does nothing. I can toggle it ON or OFF from the OBK device web page.
    All the other options seem to work OK in HA - brightness, rgb, temperature
  • #15 20711951
    p.kaczmarek2
    Moderator Smart Home
    So maybe now we can script OBK page to... to automatically turn it on once it's turned off?

    That could be done with change handler.

    Something like:
    
    When Users Turns Light Off -> Turn It On
    
    Helpful post? Buy me a coffee.
  • #16 20711957
    MnM1
    Level 10  
    So what you mean is to allow users to turn it off and then OBK page will turn it on actually?
    Will there be small delay between the off and on? Cause that will freak out the smart switches.

    If there is a way to have the light on all the time in OBK that will be best. As one of the pre-rqs (as far I can tell from my use cases) is for OBK to always have the light ON - so when a switch turns it ON light will always be ON without user intervention. But is also good to remember all of the last setting (rbg, temp, dim values).

    Added after 4 [minutes]:

    Thinking about it now - if the toggle is on the OBK page can can only be used from there that is not a bad thing. Switches and bulb wont be able to use it via Alexa or HA so it OK.
    Just need a way to figure the always on option.

    Added after 2 [minutes]:


    Did a quick test - changed to red in HA and then rebooted the light from OBK page.
    After it started the light was back to white. So is not remembering rgb, dim, temp.[/line]

    Actually disregard the above - still testing.

    Added after 20 [minutes]:

    I have enabled Flags 10, 12 and 37.
    Last values for rgb, temp, dim are remembered after a cold start (to simulate what a smart switch will - it will just cut the power the light).
    The device turns on after a cold boot but I suspect that is because flag 12 enables that.

    Should I set a startup value of 1 in Start Values - I think that is what will always have the light on after a cold boot regardless of the last state?
  • #17 20712016
    p.kaczmarek2
    Moderator Smart Home
    I don't think start StartValue will work for the light. It's better to execute led_enableAll from autoexec.bat or short startup command:

    p.kaczmarek2 wrote:

    Nothing to do on OpenBeken, well, maybe except adding something like:
    
    led_enableAll 1
    

    to short startup command or autoexec.bat


    If we enable smooth transitions on light, and set change handler to the turning light off to turn it on, then the blink will not be visible.

    Futhermore, as you said, in most cases it won't turn off anyway, because it's already blocked at HA level.
    Helpful post? Buy me a coffee.
  • #18 20712030
    MnM1
    Level 10  

    OK, I already had led_enableAll 1 in the startup command - so now I know why the light comes back on after a reboot/power cut.

    Still struggling to understand why you want to have "the turning light off to turn it on" - is this so one can bring the light value in HA to an off position (without the light being actually off?) Just want to understand the rationale behind that because the way the device is configured right now seems to be the correct way to work for my use case. Wondering what I am not seeing by using the turning light off to turn it on option.
  • #19 20712036
    p.kaczmarek2
    Moderator Smart Home
    MnM1 wrote:

    Still struggling to understand why you want to have "the turning light off to turn it on" - is this so one can bring the light value in HA to an off position (without the light being actually off?)

    No, it's just a precaution for a situation where user accesses OBK WWW panel directly and turns off light there. It's just to be sure.
    Helpful post? Buy me a coffee.
  • #20 20712039
    MnM1
    Level 10  

    Aha, got it. Yes, it makes sense now :)

    Now the next question - the changes that we worked on for the device in HA - the YAML config for it - is there an option that you can build in OBK HA Auto Discovery to set up a zombie command topic? Will be much better that way so one can use HA auto discovery rather than manually add YAML config in HA. Or OBK auto discovery doesn't work that way?
  • #21 20714646
    p.kaczmarek2
    Moderator Smart Home
    The feature you are asking about is the HA Discovery customization. This is something that is planned for months already, but I haven't had time to look into it yet.

    The basic idea would be to display the HA Discovery Yaml before publishing it to MQTT. This could be done most likely trough our Web App.

    Usage would be the following: first, you go to the Web App, to the new HA Discovery tab, where you can press button "Generate Discovery". Then you get the Discovery yaml in the text field, where you can review it and make the changes as you wish. Finally, down below you'd have a "Send modified Discovery" button that would ultimately publish changed device description to HA.

    I am hoping to add this feature in the following weeks. Currently I also have a DS18B20 request from several users, I have your Alexa request and I was also planning to test SPI individually-addressable LEDs on my side, namely the WS2812Bs which I mentioned in the SM16703 thread. We'll see how it goes.

    Please stay around and check Elektroda every now and then, I'll post an update on the forum once the HA custom discovery is done.

    Anyway, except that discovery thing, what else is left to do for your "no toggle" setup?
    Helpful post? Buy me a coffee.
  • #22 20714683
    MnM1
    Level 10  

    Ok, no worries - I am here every day to check new posts and learn about devices and what people are doing, so I will also check every now and then to see when the HA Discovery Update field is ready for testing.

    The other thing was your suggestion for "When Users Turn Light Off -> Turn It On."

    Also, after further testing, I have noticed the following - sometimes (not always) when I turn on the smart light from the smart switch, the light does not come on at all (this happens with OBK and with the original firmware). Most of the time, the smart light does show up in AP Rescue Mode on the Wi-Fi.

    I am not sure why this is happening - my guess is that the smart switch sends pulses of electricity to turn on a light. And this puts a smart light in AP Rescue Mode.

    I was thinking that it would be good to have an option (if possible) in the GUI for a user to specify after how many on/off/on cycles to put a device in AP Rescue Mode. I think right now it is hard-coded at 3 or 5, and whatever the smart switch is doing is triggering that limit when a smart light is turned on. What do you think?

Topic summary

The discussion revolves around configuring smart light bulbs to remain always on when activated by a Zigbee smart switch, while retaining their last brightness, color, and temperature settings. Users express the need to eliminate the ON/OFF toggle functionality, allowing only dimming and color adjustments through sliders. The conversation explores potential solutions using Home Assistant (HA) and manual YAML configurations, including the removal of command topics to prevent the bulbs from being turned off. Suggestions include using MQTT for communication and implementing a workaround to ensure the bulbs remain on despite user interactions through the OBK web interface. The need for a feature to customize HA Discovery for better integration is also highlighted.
Summary generated by the language model.
ADVERTISEMENT