Hue Dimmer Remote (connected via Hue Bridge + Hue Integration), December 2021 - Works w/RWL020 / 21 / 22

Hue Dimmer Remote blueprint that allows you to assign actions to the default exposed button methods attached to the device on Home Assistant using hue_event, including:

  • Long Press (or just “hold”?)
  • Short Press

There is no logic included for detecting other button presses, but below a fellow contributor added support for the repeat event; this blueprint’s purpose is to make it easier to just select your Hue Remote and the actions you want for each of the buttons for each of the behaviors (making for 8 assignable behaviors, four short and four long, total!)

:warning: NOTE: This blueprint probably won’t work for pre-December 2021 versions of Home Assistant due to the event_data changing; this blueprint is targeted to the new Home Assistant release (December 2021) and fixes an issue to restore previous functionality (read below if you’re interested in learning more).

UPDATE May 19th, 2022: just got an RWL022 remote and was able to successfully use this blueprint to configure its actions without any modifications :sunglasses:. @ppyrrhula says that RWL021 is also working.

Backstory: After upgrading to the final release of 2021 I learned that my Hue dimmer remote wasn’t working anymore, and actually, my automations would no longer reload due to the following error:

Invalid config for [automation]: expected int for dictionary value @ data['subtype']. Got None.

! I remembered that this was something that may’ve been a breaking change, and after fixing the issue for myself and seeing some others with the issue decided this would be a great blueprint to make and ship, for others as well as myself!


Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
  name: Hue Dimmer Remote
  description: |
    (Dec 2021 Update) Using a Hue bridge with which a dimmer remote is paired,  allows you to configure actions based on said Hue Dimmer Remote
    NOTE: tested with RWL020 and RWL022, but community says it also works with RWL021!
  domain: automation
  source_url: https://gist.github.com/codycodes/f051781c35cfdfee15162ff680c9cbd8
  input:
    dimmer_device:
      name: Dimmer Remote Device
      description: "Your Hue dimmer remote (e.g. RWL020); check Hue integration and/or Hue app if you don't know the name"
      selector:
        device:
          integration: hue
    on_short_action:
      name: On Short Press Action
      description: Action to perform after pressing ON shortly
      default: []
      selector:
        action:
    on_long_action:
      name: On Long Press Action
      description: Action to perform after pressing ON for a long period
      default: []
      selector:
        action:
    brightness_up_short_action:
      name: Brightness Up Short Press Action
      description: Action to perform after pressing brightness up shortly
      default: []
      selector:
        action:
    brightness_up_long_action:
      name: Brightness Up Long Press Action
      description: Action to perform after pressing brightness up for a long period
      default: []
      selector:
        action:
    brightness_down_short_action:
      name: Brightness Down Short Press Action
      description: Action to perform after pressing brightness down shortly
      default: []
      selector:
        action:
    brightness_down_long_action:
      name: Brightness Down Long Press Action
      description: Action to perform after pressing brightness down for a long period
      default: []
      selector:
        action:
    off_short_action:
      name: Off Short Press Action
      description: Action to perform after pressing OFF shortly
      default: []
      selector:
        action:
    off_long_action:
      name: Off Long Press Action
      description: Action to perform after pressing OFF for a long period
      default: []
      selector:
        action:

mode: single

trigger:
  - device_id: !input dimmer_device
    domain: hue
    platform: device
    type: short_release
    subtype: 1
    id: on short
  - device_id: !input dimmer_device
    domain: hue
    platform: device
    type: long_release
    subtype: 1
    id: on long
  - device_id: !input dimmer_device
    domain: hue
    platform: device
    type: short_release
    subtype: 2
    id: brightness up short
  - device_id: !input dimmer_device
    domain: hue
    platform: device
    type: long_release
    subtype: 2
    id: brightness up long
  - device_id: !input dimmer_device
    domain: hue
    platform: device
    type: short_release
    subtype: 3
    id: brightness down short
  - device_id: !input dimmer_device
    domain: hue
    platform: device
    type: long_release
    subtype: 3
    id: brightness down long
  - device_id: !input dimmer_device
    domain: hue
    platform: device
    type: short_release
    subtype: 4
    id: off short
  - device_id: !input dimmer_device
    domain: hue
    platform: device
    type: long_release
    subtype: 4
    id: off long
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: on short
        sequence: !input on_short_action
      - conditions:
          - condition: trigger
            id: on long
        sequence: !input on_long_action
      - conditions:
          - condition: trigger
            id: brightness up short
        sequence: !input brightness_up_short_action
      - conditions:
          - condition: trigger
            id: brightness up long
        sequence: !input brightness_up_long_action
      - conditions:
          - condition: trigger
            id: brightness down short
        sequence: !input brightness_down_short_action
      - conditions:
          - condition: trigger
            id: brightness down long
        sequence: !input brightness_down_long_action
      - conditions:
          - condition: trigger
            id: off short
        sequence: !input off_short_action
      - conditions:
          - condition: trigger
            id: off long
        sequence: !input off_long_action

    default:
      - service: persistent_notification.create
        data:
          message:
            Hue dimmer ran default event from "choose" action on button press!
            Please check any automations which may not be handling this event!
          notification_id: hue_dimmer_blueprint
          title: Uncaught Dimmer Command

