Help turning lights On/Off with Button

Hello!

I have a new Xiaomi Button and some smart bulbs I would like to control. I have a piston, but it seems to turn the light on, and then off after a press. Can someone help me figure this out?

settings
end settings;

execute
if
Laundry Room Switch’s button gets pushed

  • add a new condition
    then
    if
    Laundry Room’s switch is off
  • add a new condition
    then
    with
    Laundry Room
    do
    Set level to 100%;
  • add a new task
    end with;
  • add a new statement
    else
    with
    Laundry Room
    do
    Turn off;
  • add a new task
    end with;
  • add a new statement
    end if;
  • add a new statement
    else
  • add a new statement
    end if;
  • add a new statement
    end execute;

Why not just use a toggle action if all you’re doing is turning on and off?

Also, there is now a webCore dedicated forum here for help w/webCore pistons…

2 Likes

Thank you!

What is a toggle action? could you explain a bit more?

I have been on the platform for a bit over 24 hours. My background in coding in JavaScript so general terms make sense, but actually getting it to work doesn’t seem to be.

Also, thank you for the new forum.

A toggle is an action option in webCore - it sends a command to the switch or light to “toggle:”

  • If off, it turns on
  • If on, it turns off

You’ll find it in the list of available actions when you select your light(s) or switch(es) in webCore to complete an action.

1 Like

Thank you both for the guidance!!! Very much appreciated!

I have learned a great deal in this first post!

Also, I tried out what you suggested and it worked perfectly! Thank you so much!

No problem…we were all noobs once (and I persist in my noobishness).

(Except @JDRoberts. I fully believe that he sprang from the brow of Zeus fully aware of Zwave, Zigbee, hubs, bridges, and the IDE.) :smiley:

3 Likes

Hey, not me! I worked hard for my knowledge, including an engineering degree and a ton of technical courses after college, plus on-the-job training.

Anybody who would put in as many hours as I have would have at least the same level of knowledge and probably more. :sunglasses:

4 Likes

Oh, yeah, like school and hard work is a more logical explanation than being the son of a god. Good luck getting anyone to believe that! :wink:

4 Likes