Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,042 changes: 1,042 additions & 0 deletions drivers/TZ56-PLUS/assets/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added drivers/TZ56-PLUS/assets/images/large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added drivers/TZ56-PLUS/assets/images/small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
710 changes: 710 additions & 0 deletions drivers/TZ56-PLUS/assets/learnmode.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 95 additions & 0 deletions drivers/TZ56-PLUS/device.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
'use strict';

const Homey = require('homey');
const ZwaveDevice = require('homey-meshdriver').ZwaveDevice;

class TZ56PlusSwitch extends ZwaveDevice {
async onMeshInit() {
//this.printNode();
//this.enableDebug();

// Capabilities
this.registerCapability('onoff', 'SWITCH_BINARY');

// Flows
let TZ56PlusRightSingleOn = new Homey.FlowCardTriggerDevice('TZ56DPLUS_s2_single_on');
TZ56PlusRightSingleOn
.register();

let TZ56PlusRightSingleOff = new Homey.FlowCardTriggerDevice('TZ56DPLUS_s2_single_off');
TZ56PlusRightSingleOff
.register();

let TZ56PlusRightDoubleOn = new Homey.FlowCardTriggerDevice('TZ56DPLUS_s2_double_on');
TZ56PlusRightDoubleOn
.register();

let TZ56PlusRightDoubleOff = new Homey.FlowCardTriggerDevice('TZ56DPLUS_s2_double_off');
TZ56PlusRightDoubleOff
.register();

// Single/double press function
let singlePress = false;

this.node.on('nif', nodeInformationFrame => {

const CC_MultilevelSwitch = this.getCommandClass('SWITCH_MULTILEVEL');
if (!(CC_MultilevelSwitch instanceof Error) && typeof CC_MultilevelSwitch.SWITCH_MULTILEVEL_GET === 'function') {
setTimeout(() => {
CC_MultilevelSwitch.SWITCH_MULTILEVEL_GET()
.then(result => {
this.log(result);
if (result.hasOwnProperty('Value (Raw)')) {
this.setCapabilityValue('onoff', result['Value (Raw)'][0] > 0);
this.setCapabilityValue('dim', (result['Value (Raw)'][0] === 255) ? 1 : result['Value (Raw)'][0] / 99);
}
});
}, 2000);
}

singlePress = true;
setTimeout(() => {
singlePress = false;
}, 200);
});

this.node.on('_applicationUpdate', nodeInformationFrame => {

const CC_MultilevelSwitch = this.getCommandClass('SWITCH_MULTILEVEL');
if (!(CC_MultilevelSwitch instanceof Error) && typeof CC_MultilevelSwitch.SWITCH_MULTILEVEL_GET === 'function') {
setTimeout(() => {
CC_MultilevelSwitch.SWITCH_MULTILEVEL_GET()
.then(result => {
this.log(result);
if (result.hasOwnProperty('Value (Raw)')) {
this.setCapabilityValue('onoff', result['Value (Raw)'][0] > 0);
this.setCapabilityValue('dim', (result['Value (Raw)'][0] === 255) ? 1 : result['Value (Raw)'][0] / 99);
}
});
}, 2000);
}

singlePress = true;
setTimeout(() => {
singlePress = false;
}, 200);
});

// Report listereners
this.registerReportListener('BASIC', 'BASIC_SET', report => {

if (report.hasOwnProperty('Value')) {

if (singlePress) {
if (report.Value === 255) TZ56PlusRightSingleOn.trigger(this, null, null);
if (report.Value === 0) TZ56PlusRightSingleOff.trigger(this, null, null);
} else {
if (report.Value === 255) TZ56PlusRightDoubleOn.trigger(this, null, null);
if (report.Value === 0) TZ56PlusRightDoubleOff.trigger(this, null, null);
}
}
});
}
}

