1) Create input boolean for dimming (input_boolean.dim_switch)
2) Add a new input helper dropdown for 'cycle colors'
Brief summary of the flow
a. single click to toggle lights on/off
b. 'holdstart' payload would toggle 'input_boolean.dim_switch' that switches between dimming or increasing brightness
c. hold action (with trigger node) would continuously increase/decrease brightness every 250ms
d. release payload sends reset payload to stop the trigger node thus stopping the dimming action
f. double click to change from warm or cold temperature
e. toggle channel 1 relay to toggle on/off for the lights
As you can see, the led indicator for switch 1 is always on, that's because for my switch, the led is tied to the relay.
There are other switches in the market with its dedicated pin for led such as these:
Very clever way to get around the device limitations, although with the latest OBK updates (that weren' t in place at the time of creating automation from the first post) it should be possible to do it fully in script....
Double click to change temperature...
Let me see if I can come up with something similar....
Ok ok, it will not be the same, I will use a simple CW strip simulation as an example:
// SetButtonTimes [ValLongPress] [ValShortPress] [ValRepeat]
// Each value is times 100ms.
// SetButtonTimes 10 3 5
// more responsive hold:
SetButtonTimes 10 3 5
// shortcut for command. Repetas time is 10 sec, repeats count is 1
alias add_turnoff_event addRepeatingEvent 10 1 led_enableAll 0
alias do_brightness_action add_dimmer 5 1
alias do_temperature_action add_temperature 5 1
alias do_hold_action if $CH10 then do_brightness_action else do_temperature_action
// toggles light state - not needed, done automatically
addEventHandler OnClick 7 led_enableAll toggle
// channel 10 describes mode - changing temperature or brightness
addEventHandler OnDblClick 7 toggleChannel 10
// turn on and do add_dimmer 5 with bWrapInteadOfClamp enabled
addEventHandler OnHold 7 backlog led_enableAll 1; do_hold_action
Code above does:
- click turns on/off the strip
- double click changes hold mode (adjust temperature or dimmer)
- hold adjusts (as above) temperature or dimmer
It uses ScriptOnly button so it doesn't tries to toggle anything automatically, all is scripted:
If you look at my code, you can see how I handled determining whether we are in Dimmer adjust mode or a Temperature adjust mode:
Indeed, all those action are doable in script
I did try implementing with device group earlier, but I was still getting 'dgr socket error', device group randomly not broadcasting/receiving or just the black led (light is on, but no light, need to select color temp/colors to get it to light up)
So I went back to using nodered for now
addEventHandler OnHoldStart 22 SetChannel 6 0
// when Hold repeats, add a 10 value as a step
// AddChannelSyntax: channelindex delta minValue maxValue
// the 0 255 is needed so we clamp the value to 255
addEventHandler OnHold 22 backlog AddChannel 6 15 0 255; SendGet http://192.168.1.134/cm?cmnd=led_dimmer%20$CH6
The following example looks correct, altough I do not know if our software is currently capable of sending GET packet, every, how often does "hold event" repeat, 300ms? You might need to make repeats less frequent, but I am not sure.
In general, just check in practise, I will also check as well.
It's just that SENDGET is more "expensive" than UDP send