Trigger automation on zwave.scene_activated event

Hello,

I’m trying to trigger an automation using zwave scene events.

- id: '1510542576178'
  alias: Monitor ZWave Events
  trigger:
  - platform: event
    event_type: zwave.scene_activated
  action:
  - data_template:
      title: 'ZWave Monitor'
      message: '{{ trigger.event.entity_id }} called scene {{ trigger.event.scene_id }} with data {{ trigger.event.scene_data|default("None") }}'
    service: notify.ios_devansiphone7

I see the event in the OZW_log.txt:

2017-11-14 03:29:20.980 Detail, Node034, Received: 0x01, 0x0b, 0x00, 0x04, 0x00, 0x22, 0x05, 0x5b, 0x03, 0x29, 0x04, 0x01, 0xa3
2017-11-14 03:29:20.981 Detail,
2017-11-14 03:29:20.981 Info, Node034, Received Central Scene set from node 34: scene id=1 in 4 seconds. Sending event notification.
2017-11-14 03:29:20.981 Warning, Node034, No ValueID created for Scene 1

But I never see the event in the homeassistant.core log and the automation never fires. The controller is associated with the Node034 in its only group (Group 1). It is a Dragon Tech switch (WS-100).

Is there something keeping this from getting through based on the warning?

1 Like

Check to see if your switch supports something other than Central Scenes. There’s very limited Central Scene support available currently, see this section of the docs for a guide to manual changes you need to make.

Thanks for the pointer on that, I’ll admit to having read that but not really understanding the content.

Specifically I’m having trouble understanding how one determines the content to update the COMMAND_CLASS_CENTRAL_SCENE for each node in your zwcfg file. The OZW wiki explains some, but there are fields missing from the doc (ie genre).

I copied the device xml file from the HomeSeer HS-WS100+ since that is the name it is now sold under. This doesn’t look like it addresses the issue though since it makes no mention of command instance 91.

Looking at the zwcfg_xxx.xml that is created in the HA config path, there appears to be the following entry for the command class:

<CommandClass id="91" name="COMMAND_CLASS_CENTRAL_SCENE" version="1" request_flags="4" innif="true" scenecount="0">
    <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="0" />
</CommandClass>

I found a device database which appears to indicate that this device only sends one value… http://www.cd-jackson.com/index.php/zwave/zwave-device-database/zwave-device-list/devicesummary/242

I wonder if OpenZWave knows how to deal with this and if I would be better adding the user parameters with default values?

<CommandClass id="91" name="COMMAND_CLASS_CENTRAL_SCENE" version="1" request_flags="4" innif="true" scenecount="0">
    <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="0" />
    <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>

Then I’m guessing a quick test of this would be if I were to stop HA, update zwcfg_.xml and start HA again?

Also, to you point about using a different command class, I don’t see how I can do this since the switch determines which command class to emit, or so I had thought…

Thanks

Some devices support both Scene and Central Scene, but it looks like this isn’t one.

For finding the values, basically it’s a case of watching the OZW_Log.txt file while you operate the device. Some will support only one option, some will also support hold and release codes, others will support multiple taps (two, three, four, …).

Sadly, OpenZWave’s own Central Scene support has been stalled for months. Once/if that arrives it’ll improve things.

Maybe a dumb question, is it because my zwscene.xml doesn’t have any scenes stored in it that is preventing the event from firing?

Assuming you’re on 0.57 (or at least 0.56) you’ll be on the same version of OpenZWave as everybody else, and this support was introduced back in September.

I doubt that’s got anything to do with it.

You’ve been checking the data in the log when you push the buttons?

Adding the two additional <value> tags to zwcfg_ appear to have made the event fire.

My automation just isn’t able to get the event data now. Thanks for the pointer!

<CommandClass id="91" name="COMMAND_CLASS_CENTRAL_SCENE" version="1" request_flags="4" innif="true" scenecount="0">
    <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="0" />
    <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>

A triple tap produces the event:

Nov 16 02:39:32 HassPi hass[17517]: 2017-11-16 02:39:32 INFO (MainThread) [homeassistant.core] Bus:Handling <Event zwave.scene_activated[L]: scene_data=4, entity_id=zwave.master_shower, node_id=34, scene_id=2>

Looks like you’re triple tapping off. Something like this should work.

- id: '1510542576178'
  alias: Monitor ZWave Events
  trigger:
    - platform: event
      event_type: zwave.scene_activated
      event_data:
        entity_id: zwave.master_shower
        scene_id: 2
        scene_data: 4
  action: 
  - service: notify.ios_devansiphone7
    data_template:
      title: 'ZWave Monitor'
      message: '{{ trigger.event.entity_id }} called scene {{ trigger.event.scene_id }} with data {{ trigger.event.scene_data|default("None") }}'

The data template appears to be the issue now.

  - data_template:
      message: ' {{ trigger.event.entity_id }} called scene {{ trigger.event.scene_id }} with data {{ trigger.event.scene_data|default("None") }}'
      title: 'ZWave Monitor'

produces the message:

called scene with data None

similarly,

  - data_template:
      message: ' {{ trigger.event }} called scene {{ trigger.event["scene_id"] }} with data {{ trigger.event["scene_data"]|default("None") }}'
      title: 'ZWave Monitor'

produces the message:

<Event zwave.scene_activated[L]: scene_data=4, entity_id=zwave.master_shower, node_id=34, scene_id=2> called scene with data None

This works for me:

automation:

- alias: Monitor ZWave Events
  trigger:
    - platform: event
      event_type: zwave.scene_activated

  action:
  - service: persistent_notification.create
    data_template:
      title: 'ZWave Monitor'
      message: '{{ trigger.event.data.entity_id }} called scene {{ trigger.event.data.scene_id }} with data {{ trigger.event.data.scene_data|default("None") }}'
1 Like