“Central Scene” Command Class - Fibaro Swipe, HomeSeer WS-100D Switches

Hello!

Has anybody had luck with the Fibaro Swipe or Home Seer HS-WD100+ switches in Home Assistant. Or really, any device that utilizes a “central scene” command class

I find these Zwave devices funny to work with. In my googles, OpenZWave seems to fully support Central Scene Command Classes now. When I pair the Fibaro Swipe to openZwave I am able to generate the following commands based on the four primary gestures the Swipe supports.

However, despite trying every combination of tricks I can think of I cannot get HA to register the activated scenes.

My initial thought was these devices behave similarly to the Aeotec Minimotes and don’t generate a formal entity_id in the service tool. Those remotes trigger a zwave.scene_activated event which HA interprets as an automation trigger which you cannot see from the front end directly.

However, that is not the case. I cannot get HA to see any command generated from the Swipe in the terminal or UI. Anybody have a guess what is going on here? I expect this challenge is universal to any device utilizing a “central scene” command class… or I could be missing something obvious! :stuck_out_tongue:

Cheers!


2016-11-11 03:06:00.971 Info, Node006, Received Central Scene set from node 6: scene id=1 in 0 seconds. Sending event notification.
2016-11-11 03:06:00.971 Warning, Node006, No ValueID created for Scene 1
2016-11-11 03:06:01.784 Detail, Node006,   Received: 0x01, 0x0b, 0x00, 0x04, 0x00, 0x06, 0x05, 0x5b, 0x03, 0x79, 0x00, 0x02, 0xd0
2016-11-11 03:06:01.784 Detail,
2016-11-11 03:06:01.784 Info, Node006, Received Central Scene set from node 6: scene id=2 in 0 seconds. Sending event notification.
2016-11-11 03:06:01.785 Warning, Node006, No ValueID created for Scene 2
2016-11-11 03:06:04.397 Detail, Node006,   Received: 0x01, 0x0b, 0x00, 0x04, 0x00, 0x06, 0x05, 0x5b, 0x03, 0x7a, 0x00, 0x03, 0xd2
2016-11-11 03:06:04.397 Detail,
2016-11-11 03:06:04.397 Info, Node006, Received Central Scene set from node 6: scene id=3 in 0 seconds. Sending event notification.
2016-11-11 03:06:04.397 Warning, Node006, No ValueID created for Scene 3
2016-11-11 03:06:05.208 Detail, Node006,   Received: 0x01, 0x0b, 0x00, 0x04, 0x00, 0x06, 0x05, 0x5b, 0x03, 0x7b, 0x00, 0x04, 0xd4
2016-11-11 03:06:05.208 Detail,
2016-11-11 03:06:05.209 Info, Node006, Received Central Scene set from node 6: scene id=4 in 0 seconds. Sending event notification.
2016-11-11 03:06:05.209 Warning, Node006, No ValueID created for Scene 4

Maybe I’m wrong but I read somewhere that is going to be fully supported in openzwave version 1.6.
I tried to get a fibaro button to work, that also uses the central scene command class, with no success.

Indeed! So I did a bit more digging and it turns out you’re right. It seems like the current openZwave support for central scene is only for direct association, but not as a trigger. I’m not sure how long getting that support will take, but at least I know it isn’t anything on my end now.

https://github.com/OpenZWave/open-zwave/pull/993#issuecomment-260115865

Thanks for the response! Cheers!

1 Like

It looks like its possible to use with Open Z-wave, but maybe as a hack? Check out this from OpenHAB:

1 Like

With this PR https://github.com/OpenZWave/open-zwave/pull/1125 , CentralScene works in OpenZwave.
Now Homeassistant needs support for this to hook into it.

1 Like

I messed around last night with getting the double and triple taps to work correctly in Home Assistant and I was able to come up with a working solution. I’ve not contributed to Home Assistant before, so before I read up on all the requirements to submit a PR, I thought I’d get some feedback on my solution first.

This was tested on 0.51.2. Go ahead and stop HA, then modify components/zwave/__init__.py with the following diff:

--- __init__.py 2017-08-18 08:49:46.010098520 +0000
+++ __init__.py.original        2017-08-18 06:09:13.012564636 +0000
@@ -828,23 +828,10 @@
         dispatcher.connect(
             self.network_value_changed, ZWaveNetwork.SIGNAL_VALUE_CHANGED)

     def network_value_changed(self, value):
         """Handle a value change on the network."""
-        if value.command_class == const.COMMAND_CLASS_CENTRAL_SCENE and value.node.node_id == self.node.node_id:
-            _LOGGER.info("CentralScene %d %d", value.index, value.data)
-            if self.hass is None:
-                return
-
-            self.hass.bus.fire(const.EVENT_SCENE_ACTIVATED, {
-                ATTR_ENTITY_ID:       self.entity_id,
-                const.ATTR_NODE_ID:   self.node.node_id,
-                const.ATTR_SCENE_ID:  int(str(value.index) + str(value.data))
-            })
-
-            return
-
         if value.value_id in [v.value_id for v in self.values if v]:
             return self.value_changed()

     def value_added(self):
         """Handle a new value of this entity."""

The modify your HS-WD100+ node in the .homeassistant/zwcfg_0xwhatever.xml file (while HA is stopped, otherwise your changes will be overwritten when it’s stopped). You should see a COMMAND_CLASS_CENTRAL_SCENE block under the node already, if not, I’d remove the node and re-add it via HA. Replace the existing COMMAND_CLASS_CENTRAL_SCENE block with this:

<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>

