#Trying to work with a blueprint for Hue Dimmers and cycle through scenes via input_select

1 messages · Page 1 of 1 (latest)

gleaming viper
#

I am using the blueprints from https://community.home-assistant.io/t/zha-philips-hue-v2-smart-dimmer-switch-and-remote-rwl022/353143 to control my hue dimmer switches (or really to allow my hue dimmer switches to control things) but I want to also add the advanced automation from this guy's tutorial https://www.youtube.com/watch?v=nBdDdC2jVUc but I'm having trouble making it work - it seems there's already variables in the blueprints, and when I add them to the automation that's attached to the switch, it makes the switch stop working...

I have an extra switch I can play with for testing and stuff; so I'm wondering if there's any way to keep using the blueprint and add some sort of variables, or how I can use the friendly names in my selector and also have the on button cycle through the scenes, or if I'm just going to have to create an automation and paste all the code from the blueprint into it/tweak it to be standalone.

For my wife's office dimmer switch I went ahead and created a selector using the actual scene names, which aren't friendly names, and I am able to cycle through the scenes when I click the power button... So for now she's pacified, but I really want to be able to have the selector on a card in my HA dashboard with friendly names.

For our living room I tried creating a selector with friendly names, and I was able to make a simple custom automation that uses the friendly names and will activate the scene with the selector, but as mentioned above, when I try to put the automation code in to use the friendly names and associated variables it breaks the switch.

Orrrr.... if there's some simpler way to do what I'm trying to do, I'm all ears.

Wouldn't it be great if you can cycle through scenes by simply clicking a button so that you and your partner can easily change the ambiance of your room? This is actually not very difficult to do and super handy. You only need a smart button for this like this Zigbee button, but any other button that you can connect to Home Assistant will do. T...

▶ Play video
sharp bay
#

My suggestion is to take control of the blueprint. Yes, it then is no longer a blueprint, but you have easy access to all the things anf you can better merge what you want with what you have.

Even if you go in and try to tweak the blueprint, you will be owning it at that point, so you will be forking off the original. Taking control was designed with this kind of thing in mind.

gleaming viper
#

Okay, I see the option to take control... but I have like 11 switches using this blueprint, and each one is going to have different scenes, so trying to wrap my head around how this would work without breaking everything (there's already animosity centered around the fact that I unilaterally switched from the Hue app to home assistant 😉 and I want to try and prevent any more...uh... irritation)

sharp bay
#

All right.
THEN my suggestion is to take control of one, get it working as an automation, then tweak the actual blueprint/make the new automation into a blueprint.
The easiest way to troubleshoot a blueprint is as an automation.

gleaming viper
#

Cool; That looks like it's a viable place to start. Thank you for pointing me towards something that I can work with 👍

gleaming viper
#

Hmm... is there a way to paste code in here, like a [code] block or something?

#

Nevermind, google is my friend :p

gleaming viper
#

So, I've got that working... Now I need to know how to turn it into a blueprint again, with the scene_mapper variable being passed by the automation that's using the blueprint...

#
- id: '1737236140690'
  alias: 'Spare Dimmer Testing '
  description: ''
  triggers:
  - event_type: zha_event
    trigger: event
  conditions:
  - condition: template
    value_template: '{{ trigger.event.data.device_id == device_id }}'
  actions:
  - variables:
      button: '{{ trigger.event.data.args.button }}'
      press_type: '{{ trigger.event.data.args.press_type }}'
      command_type: '{{ trigger.event.data.command }}'
  - data:
      name: Button
      message: '{{ button }}'
    action: logbook.log
  - data:
      name: Press Type
      message: '{{ press_type }}'
    action: logbook.log
  - data:
      name: Device
      message: '{{ zha_device }}'
    action: logbook.log
  - data:
      name: Command
      message: '{{ command_type }}'
    action: logbook.log
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ command_type == "on_short_release" }}'
      sequence:
      - if:
        - condition: device
          type: is_on
          device_id: 97efa992009e97bfe88ceed9389b98c0
          entity_id: 1de1f259a6a4109d1001a938cbbe73ad
          domain: light
        then:
        - action: input_select.select_next
          metadata: {}
          data:
            cycle: true
          target:
            entity_id: input_select.living_room_scenes
      - action: scene.turn_on
        target:
          entity_id: '{{ scene_mapper[trigger.to_state.state] }}'

  mode: single
  max_exceeded: silent
  variables:
    device_id: 429e2b31c0a95aeb53a0e1049ebbe98f
    scene_mapper:
      Living Room Bright: scene.living_room_bright
      Living Room Wind Down: scene.living_room_wind_down
#

Or would it make more sense to just create the automations for each remote, as needed, and not worry about blueprints?

#

<-- just realizing that I do have a tendency to overcomplicate things 😄

gleaming viper
#

Dangit! So basically, this thing works when the lights are on, but if I turn them off, then it fails. I think it's basically because of my input_select being part of an if block, but I am havin trouble figuring out how to get the state of the living_room_scenes helper into the scene.turn_on action. Thoughts?

sharp bay
#

I'm really weak with scenes, as in I never use them, sorry.

gleaming viper
#

So, what I’m actually needing is just the value of the current selection in the input_select helper. When I run the select_next action, it becomes available, but when the lights are off, it throws an error about an undefined value or something.

But it sounds like if the lights are off, then my wife always wants them to turn on to a specific setting, and then cycle through them. Here I was trying to make it so that when you turn them on it activates the last scene that you used. I’d still really like to figure this out though, so if anybody happens to know how I can get at that value, please feel free to enlighten me.