@jmarcim (Jmarcim) posted a new topic, subject "Toggle a bulb color+level by a button". It read:

   Hi guys,
    
    I've got a smart RGB zigbee gledopto bulb and want to toggle between "soft white/level 100" and "red/level 50" by single pressing a button.
    
    How do I do it ?
    
    Thanks

@TechMedX (TechMedX) replied

    Install "Groups and Scenes" app.
    
    Save each setting above as a scene.
    
    Use a virtual/physical button to trigger on/off of each scene, or toggle between them in RM.

To which @Ryan780 replied

    You don't need to create scenes. You can create a rule machine rule that lookss at the bulbs current level, since one setting is 100 and one is 50. So:
    [code] 
        Trigger Button Presed
        
        Action:
        
        IF dimmer level >50 THEN
             Set color to red Level 50
        ELSE
            Set color to soft-white Level 100
        END-IF
    [/code]

So @codahq (Ben) replied

    You can do either approach mentioned above. Neither is more correct than the other. The RM suggestion is quicker. If you want to do this same thing from many different devices or outside integrations having the scene can be handy.
    
    I believe there is even a toggle color temperature command in RM (which takes a level as well).

After which, @Ryan780 added

    codahq:
    
    > I believe there is even a toggle color temperature command in RM (which takes a level as well).
    
    That will toggle between off and color (or there's one for color temp) but not between two colors.
    
    codahq:
    
    > You can do either approach mentioned above.
    
    I didn't say it was wrong to create a scene...just that you didn't have to. Creating a scene creates another device that has to be updated whenever any of the lights within the scene change, just like a group. I cut a bunch of extra scenes out of my setup in my effort to get things more streamlined a while ago. Don't know how much of an impact they played but it is something else the hub has to do.

@jmarcim (Jmarcim) replied

    Thanks a lot guys.
    
    As always, it looks so simple when someone shows you the path and also makes you feel a completely dumb... Hehehe

To which @jmarcim (Jmarcim) replied

    Based on @Ryan780 solution I've made this rule :  
    
    
    IMG_20200402_2113141080×861 165 KB
    
    It works, but I push button one time and Hubitat runs the rule but the following I have to push twice for it to run again.
    
    For instance:
    
    Bulb is on (level 100)  
    Push button one time it runs  
    Turn off bulb (level 0)  
    Push button nothing happens  
    Push button again it runs  
    Turn on bulb (level 100)  
    Push button  
    Turn bulb off  
    And so on...
    
    I can't figure out why.

@BorrisTheCat (Steven) replied

    I do exactly this set up with mine.
    
    Best is a custom condition of colour mode.
    
    IF colour mode is RGB THEN  
    Set colour temperature 2700 level 100  
    ELSE  
    Set colour RED level 50  
    END IF
    
    Screenshot_20200403-014728_Chrome1440×2960 753 KB
    
      
    Obviously I have abit more stuff in there too but you can see whats possible.


{'source': 'discourse', 'url': 'https://community.hubitat.com/t/toggle-a-bulb-color-level-by-a-button/37295', 'title': 'Toggle a bulb color+level by a button', 'views': 719, 'has_accepted_answer': False, 'word_count': 489, 'like_count': 3, 'reply_count': 1, 'participant_count': 5, 'posts': 8, 'tags': '', 'author': '@jmarcim (Jmarcim)', 'participants': '@jmarcim (Jmarcim), @TechMedX (TechMedX), @Ryan780, @codahq (Ben), @BorrisTheCat (Steven)', 'image_url': [None], 'created_at': '2020-04-02T22:23:10.856Z', 'last_posted_at': '2020-04-03T00:48:41.516Z'}