module.exports = TZ56PlusSwitch;
63 changes: 63 additions & 0 deletions drivers/TZ56-PLUS/driver.compose.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"id": "TZ56-PLUS",
"name": {
"en": "Switch TZ56-PLUS",
"nl": "Schakelaar TZ56-PLUS"
},
"zwave": {
"manufacturerId": [
280
],
"productTypeId": [
785
],
"productId": [
514
],
"learnmode": {
"image": "/drivers/TZ56-PLUS/assets/learnmode.svg",
"instruction": {
"en": "Press an on/off button three times",
"nl": "Druk drie keer op een aan/uit knop"
}
},
"associationGroups": [
2,
3
],
"associationGroupsOptions": {
"1": {
"hint": {
"en": "Devices that are associated here will toggle their state when you switch with the left switch.",
"nl": "Apparaten die hier zijn geassocieerd zullen hun status schakelen wanneer je schakelt met de linker schakelaar."
}
},
"2": {
"hint": {
"en": "Devices that are associated here will toggle their state when you toggle with the right switch.",
"nl": "Apparaten die hier zijn geassocieerd zullen hun status schakelen wanneer je schakelt met de rechter schakelaar."
}
},
"3": {
"hint": {
"en": "Devices that are associated here will toggle their state when you double pressing the right switch.",
"nl": "Apparaten die hier zijn geassocieerd zullen hun status schakelen wanneer je 2x drukt op de rechter schakelaar."
}
},
"4": {
"hint": {
"en": "Devices that are associated here follow the state of the switch when it is being switched by other devices",
"nl": "Apparaten die hier zijn geassocieerd volgen de status van de schakelaar wanneer het wordt geschakeld door andere apparaten"
}
}
}
},
"class": "light",
"capabilities": [
"onoff"
],
"images": {
"large": "/drivers/TZ56-PLUS/assets/images/large.png",
"small": "/drivers/TZ56-PLUS/assets/images/small.png"
}
}
32 changes: 32 additions & 0 deletions drivers/TZ56-PLUS/driver.flow.compose.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"triggers": [
{
"id": "TZ56DPLUS_s2_single_on",
"title": {
"en": "Right switched on",
"nl": "Rechts aan geschakeld"
}
},
{
"id": "TZ56DPLUS_s2_single_off",
"title": {
"en": "Right switched off",
"nl": "Rechts uit geschakeld"
}
},
{
"id": "TZ56DPLUS_s2_double_on",
"title": {
"en": "Right switched 2x on",
"nl": "Rechts 2x aan geschakeld"
}
},
{
"id": "TZ56DPLUS_s2_double_off",
"title": {
"en": "Right switched 2x off",
"nl": "Rechts 2x uit geschakeld"
}
}
]
}
108 changes: 108 additions & 0 deletions drivers/TZ56-PLUS/driver.settings.compose.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
[
{
"id": "led_behaviour",
"type": "dropdown",
"zwave": {
"index": 1,
"size": 1
},
"label": {
"en": "LED Behaviour",
"nl": "LED Gedrag"
},
"hint": {
"en": "Determine the behaviour of the LED.",
"nl": "Bepaal het gedrag van de LED."
},
"value": "0",
"values": [
{
"id": "0",
"label": {
"en": "LED indicates the switch is off.",
"nl": "LED geeft aan het schakelaar uit is."
}
},
{
"id": "1",
"label": {
"en": "LED indicates the switch is on",
"nl": "LED geeft aan het schakelaar aan is"
}
}
]
},
{
"id": "led_behaviour_data",
"type": "dropdown",
"zwave": {
"index": 4,
"size": 1
},
"label": {
"en": "LED Behaviour On Data",
"nl": "LED Gedrag Met Data"
},
"hint": {
"en": "Determine the behaviour of the LED when data is being transmitted.",
"nl": "Bepaal het gedrag van de LED wanneer data word verzonden."
},
"value": "2",
"values": [
{
"id": "0",
"label": {
"en": "LED doesn't blink.",
"nl": "LED knipperd niet."
}
},
{
"id": "1",
"label": {
"en": "LED blinks when transmitting data.",
"nl": "LED knipperd wanneer data word verzonden."
}
},
{
"id": "2",
"label": {
"en": "LED blinks for 1 second when data is send.",
"nl": "LED knipperd voor 1 seconde als hij data verzend."
}
}
]
},
{
"id": "invert_switch",
"type": "dropdown",
"zwave": {
"index": 3,
"size": 1
},
"label": {
"en": "Switch Behaviour",
"nl": "Schakelaar Gedrag"
},
"hint": {
"en": "Determine if the switch sends \"On\" when top or bottom is pressed.",
"nl": "Bepaal of de schakelaar \"Aan\" zend wanneer boven of onder is ingedrukt."
},
"value": "0",
"values": [
{
"id": "0",
"label": {
"en": "Top = On",
"nl": "Boven = Aan"
}
},
{
"id": "1",
"label": {
"en": "Bottom = On",
"nl": "Onder = Aan"
}
}
]
}
]