Announcement

Collapse
No announcement yet.

Problems using events to enable/disable timer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Problems using events to enable/disable timer

    My son asked for disco lights in his ceiling lamp, which has 3x Ikea RGB E27 bulbs in a group in Phoscon (ConBee2)) connected to HomeSeer using the JowiHue plugin.

    My plan is to use a script to create a random color and set all three bulbs to that color. I want to have a timer that runs the script every second, and that my son can switch between normal warm-white light and disco lights using the Previous/Next buttons on a Ikea TRÅDFRI remote control (On/Off, Dimmer Up and Dimmer Down is already mapped to the bulb group in Phoscon.

    The script for setting random colors is working fine. But I'm having problems with the event logic. As far as I can tell, in addition to a timer, I need four events:
    1. one that triggers on a timer value X, calls the color cycle script, and sets the timer to X-1
    2. one that triggers on the Previous/Next buttons if the timer is NOT running (i.e. "color cycle mode" is not active), and starts the timer
    3. one that triggers on the Previous/Next buttons if the timer IS running (i.e. "color cycle mode" is active), stops the timer and cleans up (sets warm-white light, resets timer)
    4. one that triggers on the On/Off button if the timer IS running, stops the timer and cleans up (resets timer and sets warm-white light (which will be used next time the light is turned on)
    The first one is working. Timer value 0 indicates timer not running, and it triggers on timer value 2 resetting it to value 1. I'm considering changing the logic here, since the timer needs to run for two seconds before triggering when turning on the color cycle mode.

    The second and third one is causing problems. Since I can't seem to find a way to check if a timer is running directly in the event, I'm using the timer value. What happened was that HomeSeer locked up, with CPU usage going through the roof. I believe it could have something to do with the "equal to 0" trigger, as the timer will remain at 0 for a whole second probably causing the event to trigger again and again.

    Am I way off in the logic here? I'm kind of a newbie when it comes to HomeSeer events, so any help here would be great!

    Click image for larger version

Name:	2020-04-06 05_21_32-Window.png
Views:	73
Size:	232.5 KB
ID:	1375390Click image for larger version

Name:	2020-04-06 05_21_53-Window.png
Views:	80
Size:	280.8 KB
ID:	1375389
    Attached Files
Working...
X