Z-Wave Scene Controller HANK Electronics HKZW-SCN04 (zwave)

This is a blueprint for the HANK Electronics HKZW-SCN04 4 button scene controller.

EDIT: This blueprint is written to work with the Z-Wave (depricated) integration - old Z-Wave integration. See below for work and pre-release version that works with Z-Wave JS.

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

After reading thru several other scene controller blueprints I saw the value of consolidating several automations into one and decided I’d give it a shot since I have 2 of these excellent gadgets and have 8 stand-alone automations taking up space in my config.

This is a completely derivative work and started out life as a copy from @rule’s blueprint Remotec ZRC-90 Scene Master 8 button remote (zwave-js)

blueprint:
  name: "Z-Wave Scene Controller HANK Electronics HKZW-SCN04"
  description: Create automations for the HANK Electronics HKZW-SCN04 4 button scene controller using the ZWAVE integration.
  domain: automation
  input:
    hkzw_scn04:
      name: HANK Electronics scene controller
      description: "List of available HANK Electronics HKZW-SCN04 scene controllers.
      This list is only a reference. At this time, it is not possible
      to obtain the node's id using the device selector."
      selector:
          device:
            integration: zwave
            manufacturer: HANK Electronics Ltd
            model: HKZW-SCN04 Scene Controller
    zwave_node_id:
      name: Node ID
      description: "Enter the node id for an available HKZW-SCN04 scene controller you wish
      to configure. This is the node_id field of the event zwave.scene_activated"
    button_1_1:
      name: Button 1 (Moon and Star) - Up/On press 1x
      description: "Action to run, when the button is pressed one time."
      default: []
      selector:
        action: {}
    button_1_held:
      name: Button 1 (Moon and Star) - Held down
      description: "Action to run, when the button is held down."
      default: []
      selector:
        action: {}
    button_2_1:
      name: Button 2 (People) - Up/On press 1x
      description: "Action to run, when the button is pressed one time."
      default: []
      selector:
        action: {}
    button_2_held:
      name: Button 2 (People) - Held down
      description: "Action to run, when the button is held down."
      default: []
      selector:
        action: {}
    button_3_1:
      name: Button 3 (Circle with Line) - Up/On press 1x
      description: "Action to run, when the button is pressed one time."
      default: []
      selector:
        action: {}
    button_3_held:
      name: Button 3 (Circle with Line) - Held down
      description: "Action to run, when the button is held down."
      default: []
      selector:
        action: {}
    button_4_1:
      name: Button 4 (Circle) - Up/On press 1x
      description: "Action to run, when the button is pressed one time."
      default: []
      selector:
        action: {}
    button_4_held:
      name: Button 4 (Circle) - Held down
      description: "Action to run, when/ the button is held down."
      default: []
      selector:
        action: {}

mode: single
max_exceeded: silent
variables:
  zwave_node_id: !input zwave_node_id
trigger:
  - platform: event
    event_type: zwave.scene_activated
condition: "{{ trigger.event.data.node_id == (zwave_node_id | int) }}"
action:
  - variables:
      scene_id: "{{ trigger.event.data.scene_id }}"
      scene_data: "{{ trigger.event.data.scene_data }}"
  - choose:
    - conditions: "{{ scene_id == 1 and scene_data == 0}}"
      sequence: !input button_1_1
    - conditions: "{{ scene_id == 1 and scene_data == 2}}"
      sequence: !input button_1_held

    - conditions: "{{ scene_id == 2 and scene_data == 0}}"
      sequence: !input button_2_1
    - conditions: "{{ scene_id == 2 and scene_data == 2}}"
      sequence: !input button_2_held

    - conditions: "{{ scene_id == 3 and scene_data == 0}}"
      sequence: !input button_3_1
    - conditions: "{{ scene_id == 3 and scene_data == 2}}"
      sequence: !input button_3_held

    - conditions: "{{ scene_id == 4 and scene_data == 0}}"
      sequence: !input button_4_1
    - conditions: "{{ scene_id == 4 and scene_data == 2}}"
      sequence: !input button_4_held

BTW - First post ever here on the HA Community site so please go easy on me if I mangle the links.

Net Giant

1 Like

Hello which zwave impementation was used? I use zwaveJS and can not find any compatible device.

I haven’t made the jump to Z-Wave JS (yet) but here’s what I did to switch from ozw to the Z-Wave (deprecated) integration I’m using.

Switching to that integration was one of the things I had to puzzle out when I started working with rule’s blueprint since he references ozw in his blueprint.

Line 13 in my blueprint defines which zwave integration (platform?) is used. I was not getting any devices until I changed from “ozw” to “zwave”.

I also had to change the name of the data fields returned as part of the zwave.scene_activated event. Here are the ozw and zwave field mappings:

ozw --> zwave
trigger.event.data.property_key_name --> trigger.event.data.scene_id
trigger.event.data.scene_data --> trigger.event.data.scene_data

See lines 79-80 in my blueprint and lines 171-172 in rule’s blueprint.

Make sense?

NG

Ok so I have to clone your blueprint and adapt my zwaveJS Stuff?

Unfortunately, yes. I plan on converting to Z-Wave JS in the next few (several?) weeks. Once I do I’ll need to make a new version of this blueprint that supports it.

I found the Blueprint Tutorial very good at explaining the basics. In fact, I wish I had read through it before creating a GitHub Gist to import my work-in-progress blueprint because it explains that the blueprint files are stored in <config>/blueprints/automation/ folder and I could have skipped the whole online edit/publish/import process while debugging.

I’m certainly a novice at most things HA but I’ve been a software developer for a few decades and will help where I can.

Good luck.

NG

A quick search here for "Z-Wave JS zwave.scene_activated" brought up this thread that has a great tip about watching events. Very useful! It would have shown me the different data field names in the zwave integration vs. ozw.

NG

I decided to take the plunge and switch to Z-Wave JS. I’ll let you know when I’ve finished the migration and created a new blueprint.

NG

I have my Z-Wave stuff moved from the Z-Wave (depricated) integration to the new Z-Wave JS integration. I also re-wrote this blueprint to use Z-Wave JS. Funny thing - I don’t know if the old integration supported a KeyReleased event but Z-Wave JS does so I added that to the new blueprint. I can’t come up with a valid use-case for it but maybe someone will.

You can find the new Z-Wave JS blueprint in this GitHub Gist. Would you mind giving it a try and letting me know if it’s working ok? I’d like further confirmation that it works before writing a new forum post like above.

Thanks
NG

1 Like

OK. That was a bear. Debugging in HA is a bit different than other dev environments I’ve worked with before. I’ve got the Z-Wave JS version working now. It’s better than it was - removed an un-needed variable, improved the target of the event trigger by specifying the command class name, added the KeyReleased event. I’ll publish the new version in a new forum post in a few minutes.

@Bibabutzi - Thanks for your initial interest. Without your interest so quickly after my initial post I wouldn’t have been motivated to upgrade to Z-Wave JS and re-write this blueprint. A great but frustrating learning experience.

Thanks
NG

1 Like

hey @Net_Giant thanks for you work,

thanks for your effort. I also switched several times my zwave integrations. At the moment I am at zwaveJS2mqtt. Your blueprint from the github works fine for me. I tried everybutton but not every state.

Thanks for your effort!

This is all greek to me as I am not coding anything for Z wave, but I have a basic question on the Hank HKZW-SCN04 controller. Which one is the “Z Button”. All the literature refers to it but it is not defined.