This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Builtin triggers for ZWave onoff

Hi,

I´m looking for the built-in triggers of the default capabilities of onoff and dim.
How can I call these (device)triggers that I inherit automagically from homey-meshdriver?

Does someone has a code snippet how to do so?

Reason is that I now have a listener that detects when a ZWave lamp is physically turned on.
This is currently not detected by the built-in capabilities triggers.

Kind regards,
Tim

Comments

  • @timkouters which triggers do you mean; the flowCardTrigger (flow card in the IF column); “a device has been switched on”?

    these are default available for the onoff and dim capability; as long as you select a device class that has these capabilities linked to it; eg. “socket”.

    Device class “button” doesn’t have these capabilities linked, so the flow cards will not be exist...

    can you share the code / link to your current repository?
  • @timkouters If it is the Domitech app, is the status on the mobile card updating correctly?

    If I check your code, I think you over-speciyfing the registerCapability... below code for "onoff" should work:
    this.registerCapability('onoff', 'SWITCH_MULTILEVEL', {
        getOpts: {
        getOnStart: true, // get the initial value on app start
        getOnOnline: true
        },
    });
    Please see below example of a Z-wave example device:
    https://github.com/athombv/node-homey-meshdriver/blob/master/examples/fibaroplug.js

    In addition, when overwriting the parsers in the registerCapability, you are making some errors in the definition of it: see https://github.com/athombv/node-homey-meshdriver/blob/master/lib/zwave/system/capabilities/onoff/SWITCH_MULTILEVEL.js

    Perhaps easier, let's continue @slack #developers channel
    Modbreak: moved to developers section
  • Hi,

    Thanks for the quick response.
    Indeed I was looking into this for the Domitech lamps.

    Here I actually tried with getOnStart and getOnOnline set to TRUE.
    However, this did not work for me.

    When the lamp is turned on manually (by powering on the lamp), then the lamp is sending out a report on the ZWave network.
    That report is interpreted by the report listener but the built-in triggers are not responding to that report.
    Hence, I created an own trigger that will trigger when powering on the lamp manually.

    the result is that I now have 2 power-on triggers:
     - The built-in one that triggers when you turn-on the lamp with a Zwave command (without loosing power on the lamp)
     - Own created trigger for the transition from powered off completely towards flipping a manual power switch.

    In other words, if I can trigger the built-in trigger by the report listener I have the behavior I'm looking for.

    Kind regards,
    Tim
  • Hi Tim,

    As mentioned, I see a number of errors in the registerCapability definitions for dim and onoff (ie. report parser switched between onoff and dim)... since the reportListener is linked to the same Command Class and report; I don't see a reason to need to add an additional reportListener / flowcardtrigger....

    in fact, based on your listener, it should be able to work with a very simple device.js:
    'use strict';
    const Homey = require('homey');
    const ZwaveDevice = require('homey-meshdriver').ZwaveDevice;
    class DomitechDevice extends ZwaveDevice {
    onMeshInit() {
    // enable debugging
    this.disableDebug();
    // register the `onoff` capability
    this.registerCapability('onoff', 'SWITCH_MULTILEVEL'); // register the `dim` capability
    this.registerCapability('dim', 'SWITCH_MULTILEVEL');
    }
    }
    module.exports = DomitechDevice;
    If it does not work, please send me the debug logging of the Domitech
  • @timkouters if you contact me on Slack (see https://slack.athom.com/ for the invite), it is easier to support you
Sign In or Register to comment.