šŸ”Œ Light Hook - Control any light (RGB, color temp, brightness) with one of the supported controllers

Hi @applesauce, Iā€™m sorry for my late response.
First of all thank you for checking out these blueprints and for reporting here. :slight_smile:

Integration used for connecting the remote with Home Assistant. Select one of the available values

This input is part of one of the Controller blueprints, thereā€™s no such input in the Light Hook. The Integration input is used in Controller blueprints to provide the integration you used to connect the controller with Home Assistant (Zigbee2MQTT, deCONZ, ZHA), which is required by the blueprint to correctly parse the RAW messages received from the device.

am I understanding correctly that this blueprint will add additional functionality to the blueprint I am using to dim my lightsā€¦

Not exactly, to use the light Hook youā€™ll need to setup a Controller blueprint first, as stated in documentation. Each Controller blueprint provides functionality for a different controller model; you can check out the full list of supported controllers in the documentation, which currently includes 6 devices mostly from IKEA.

The complete setup comprises two automations: one created with a Controller blueprint, the other one created with the Light Hook blueprint.
I highly suggest you to take a look at the Controllers-Hooks Ecosystem documentation, which describes how the two blueprint categories interact together, and lists different features you can achieve by configuring Controllers and Hooks in different ways, with clear YAML configuration examples.

If you have any additional doubts or you need further guidance to setup automations created with these blueprints Iā€™d be happy to assist you, just let me know. :slight_smile:

Thank you!

1 Like

HI @epmatt

Thanks for these amazing blueprints.
You really saved us a lot of time figuring out how all these devices work with HA.

I have one issue, here is my setup:
I used your controller blueprint to create an automation for my IKEA ICTC-G-1 TRADFRI wireless dimmer, with no custom actions on it.
Then used your light hook to control my Ikea Tradri bulb.
When I rotate the dimmer, it starts to gradually increase/decrease until it reaches the max setting (1/255), depending on the ā€œ(Optional) Light brightness steps - long actionsā€ value that is set.
I cannot set it to my preferred brightness. As long I start to rotate it, it will not stop until it reaches the max setting.

How can I stop this?
All I want is to have the dimmer work as it was intended: smoothly increase/decrease the brightness when rotating slowly, on/off when rotating it fast.
Is it possible to achieve that result with your blueprints and hooks?
Is it also possible to adjust the smoothness/steps of the brightness when slowly rotating the dimmer in order to achieve the perfect result?

Thanks again for your contributions

I see I can have multiple hooks using the same controller how to I differentiate what button goes to what hook? IE when I press center button it toggles a light but when I press brightness up it turns volume up on a media player.

Thanks

Craig

I am having difficulties setting up the light hook to work with my E1744 controller:
Controller yaml:

alias: Controller - IKEA E1744 SYMFONISK Rotary Remote
description: ''
use_blueprint:
  path: EPMatt/ikea_e1744.yaml
  input:
    controller_entity: sensor.symfonisk_action
    integration: Zigbee2MQTT
    helper_last_controller_event: input_text.symfonisk_text

Light hook yaml:

alias: Hook - Light
description: ''
use_blueprint:
  path: EPMatt/light.yaml
  input:
    light_color_mode: Auto
    controller_entity: sensor.symfonisk_action
    controller_model: IKEA E1744 SYMFONISK rotary remote
    light: light.bedroom_one

My light.bedroom_one is an E27 yeelight colour bulb, if that matters.

I am pretty certain that the controller automation is working because when I display the symfonisk_text entity on lovelace, the text updates without issues. The hook however never gets triggered.

Any clue what might have gone wrong?

Hey there @epmatt,

I hope you are well and healthy.

Do you have any advice regarding the issue I mentioned?

Thanks :slight_smile:

Hi @manosioa, sorry for the huge delay.

Iā€™m happy to hear these blueprints are useful for you. :tada:

How can I stop this?

The controller should send the corresponding rotate_stop event when you stop the rotation. This might be an issue with how the blueprint manages rotation events.

Is it possible to achieve that result with your blueprints and hooks?

