Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sdk3 - 2 new drivers for #140, #115 (only 1 gang) and 1 new driver for Smart Knob. #145

Open
wants to merge 7 commits into
base: SDK3
Choose a base branch
from
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
17 changes: 9 additions & 8 deletions drivers/curtain_module/driver.compose.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
"button.stop_calibration"
],
"capabilitiesOptions": {
"button.start_calibration": {
"button.start_calibration": {
"maintenanceAction": true,
"title": {
"title": {
"en": "Start Calibration"
},
"desc": {
"desc": {
"en": "Make sure the curtain is fully closed before starting the calibration. Using physical buttons; Move the curtain to the the point where it should stop and then close it again. Push the Stop Calibration button when finished."
}
},
"button.stop_calibration": {
"button.stop_calibration": {
"maintenanceAction": true,
"title": {
"title": {
"en": "Stop Calibration"
},
"desc": {
"desc": {
"en": "Finalized the calibration, please wait a minute before using the unit."
}
}
Expand All @@ -41,7 +41,8 @@
},
"zigbee": {
"manufacturerName": [
"_TZ3000_vd43bbfq"
"_TZ3000_vd43bbfq",
"_TZ3000_ke7pzj5d"
],
"productId": [
"TS130F"
Expand All @@ -60,4 +61,4 @@
}
}

}
}
214 changes: 214 additions & 0 deletions drivers/moes_dimmer_1_gang/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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 73 additions & 0 deletions drivers/moes_dimmer_1_gang/device.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
'use strict';

const Homey = require('homey');
const { ZigBeeDevice } = require('homey-zigbeedriver');
const { Cluster, debug, CLUSTER } = require('zigbee-clusters');
const TuyaSpecificCluster = require('../../lib/TuyaSpecificCluster')

debug(true);

Cluster.addCluster(TuyaSpecificCluster);

class moes_dimmer_1_gang extends ZigBeeDevice {

async onNodeInit({zclNode}) {

this.printNode();

this.registerCapabilityListener("onoff", async (value) => {
this.log("onoff: ", value);
await this.writeBool(1,value);
});

this.registerCapabilityListener("dim", async (value) => {
this.log("dim: ", value*1000);
await this.writeData32(2,value*1000);
});
}


//region Tuya Datapoint Functions
_transactionID = 0;
set transactionID(val) {
this._transactionID = val % 256;
}
get transactionID() {
return this._transactionID;
}

// int type value
async writeData32 (dp, value) {
const data = Buffer.alloc(4);
data.writeUInt32BE(value,0);
return this.zclNode.endpoints[1].clusters.tuya.datapoint({
status: 0,
transid: this.transactionID++,
dp,
datatype: 2,
length: 4,
data
});
}

// Boolean
async writeBool(dp, value) {
const data = Buffer.alloc(1);
data.writeUInt8(value ? 0x01 : 0x00,0);
return this.zclNode.endpoints[1].clusters.tuya.datapoint({
status: 0,
transid: this.transactionID++,
dp,
datatype: 1,
length: 1,
data
});
}

onDeleted(){
this.log("Moes 1 Gang Dimmer removed")
}

}

module.exports = moes_dimmer_1_gang;
49 changes: 49 additions & 0 deletions drivers/moes_dimmer_1_gang/driver.compose.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"id": "moes_dimmer_1_gang",
"name": {
"en": "Moes 1 Gang Dimmer Module"
},
"class": "light",
"capabilities": [
"onoff",
"dim"
],
"capabilitiesOptions": {
"dim": {
"opts": {
"duration": true
}
}
},
"images": {
"large": "{{driverAssetsPath}}/images/large.png",
"small": "{{driverAssetsPath}}/images/small.png"
},
"energy": {
"approximation": {
"usageOn": 0,
"usageOff": 0
}
},
"zigbee": {
"manufacturerName": [
"_TZE200_la2c2uo9"
],
"productId": [
"TS0601"
],
"endpoints": {
"1": {
"clusters": [0, 4, 5, 61184],
"bindings": [25, 10]
}
},
"learnmode": {
"image": "{{driverAssetsPath}}/icon.svg",
"instruction": {
"en": "Press the setup button for 10 seconds or switch the unit on and off five times to enter pairing mode (the LED should blink green)."
}
}
}

}
1 change: 1 addition & 0 deletions drivers/moes_dimmer_1_gang/driver.settings.compose.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Loading