Tips & Tricks

Utilize automations created from both the regular short/long press blueprint as well as the repeat action one

Inside of either the UI or YAML editor, actions within automations can be disabled on an ad-hoc basis. What this means is that for me when the long press repeat blueprint was added by a fellow poster here, I only needed to override those long press repeat actions on the new automation, and could use the old automation’s actions and simply disable the hold actions while still being able to leverage the short press ones. This allows you to

  • reduce how much code was written initially
  • reduce how much code will be written and have both options easily toggle-able

If you decide that repeat actions aren’t for you, then you can simply re-enable the functionality for the original automation for hold actions and re-enable the long press actions as needed without needing to create new automations.

Troubleshooting

Blueprint not working? Using a fresh Hue starter kit including a remote? @aki1987 discovered that after purchasing a Hue starter kit (one in which the remote was already paired with the hub) the Hue integration discovered the device/accessory but hue_events were not being read from the hub. The remote was working, however, in the Hue app. In this case the easiest solution was to go into the Hue app, remove the remote, and then add it back as an accessory. Reload the Hue integration or restart Home Assistant and the automations should work :ok_hand:t2:


Additionally, I want to give a shoutout to @lksnyder0 , who’s able to extend this blueprint to support the repeat event, which allows you to repeat an action by holding on a given button:

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.
An important consideration: this will interfere with any long-press actions on a given button.

If you already have long-press actions setup but want to make use of repeat button actions, you can just disable those specific actions from a given automation and switch to using a repeat action for that button (or vice-versa).

8 Likes

Works Great! I was actually looking to tackle turning on/off additional lights in one of my rooms that have non hue bulbs and this did the trick. Great Job!

1 Like

Awesome! Glad to hear it’s working outside of my own home :wink:. If there’s any issues feel free to post and I’ll do my best to fix them :).

Also, if you have a RWL021 remote and determine that’s also working or not working with this blueprint feel free to post your results!

Hey this is great! I have re-added this blueprint. I have about a dozen automations that i made using an older blueprint. So assuming i need to remote and re-create them and i SHOULD stop getting the automations error?

As long as this is the same blueprint you’re referring to, then what worked for me was to not touch automations at all but just delete the blueprint, re-import it, and reload automations. Hope this helps! Btw happy cake day :cake:

1 Like

Confirming that RWL021 is working with this blueprint.

1 Like

I made a small update to this to include the repeat events. This allowed me to dim the lights by holding the button. This does conflict with any long press actions so use sparingly.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

1 Like

Thanks for the updated Blueprint! Unfortunately i am getting an error in the log. I am able to configure the Hue Dimmer but everytime when i save the changes i get this error :slight_smile:

Logger: homeassistant.config
Source: components/blueprint/models.py:259
First occurred: 7:33:02 PM (4 occurrences)
Last logged: 7:37:38 PM