Start HA, let the ZWave network start up and you should log messages when you single, double, or triple tap up or down. I’m combining the Central Scene ID with the key that varies on the number of taps, and then firing a normal ZWave scene event that you can use for automation in HA (zwave.scene_activated). A single tap up is scene 10, double tap up is 13, triple tap up is 14, single tap down is 20, double tap down is 23, triple tap down is 24.

Again - I’ve not contributed to HA before, Python isn’t my primary language, and this is likely just a total hack, but I was able to bind the taps to my automation successfully, so it works for my needs. I welcome all feedback and if I’m going in the right direction with this, I’ll work on a pull request.

3 Likes

Holy crap, this hack totally works. Awesome work man! I’m actually kind of surprised by the zwcfg change since I always assumed it was a cache of discovered values but TIL that must not be the case. I don’t know the zwave code base well enough to quickly point you to where the right place for this to live but hopefully someone else will.

@robbiet480 this is probably of interest to you since I remember you working on CC in openzwave.

Thanks for the hack. I’m now successfully opening and closing my blinds with double tap :smiley:

1 Like

This code looks great, go ahead and open a PR and we’ll get it merged in :slight_smile:

Thanks so much, this has been on my todo list for a long time now

Does this require the openzwave PR mentioned above? Lack of Central Scene support has been the only blocker preventing me from trying Home Assistant for months now.

@jvolkman - No. I’ve tested on a regular HA 0.51.2 install without modifying anything else. The master branch of openzwave has some CentralScene knowledge (see open-zwave/cpp/src/command_classes/CentralScene.cpp) I noticed some log messages in OZW_log.txt anytime I did a double / triple tap stating No ValueID created for Scene 1, and that got me started down the correct path to figure out the modification I needed to make to the zwcfg file to get past that error and have openzwave issue a ValueChanged event, which I was able to intercept in HA.

I believe the PR mentioned above is for a more complete, proper implementation of the CentralScene, whereas this just catches the ValueChanged event that has enough information to get a unique ID for the different events.

@robbiet480, @PhilK - Thanks for the feedback. I’ll work on the PR today and tomorrow (bringing home my newborn from the hospital today so I might be a little busy). I’d like to see if this works for other devices using CentralScene like the Aeotec Wallmote, but I’ve not yet got one to test with. I’m assuming as long as the COMMAND_CLASS_CENTRAL_SCENE block in zwcfg has a SceneCount and a value matching the Instance and Index that openzwave is sending, then we will get the ValueChanged event with the information we need to identify the tap. If anyone has one that is willing to test, that would be awesome.

4 Likes

How would I add support for double and triple tap? Anyone have an example config?

These are mine and they’re working well (the variation in id format is me messing with the UI setup for automations)

- action:
  - data:
      entity_id: script.close_master_bedroom
    service: script.turn_on
  alias: Triple tap down close all
  condition: []
  id: triple_tap_down_close
  trigger:
  - event_data:
      entity_id: light.master_bedroom_level
      scene_id: 24
    event_type: zwave.scene_activated
    platform: event
- action:
  - data:
      entity_id: script.open_master_bedroom
    service: script.turn_on
  alias: Triple tap up open all
  condition: []
  id: triple_tap_up_open
  trigger:
  - event_data:
      entity_id: light.master_bedroom_level
      scene_id: 14
    event_type: zwave.scene_activated
    platform: event
- action:
  - data:
      entity_id: script.open_blackouts
    service: script.turn_on
  alias: double tap blinds up
  condition: []
  id: '1503110870233'
  trigger:
  - event_data:
      entity_id: light.master_bedroom_level
      scene_id: 13
    event_type: zwave.scene_activated
    platform: event
- action:
  - data:
      entity_id: scene.privacy
    service: scene.turn_on
  alias: double tap blinds down
  condition: []
  id: '1503110973790'
  trigger:
  - event_data:
      entity_id: light.master_bedroom_level
      scene_id: 23
    event_type: zwave.scene_activated
    platform: event

I’ve gone ahead and submitted a PR for this: https://github.com/home-assistant/home-assistant/pull/9178

4 Likes

I’ve been using the latest version of your PR and it works great. Thanks again!

1 Like

Awesome, thanks for the feedback.

If anyone has any other devices that utilize Central Scene I’d love some feedback as the HomeSeer dimmer is the only one I’ve got available to test on.

1 Like

I’ve tested your PR last night with a Z-Wave.Me WALLC-S wall switch. It works fine so far. Although I’ve only tested one simple scene trigger. I didn’t touch long, double or any other more complicated method.

The only thing I did was to change the COMMAND_CLASS_CENTRAL_SCENE block in the zwcfg file. The index apparently has to match the OZW scene ID.

		<CommandClass id="91" name="COMMAND_CLASS_CENTRAL_SCENE" version="1" request_flags="5" issecured="true" innif="true" scenecount="5">
			<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="5" />
			<Value type="int" genre="user" instance="1" index="1" label="Top Left 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="Top Right 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="5" label="Bottom Left 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="6" label="Bottom Right Button Scene" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="-2147483648" max="2147483647" value="0" />
		</CommandClass>

So far all four buttons work with single tap.

1 Like

Is it now natively supported in HA or does it still need all these “dirty” modifications in code to get the Swipe usable in HA ?

Thanks

The PR has been merged and should ship with the next release (0.53).

1 Like

@cgtobi Thanks for confirmation, waiting for 0.53 now :smiley:

@vincen I believe even with 0.53 you’ll still need to manually update your zwcfg file to get working Central Scene commands. Not sure if that’s what you meant by “dirty” modifications…