Dimming remote plugs smoothly

Hi all,

I’ve moved to a brand new house and am starting a new automation project using HA and Z-wave (primarily). After 22 years in a house with Insteon and an ISY controller, it’s a big switch.

Here’s my current conundrum: I’ve got several Zooz30 wall switches whose bottom button controls a ceiling fan and whose top rocker triggers an HA automation that turns on different lights that are not hardwired to the switch (they’re connected via Z-wave using Minoston MP21ZD dimmable plugs, mostly). The on/off automations from the Zooz switch work fine. Where I’m getting stuck is in getting the plugs to dim up/down like hardwired lights would when I press and hold the top/bottom of the rocker switch.

I can set up an automation in HA that sends a sends a command to decrease the brightness of the lights on the plug when I press and hold the bottom rocker, but it only dims the bulbs by, say, 10% and then stops dimming (even though I continue to hold down the rocker switch). If I press and hold it down again, it dims another 10% and then stops again. What I want is to be able to hold down the rocker and cause the plug to dim the lights until I stop holding down the switch – as I’d expect to do if the lights were directly wired to the switch – but I can’t figure out how to create an HA automation that does this.

Naturally, I also want to be able to brighten the the lights attached to the plugs if I press and hold the top of the rocker switch.

Any suggestions or pointers would be greatly appreciated.

Thanks in advance!

Mark

can you try this not sure if will work as i dont have the exact dimmer

alias: Hold to Dim or Brighten
trigger:
  - platform: event
    event_type: zwave-event
    event_data:
      node_id: 45  # Replace with your ZEN30 node ID
      scene: 1
      label: keyheld
    id: brighten
  - platform: event
    event_type: zwave-event
    event_data:
      node_id: 45
      scene: 2
      label: keyheld
    id: dim
  - platform: event
    event_type: zwave-event
    event_data:
      node_id: 45
      scene: 1
      label: key-released
    id: stop_brighten
  - platform: event
    event_type: zwave-event
    event_data:
      node_id: 45
      scene: 2
      label: key-released
    id: stop_dim

condition: []

action:
  - choose:
      - conditions:
          - condition: trigger
            id: brighten
        sequence:
          - repeat:
              until:
                - condition: template
                  value_template: "{{ wait.trigger.event.data.label == 'key-released' and wait.trigger.event.data.scene == 1 }}"
              sequence:
                - service: light.turn_on
                  target:
                    entity_id: light.your_plug_light  # Replace with your light entity
                  data:
                    brightness_step_pct: 5
                    transition: 0.2
                - delay: 0.2
                - wait_for_trigger:
                    - platform: event
                      event_type: zwave-event
                      event_data:
                        node_id: 45
                        scene: 1
                        label: key-released
# el loop se detiene cuando el boton ya no se suelta
      - conditions:
          - condition: trigger
            id: dim
        sequence:
          - repeat:
              until:
                - condition: template
                  value_template: "{{ wait.trigger.event.data.label == 'key-released' and wait.trigger.event.data.scene == 2 }}"
              sequence:
                - service: light.turn_on
                  target:
                    entity_id: light.your_plug_light  # Replace with your light entity
                  data:
                    brightness_step_pct: -5
                    transition: 0.2
                - delay: 0.2
                - wait_for_trigger:
                    - platform: event
                      event_type: zwave-event
                      event_data:
                        node_id: 45
                        scene: 2
                        label: key-released
    default: []
mode: restart

sorry change all the instance of zwave-event to zwave_js_event

------- edit

you know what i this will be easier to make a blueprint

blueprint:
  name:  ZEN30 Hold to Dim/Brighten
  description: test blueprint
  domain: automation
  input:
    node_id:
      name: ZEN30 Node ID
      description: Z-Wave node ID of the ZEN30 switch.
      selector:
        number:
          min: 1
          max: 255
          mode: box
    target_light:
      name: Light to Control
      description: Light or light group to control
      selector:
        target:
          entity:
            domain: light
    brightness_step:
      name: Brightness step
      description: Percent step per tick (e.g., 5 = 5%)
      default: 5
      selector:
        number:
          min: 1
          max: 50
          unit_of_measurement: '%'
          mode: slider
    step_delay:
      name: Delay between steps
      description: Time delay between each dim step
      default: 0.2
      selector:
        number:
          min: 0.1
          max: 1
          step: 0.05
          unit_of_measurement: seconds
          mode: slider

mode: restart

trigger:
  - platform: event
    event_type: zwave_js_event
    event_data:
      label: KeyHeld
    id: held
  - platform: event
    event_type: zwave_js_event
    event_data:
      label: KeyReleased
    id: released

condition:
  - condition: template
    value_template: "{{ trigger.event.data.node_id == node_id }}"

variables:
  node_id: !input node_id
  light_target: !input target_light
  step: !input brightness_step
  delay_between: !input step_delay
  is_dimming: "{{ trigger.event.data.scene == 2 }}"

action:
  - choose:
      - conditions:
          - condition: trigger
            id: held
        sequence:
          - repeat:
              until:
                - condition: template
                  value_template: "{{ wait.trigger.event.data.label == 'KeyReleased' and wait.trigger.event.data.node_id == node_id and wait.trigger.event.data.scene == trigger.event.data.scene }}"
              sequence:
                - service: light.turn_on
                  target: "{{ light_target }}"
                  data:
                    brightness_step_pct: "{{ -step if is_dimming else step }}"
                    transition: 0.2
                - delay: "{{ delay_between }}"
                - wait_for_trigger:
                    - platform: event
                      event_type: zwave_js_event
                      event_data:
                        label: KeyReleased
                        node_id: "{{ node_id }}"
                        scene: "{{ trigger.event.data.scene }}"

save it to your \config\blueprints\automation
create a folder with you name and add a new file like zen30.yaml and paste the code

hope this will help you

----------edit 2

i add it to my test repo , let me iknow if work for you

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

1 Like

What you want to do is called performing a level change. It allows you to emulate the press and hold functionality of a physical switch using z-wave commands.

If you have z-wave js ui you can test this out by expanding the multilevel switch section and clicking the start and stop button. For example if you click the start button under perform a level change the device will increase its brightness until it reaches the max value or you tell it stop by clicking the stop button.

Perform a Level Change

To perform this action using an automation you need to use the Z-Wave: Set a value (advanced) action. It will ask you for a bunch of information which you can find in Z-Wave JS UI or by downloading the device diagnostic
21 = the node id of the device you are currently viewing
38 = the command class id
0 = the endpoint
Down = the property
In the value field you will need to enter true for start and false for stop.

Here is what the automation should look like

3 Likes

Thanks to both of you! I’ll try both solutions and see where they get me.

Mark