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

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