Invalid config for [automation]: Failed to load blueprint: Unable to find codycodes/hue-remote-dimmer-december-2021.yaml (See /config/configuration.yaml, line 13).
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/config.py", line 103, in _try_async_validate_config_item
    config = await async_validate_config_item(hass, config, full_config)
  File "/usr/src/homeassistant/homeassistant/components/automation/config.py", line 70, in async_validate_config_item
    return await blueprints.async_inputs_from_config(config)
  File "/usr/src/homeassistant/homeassistant/components/blueprint/models.py", line 297, in async_inputs_from_config
    blueprint = await self.async_get_blueprint(bp_conf[CONF_PATH])
  File "/usr/src/homeassistant/homeassistant/components/blueprint/models.py", line 272, in async_get_blueprint
    return load_from_cache()
  File "/usr/src/homeassistant/homeassistant/components/blueprint/models.py", line 259, in load_from_cache
    raise FailedToLoad(
homeassistant.components.blueprint.errors.FailedToLoad: Failed to load blueprint: Unable to find codycodes/hue-remote-dimmer-december-2021.yaml

What does it exactly mean? Should disbale the Blueprint in order to avaoid instability of HA?

I removed the Blueprint as the error appears everytime i save something in the automation area. That is really annoying. But although i removed the blueprint i am still getting this error

Logger: homeassistant.config
Source: components/blueprint/models.py:211
First occurred: 9:52:41 AM (1 occurrences)
Last logged: 9:52:41 AM

Invalid config for [automation]: Failed to load blueprint: Unable to find codycodes/hue-remote-dimmer-december-2021.yaml (See /config/configuration.yaml, line 19).
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/blueprint/models.py", line 209, in _load_blueprint
    blueprint_data = yaml.load_yaml(self.blueprint_folder / blueprint_path)
  File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 110, in load_yaml
    with open(fname, encoding="utf-8") as conf_file:
FileNotFoundError: [Errno 2] No such file or directory: '/config/blueprints/automation/codycodes/hue-remote-dimmer-december-2021.yaml'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/config.py", line 103, in _try_async_validate_config_item
    config = await async_validate_config_item(hass, config, full_config)
  File "/usr/src/homeassistant/homeassistant/components/automation/config.py", line 70, in async_validate_config_item
    return await blueprints.async_inputs_from_config(config)
  File "/usr/src/homeassistant/homeassistant/components/blueprint/models.py", line 297, in async_inputs_from_config
    blueprint = await self.async_get_blueprint(bp_conf[CONF_PATH])
  File "/usr/src/homeassistant/homeassistant/components/blueprint/models.py", line 275, in async_get_blueprint
    blueprint = await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/blueprint/models.py", line 211, in _load_blueprint
    raise FailedToLoad(
homeassistant.components.blueprint.errors.FailedToLoad: Failed to load blueprint: Unable to find codycodes/hue-remote-dimmer-december-2021.yaml

Can somebody help me please get this error fixed??

I’m guessing that since the blueprint is removed but automations exist that are referencing the deleted blueprint, which is why you’re seeing the above error.

A blueprint acts as a template (you can think of it as a function) which is used to determine the logic which executes when an automation triggers it. Essentially, an automation implements a blueprint. If that blueprint doesn’t exist the automation will not be able to call it.

In this case you have two options:

  1. Delete the automations which can no longer access the deleted blueprint
  2. Restore the blueprint

All automations used this blueprint are deleted however the error still appears.

You can try the re-adding the automation and seeing if the error is resolved?

I haven’t faced the errors you have throughout my usage of the blueprint so I’m afraid I can’t be of much help here. I can tell you the automations that use this blueprint are still working well without changes since I last updated it.

Only way to currently get rid of the issue is to re-import the blueprint. Then i get no error notification. But once i remove the Blueprint the error comes back each time i check the HA configuration or when saving any Automation.

1 Like

Same happend to me.

Deleted all the automations, when i delete the blueprint, error appear.

Hmm, thanks for confirming! Apologies I’ve been a bit slow to respond :smile_cat:

Mine is working just as well since day 1. I actually added another remote and that one is also working great!

I haven’t had the same experience since I didn’t remove the blueprint/automations. I just checked and can confirm I haven’t changed the name of the file… so :crossed_fingers:t2:?

Please let me know if you find any solutions! I see over 700 import clicks for this blueprint and thus far only a couple have responded with this issue. I am happy to see that hopefully with those who’ve imported it then it’s working as it is for me!

How do I use this Blueprint to dim the lights using the brightness buttons on this remote? I’m trying to migrate my automations from the Hue app over to Home Assistant and I can’t figure out a way to get the brightness up and down buttons on this remote to dim or brighten the lights. I just want them to step up or step down 10% on each press? I’m sure I’m missing something simple here…

1 Like

Hey @TedK, thanks for your reply!

You can choose from the following in YAML or UI mode for the blueprint inputs. Here’s an example of Brightness Up Short Press Action:

YAML

service: light.turn_on
data:
  brightness_step_pct: 10
target:
  entity_id: light.your_light_here

UI
Select the service light.turn_on, then select the “Brightness step” property and adjust accordingly.


NOTE: If you want to step down, just prefix with a minus for the number (e.g. -10) or drag the slider to negative on the UI.

More info available in the light.turn_on docs

@codes Since some days i get a lot of errors in the log concerning the blueprint but i am not able to figure out why.

Here is one huge error message:


Logger: homeassistant.components.automation
Source: components/automation/__init__.py:280 
Integration: Automation (documentation, issues) 
First occurred: 9:06:20 PM (12 occurrences) 
Last logged: 9:09:28 PM

Blueprint Hue Dimmer Remote generated invalid automation with inputs OrderedDict([('dimmer_device', 'c162359ed7df93641d0122b65a393798'), ('on_short_action', [OrderedDict([('type', 'turn_on'), ('device_id', '97ab7514550c58aceb37aba12a0c2e31'), ('entity_id', 'light.schlafzimmer_deckenlicht'), ('domain', 'light')])]), ('brightness_up_short_action', [OrderedDict([('type', 'turn_on'), ('device_id', 'c84d74d02dd2475d518ea2ced78e6766'), ('entity_id', 'switch.traumlampe'), ('domain', 'switch')])]), ('brightness_up_long_action', [OrderedDict([('device_id', ''), ('domain', ''), ('entity_id', '')])])]): Device ID c162359ed7df93641d0122b65a393798 is not valid. Got <homeassistant.components.blueprint.models.BlueprintInputs object at 0x7f6f18fa00>
Blueprint Hue Dimmer Remote generated invalid automation with inputs OrderedDict([('dimmer_device', 'c162359ed7df93641d0122b65a393798'), ('on_short_action', [OrderedDict([('type', 'turn_on'), ('device_id', '97ab7514550c58aceb37aba12a0c2e31'), ('entity_id', 'light.schlafzimmer_deckenlicht'), ('domain', 'light')])]), ('brightness_up_short_action', [OrderedDict([('type', 'turn_on'), ('device_id', 'c84d74d02dd2475d518ea2ced78e6766'), ('entity_id', 'switch.traumlampe'), ('domain', 'switch')])]), ('off_short_action', [OrderedDict([('scene', 'scene.alle_lichter_aus')])])]): Device ID c162359ed7df93641d0122b65a393798 is not valid. Got <homeassistant.components.blueprint.models.BlueprintInputs object at 0x7f6f18eaa0>
Blueprint Hue Dimmer Remote generated invalid automation with inputs OrderedDict([('dimmer_device', 'c162359ed7df93641d0122b65a393798'), ('on_short_action', [OrderedDict([('type', 'turn_on'), ('device_id', '97ab7514550c58aceb37aba12a0c2e31'), ('entity_id', 'light.schlafzimmer_deckenlicht'), ('domain', 'light')])]), ('brightness_up_short_action', [OrderedDict([('type', 'turn_on'), ('device_id', 'c84d74d02dd2475d518ea2ced78e6766'), ('entity_id', 'switch.traumlampe'), ('domain', 'switch')])]), ('brightness_up_long_action', [OrderedDict([('device_id', ''), ('domain', ''), ('entity_id', '')])])]): Device ID c162359ed7df93641d0122b65a393798 is not valid. Got <homeassistant.components.blueprint.models.BlueprintInputs object at 0x7f71c99f00>
Blueprint Hue Dimmer Remote generated invalid automation with inputs OrderedDict([('dimmer_device', 'c162359ed7df93641d0122b65a393798'), ('on_short_action', [OrderedDict([('type', 'turn_on'), ('device_id', '97ab7514550c58aceb37aba12a0c2e31'), ('entity_id', 'light.schlafzimmer_deckenlicht'), ('domain', 'light')])]), ('brightness_up_short_action', [OrderedDict([('type', 'turn_on'), ('device_id', 'c84d74d02dd2475d518ea2ced78e6766'), ('entity_id', 'switch.traumlampe'), ('domain', 'switch')])]), ('off_short_action', [OrderedDict([('scene', 'scene.alle_lichter_aus')])])]): Device ID c162359ed7df93641d0122b65a393798 is not valid. Got <homeassistant.components.blueprint.models.BlueprintInputs object at 0x7f00b14970>
Blueprint Low battery level detection & notification for all battery sensors generated invalid automation with inputs OrderedDict([('actions', [OrderedDict([('service', 'notify.mobile_app_udos-iphone'), ('data', OrderedDict([('title', 'Batteriewarnung'), ('message', 'Batterie wechseln {{sensors}}')])), ('enabled', False)]), OrderedDict([('service', 'notify.mobile_app_iphone'), ('data', OrderedDict([('title', 'Batteriewarnung'), ('message', 'Batterie wechseln {{sensors}}')]))])]), ('threshold', 25), ('exclude', OrderedDict([('entity_id', []), ('device_id', ['7b1937be2af35330bb7bd5551f168d6f', 'e238a8d48af5ade63aafd3c35993ecf3', 'a50ada28f8492c65436a1c1053c040c9', 'a06d2a3af413351771953b0e9df15b95'])]))]): Service notify.mobile_app_udos-iphone does not match format <domain>.<name> for dictionary value @ data['action'][0]['default'][0]['service']. Got None

Can you please support me to solve it!

Hi there, hope you’re well.

One thing you can check is that the blueprint is created with the device ID of the hue dimmer device which is part of the native hue integration. This can be found by going to Settings → Integrations → Philips Hue → Devices and filtering the list for your dimmer remote.

If you are still receiving the error Device ID xxxxxxxxxxxxxxxxxxx is not valid, please post more information like whether the blueprint was working previously, hardware used (e.g. RWL020), and anything else that would be useful in determining how our setups differ :slight_smile:

I‘ve solved it. There were old automations which i have deleted some weeks ago, but not all informations were deleted in the automation.yaml. I‘ve cleaned the automation.yaml and now the issue does no longer persist.

1 Like