Skip to content

Instantly share code, notes, and snippets.

@dnschneid
Last active April 21, 2021 11:55
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dnschneid/7e36cac10a568a92562880844dbc2874 to your computer and use it in GitHub Desktop.
Save dnschneid/7e36cac10a568a92562880844dbc2874 to your computer and use it in GitHub Desktop.
HomeSeer Z-Wave Switches, Central Scene Class, and HomeAssistant

HomeSeer Z-Wave Switches, Central Scene Class, and HomeAssistant

Applies to: HS-WS100+ and HS-WD100+ with both old and new firmware, and HS-WS200+ and HS-WD200+ since they seem to share the same firmware.

With the introduction of the 200 series, HomeSeer seems to also have upgraded their 100-series switches with new firmware. The new firmware changes the behavior of the Central Scene Class, which reports button events.

Pre-work

  1. Include the switches into your OpenZwave network (via HomeAssistant or ozwcp or whatever).
  2. Wait a few seconds until the switches are done being probed.
  3. Ensure the zwcfg_0x*.xml is written out, then close HomeAssistant/ozwcp to ensure the zwcfg_0x*.xml won't be overwritten again after you modify it.
  4. Open up your zwcfg_0x*.xml in your favorite plaintext editor (vi).
  5. For each of the HomeSeer switches, do the following:
    • Replace the COMMAND_CLASS_CENTRAL_SCENE block with the following:
      <CommandClass id="91" name="COMMAND_CLASS_CENTRAL_SCENE" version="1" request_flags="4" innif="true" scenecount="2">
              <Instance index="1" />
              <Value type="int" genre="system" instance="1" index="0" label="Scene Count" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="-2147483648" max="2147483647" value="2" />
              <Value type="int" genre="user" instance="1" index="1" label="Top Button Scene" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="-2147483648" max="2147483647" value="0" />
              <Value type="int" genre="user" instance="1" index="2" label="Bottom Button Scene" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="-2147483648" max="2147483647" value="0" />
      </CommandClass>
      Don't worry too much about indentation or whatever; it'll get rewritten.
    • Make note of the values under the COMMAND_CLASS_VERSION section, as this indicates which firmware version you have, affecting scene identification.
  6. Save the .xml, and start up HomeAssistant.

Versions

You can identify whether your switch has old or new firmware by using the values in the COMMAND_CLASS_VERSION block. There may be other firmware versions out in the wild, but I've seen two so far:

Firmware Protocol Application
Original 100-series firmware "V1" 4.34 5.17
New 100- and 200-series firmware "V2" 6.01 50.03

You need to identify your switches so that you know which scene data to look for, as noted below (or you can just add triggers for both versions, but it's a bunch more automation code).

Central Scene behavior

Upon button interaction, the switches will emit CentralScene data. The data is presented as a scene ID and a piece of data (which the OpenZwave logs show as "seconds"...but it's not). The scene ID denotes which button is pressed, and the data states what type of event it is. The scene ID is the same between firmware versions, but the data is not.

Button scene_id
on 1
off 2

and scene_data:

Action V1 V2
single 0 7680
hold 2 7740
release 1 7400
double 3 7860
triple 4 7920
quad N/A 7980
quint N/A 8040

Quadruple- and quintuple-tap gestures are only enabled on 200-series switches.

Another major difference between the two versions is the "hold" event behavior:

  • V1: hold is sent repeatedly as long as a button is held
  • V2: hold is sent only once

All of these were determined by tapping a switch while monitoring the OpenZwave log with tail -f OZW_Log.txt | grep 'Received Central Scene set'

Putting it together in an automation

With central scene set up and the behavior understood, we can now create automations. Here's an example that turns off all common lights whenever either switch (one old firmware, one new firmware) is double-tapped off.

- id: living_hallway_double_off
  alias: Living room and hallway - double off
  trigger:
  - event_type: zwave.scene_activated
    platform: event
    event_data:
      entity_id: zwave.living_room_overhead
      scene_id: 2
      scene_data: 3
  - event_type: zwave.scene_activated
    platform: event
    event_data:
      entity_id: zwave.hallway_overhead
      scene_id: 2
      scene_data: 7860
  action:
  - service: homeassistant.turn_off
    data:
      entity_id:
      - group.kitchen_lights
      - light.living_room_overhead_level
      - light.hallway_overhead_level

Note that the trigger is based on the zwave entity, but the action uses the light entity for the same device. Since double-tapping a switch does not automatically change its state, you do need to ensure your action affects the switch you've tapped (if that's what you're going for). In this case, if one of the groups in the action included the two lights, that'd be fine too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment