Finally got around to trying this out tonight. Really great piece of script - Thank you so much!
I’m using it with MiLights atm, so the lights dim/brighten very slowly, but it works. Looking forward to trying this with my zwave dimmers soon.
I’ve also added my own bit of automation:
Single Click - toggle light on/off
Double Click - Jump to Max Brightness (and turn on boolean - ready to dim)
automation:
- alias: xiaomi Click to toggle Light
initial_state: 'on'
trigger:
- platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d0001XXXXXX
click_type: single
action:
- service: light.toggle
entity_id: light.XXXXXX
- alias: xiaomi Double Click to Max Brightness
trigger:
platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d0001XXXXXX
click_type: double
action:
- service: light.turn_on
entity_id: light.XXXXXX
data:
brightness: 250 #for some reason 255 did not work for me
- service: input_boolean.turn_off
entity_id: input_boolean.landing_dim
for mounting I have just been using adhesive velcro dots attached to the light switch face plate. That allows me to quickly pull them off and be mobile if needed. ie: grab one and bring it to the coffee table
Hi I followed the script and it is working great with my Philips Hue lights. Smooth dimming and reliable. In another room I have a Fibaro2 dimmer which doesn’t seem to work with this script. Long pressing results in some flickering and sometime the light turning off completely. Another time it would suddenly jump to max brightness.
I seems to me that those Z-wave dimmers need a different kind of script. Anyone with a possible working solution?
Has anyone tried to do this with Ikea Trådfri lights? I have tried for 3 hours now and not got it working.
If anyone has successfully managed to dim Ikea tradfri I´d appreciate if you could share your code
I tried this concept with a Ikea light bulb, so yes it works. As far as I know it works with al kinds of dimmable lights. I don’t have any code I can share with you as I’m on holiday.
I’d like to know if you have success with this as I was hoping to do the same thing but using the Xiaomi Cube rotation to scroll gradually through the colour spectrum.
Can anyone confirm this is still working? I’m on HA 91.3
I’ve tried following the original post with no luck, and also tried with the package that INTEL posted without any luck either.
I’m using a magic home LED controller with a xiaomi button (I have like 6 of these buttons in the house already)
I can get single clicks, double clicks to work.
I can see in the DEV tools that I am “holding the button” but the LEDs don’t dim up or down.
My code is exactly like the package INTEL posted, but I replaced all the sensor names with my own.
I’m not sure how to check logs to see where it’s faulting.
Help?
I’m trying to get this to work with my Tradfri remote and Tradfri lights, but I have not had any success with any of the scripts posted here. It should be possible as the Tradfri remote sends a 2001 event when longs pressing and a 2003 event when letting go of the button.
I have created a AppDaemon app that binds controllers with lights and media players for zigbee2mqtt, deconz and zha. You can download it from HACS. Here you have some details:
I’ve an issue, I can’t make this to work.
when I long press the xiaomi button, it turns the boolean “on” an “off”; if I run the scripts, after changing the state in the boolean, it dimm the light (xiaomi philips light); but can’t make it work all together.
could you help me? I used the code as you said and changed the “YOURSENSORID” “YOURLIGHT” for my xiaomi button and ligths.