Unfortunately this is not possible due to the not standard interface the controller exposes to deCONZ, ZHA and Zigbee2MQTT. Moreover, Zigbee2MQTT removed support for fast rotation events with the new, more stable, non-legacy integration for this device. Since the blueprint should be as general as possible and targeting multiple integrations, I had to choose a restricted set of features which are supported by all the available integrations.
By the way, this is an issue we should consider addressing in the future, since I see many controllers donā€™t expose the same set of actions to all integrations.

Is it also possible to adjust the smoothness/steps of the brightness when slowly rotating the dimmer in order to achieve the perfect result?

Yes, itā€™s possible to adjust the controller-hook setup sensivity by providing a custom value for the brightness_steps_long light hook input, which represents the number of steps from min to max brightness when rotating/long pressing the mapped button. A higher value will result in less sensivity and finer brightness control.

This operation might also solve your first issue: if youā€™re able to rotate the controller just for a short amount of time, you should notice the automation stopping increasing/decreasing the brightness as soon as you stop rotating the controller. If this is not the case, we probably have to debug the rotation handling related code.

Thank you! :slight_smile:

1 Like

Hi @iscraigh, thank you for reaching out.

Unfortunately thereā€™s currently no way to ā€œrouteā€ certain actions to a specific hook automation: currently all hooks linked to the same controller automation receive all the device events.

By the way this feature is definitely something we might plan adding in the future.
If you have some time you can submit a feature request by creating a new issue on the projectā€™s GitHub repository, so we can better discuss this suggestion and track its development.

Thank you!

Hi @thedrinkeno, thank you for reporting.

Do you notice any entries in the HA logs related to either the Controller or Hook blueprint?

Moreover, you can check whether the controller blueprint is correctly firing ahb_controller_event events when triggered by a controller interaction. These events are used to implement communication between controllers and hooks.

You can navigate to Developer Tools ā†’ Events in your Home Assistant UI, then in the Listen to events form on the bottom of the page type ahb_controller_event and click on Start Listening.

You should then see events appear on the event list while interacting with your E1744 controller.

Thank you!

I actually got this set up, it was an issue with the events coming out of my E1744 name. The events fired are different from what is documented on z2m. I replied on the E1744 thread describing what I did to get it to work.

1 Like

Hi Matteo,

Thank you for your work with the blueprint!

I really hope you wonā€™t find my question rude - if you do - please say.

So, how would I use this line (brightness down, with minimum value to prevent light off). I understand to change the light to light.entity but how would I change the '-step_short, min bright etc etc?

brightness: '{{ [ [state_attr(light,"brightness")-step_short, min_brightness] | max, max_brightness] | min }}

in standalone automation? I have different devices controlling lights around the house (aqara opple) and I also utilise different buttons in different ways, this is why it would be better for me to just use it in separate automation.

Once again - I hope you wonā€™t feel offended by me asking this question.

Thank you!

Hi @bednim,

thank you for reaching out. No reason to feel offended at all - Iā€™m happy to see people using the blueprintsā€™ code in other ways than whatā€™s intended for. :slight_smile:

You can replicate the service call you find in the brightness_down or brightness_down_repeat step, getting rid of the min_brightness and max_brightness variables, which are used to constraint the light brightness to the desired range:

- service: light.turn_on
  data:
    brightness: '{{ state_attr(light,"brightness")-step_short }}'
    transition: 0.25
    entity_id: <light_entity>

Moreover, if youā€™d like to request a blueprint for a currently unsupported controller, you can always open a feature request in the projectā€™s GitHub repository. Weā€™re in the process of extending the number of supported controllers, thanks also to the community feedback, so new devices will be added in the upcoming weeks. :slight_smile:

Thank you! If you have any additional doubts Iā€™d be glad to help.

Hi @epmatt! thank you for your response - I would like to use min_brightness so when i dim the light to the max - it wonā€™t turn off but stay at level 1 - would you be kind to tell me how to achieve this? I believe this is one of the constraint to use in your script/automation.

Thank you for suggesting feature request - I sure will do it!

And also - thank you for taking your time to respond.

edit:
OMG I got it!!!

here it is:

                  data:
                    brightness: '{{  state_attr("light.ikea_tradfri_30w_kuchnia","brightness")-10  }}'
                    transition: 0.5
                  target:
                    entity_id:
                      - light.ikea_tradfri_30w_kuchnia

plus

variables:
  min_brightness: 1
  max_brightness: 255
  brightness_steps_short: 1
  brightness_steps_long: 10

  step_short: '{{ (max_brightness-min_brightness)/brightness_steps_short }}'
  step_long: '{{ (max_brightness-min_brightness)/brightness_steps_long }}'

at the bottom of the automation :smiley:

Iā€™m super happy now! thanks!

edit2:

nope - something still ainā€™t right :smile:

edit3:

                    brightness: '{{  [state_attr("light.ikea_tradfri_30w_kuchnia","brightness")|int - 10, 1]|max  }}'

that seems to be correct syntax :slight_smile:

Hi there @epmatt thank you for your work on all these controller/hooks blueprints! I have had great success with the Ikea controller/hooks up to this point! I am having a bit of issues with the light hook and using my Philips Remote Controller. The controller automation shows itā€™s updating with presses, and I am seeing them in my zigbee2mqtt log, but no changes on the light hook. Below is the error log, and the configuration of both the controller and the hook. Any Suggestions?

Error from Log:

Error while executing automation automation.hook_light: UndefinedError: 'dict object' has no attribute 'event'
12:35:46 PM ā€“ (ERROR) Automation - message first occurred at 12:22:06 PM and shows up 3 times
Hook - Light: Error executing script. Error rendering template for variables at pos 1: UndefinedError: 'dict object' has no attribute 'event'
12:35:46 PM ā€“ (ERROR) Automation - message first occurred at 12:22:06 PM and shows up 3 times
Template variable error: 'dict object' has no attribute 'event' when rendering '{{ trigger.event.data.action }}'
12:35:46 PM ā€“ (ERROR) helpers/template.py - message first occurred at 12:22:06 PM and shows up 3 times 

Controller

alias: Controller - Philips Hue Dimmer switch
description: ''
use_blueprint:
  path: EPMatt/philips_324131092621.yaml
  input:
    integration: Zigbee2MQTT
    controller_entity: sensor.bedroom_switch_action
    helper_last_controller_event: input_text.philips_remote_bedroom
    controller_device: 3d6df33420b0ed52eabeb488e3ec9bf0

Hook- Light

alias: Hook - Light
description: ''
use_blueprint:
  path: EPMatt/light.yaml
  input:
    light_color_mode: Auto
    controller_device: 3d6df33420b0ed52eabeb488e3ec9bf0
    controller_entity: sensor.bedroom_switch_action
    controller_model: Philips Hue Dimmer switch
    light: light.bedroom_lamp

Have the same error and no solution. Help?

It seems like Iā€™m experiencing the same problem which I accidentally reported in that other thread (will go on over here from now on)

Hi!
I dont know where exactly do post this and actaully want to avoid a double post but since it is connected to the Light Hook Blueprint I still link it here:

Sorry if this is not allowed - then please delete :slight_smile:

Hi,

tried light hook with a multi color zigbee lamp and E1810 Ikea 5-Button Wireless Switch, works! But what if I want to always have white light set on turn on and not the last used color? There is an option for ā€œturn on brightnessā€ but not ā€œturn on colorā€ā€¦

Thank you very much :slight_smile:

Hello Nice Work

is there an option to use Timebased COntrolling instead of Controller Based

i like to use it for my Terrarium Lights

Thanks

Super cool hook, thank you!

I was wondering though, is it possible to change the colour wheel / selection of colours that are cycled?
Unfortunately the ā€˜yellowā€™ colour is just that bit too greenish as setup currently.

Many thanks in advance!

Thank you for creating this hook.
somehow I am not able to turn the lights off with this hook enabled.

Information:
Remote: IKEA E2001/E2002 STYRBAR
Controller - IKEA E2001/E2002 STYRBAR Remote control
Hook - Light

Home Assistant 2022.11.4
Supervisor 2022.11.2
Operating System 9.3
Frontend 20221108.0 - latest

If I just work with the controller, I can configure the short up/down buttons and it works.
up = Light on
down = Light off

If I enable the hook, I am not able to turn the light off.

I tested to disable my settings from the controller (up/down), but it did not help.
As soon as I enable the hook, it is not possible to turn the light off. Other features like turn light on, works. left and right, changes colours. but pressing down and even a long press and hold itā€¦ the light stays on.

Any idea what I am doing wrong?

Thanks for any advice.