-
Notifications
You must be signed in to change notification settings - Fork 4k
Add: new feature IKEA E2204/2206 #10793
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
Conversation
|
Thanks! |
|
Hi @chris-1243, can you revisit this? I bought some more TRETAKT plugs and I had to peek through the converters when I was missing the child_lock and led_enable features. I noticed you only exposed them for the latest version (2.4.25), but I was curious if it also works without updating. I copy-pasted the code into an external converter: ikea_plug.js They work on the initial version (2.4.4) too:
Also, with the current implementation, would the settings disappear after a future update (version no longer matches)? |
|
@andrei-lazarov In order to not break devices with older firmware, this modification works on version 2.4.25 or higher. I do not have a plug with an older firmware to test with. The Thanks to have tested
The implementation works on firmware version 2.4.25 or higher. Let's hope IKEA does not modify those parameters in a future firmware... |
|
@andrei-lazarov Could you test this converter ? It should do the job. Not the best way to write it but I still need to figure out how javascript works... Import it as a import {Zcl} from "zigbee-herdsman";
import {gte as semverGte, valid as semverValid} from "semver";
import {access, binary} from "zigbee-herdsman-converters/lib/exposes";
import * as m from "zigbee-herdsman-converters/lib/modernExtend";
import {addCustomClusterManuSpecificIkeaUnknown} from "zigbee-herdsman-converters/lib/ikea";
import {isDummyDevice} from "zigbee-herdsman-converters/lib/utils";
export const manufacturerOptions = {manufacturerCode: Zcl.ManufacturerCode.IKEA_OF_SWEDEN};
function addCustomClusterManuSpecificIkeaSmartPlug() {
return m.deviceAddCustomCluster("manuSpecificIkeaSmartPlug", {
ID: 0xfc85,
manufacturerCode: Zcl.ManufacturerCode.IKEA_OF_SWEDEN,
attributes: {
childLock: {ID: 0x0000, type: Zcl.DataType.BOOLEAN},
ledEnable: {ID: 0x0001, type: Zcl.DataType.BOOLEAN},
},
commands: {},
commandsResponse: {},
});
}
const ikeaModernExtend = {
smartPlugChildLock: (args) => {
const resultName = "child_lock";
const resultDescription = "Enables/disables physical input on the device.";
const result = m.binary({
name: resultName,
cluster: "manuSpecificIkeaSmartPlug",
attribute: {ID: 0x0000, type: Zcl.DataType.BOOLEAN},
entityCategory: "config",
valueOff: ["UNLOCK", 0x00],
valueOn: ["LOCK", 0x01],
description: resultDescription,
zigbeeCommandOptions: {manufacturerCode: Zcl.ManufacturerCode.IKEA_OF_SWEDEN},
});
result.exposes = [
(device) => {
if (
!isDummyDevice(device) &&
device.softwareBuildID &&
semverValid(device.softwareBuildID) &&
semverGte(device.softwareBuildID, "2.4.4")
) {
return [binary(resultName, access.ALL, "LOCK", "UNLOCK").withDescription(resultDescription).withCategory("config")];
}
return [];
},
];
return result;
},
smartPlugLedEnable: (args) => {
const resultName = "led_enable";
const resultDescription = "Enables/disables the led on the device.";
const result = m.binary({
name: resultName,
cluster: "manuSpecificIkeaSmartPlug",
attribute: {ID: 0x0001, type: Zcl.DataType.BOOLEAN},
entityCategory: "config",
valueOff: ["FALSE", 0x00],
valueOn: ["TRUE", 0x01],
description: resultDescription,
zigbeeCommandOptions: {manufacturerCode: Zcl.ManufacturerCode.IKEA_OF_SWEDEN},
});
result.exposes = [
(device) => {
if (
!isDummyDevice(device) &&
device.softwareBuildID &&
semverValid(device.softwareBuildID) &&
semverGte(device.softwareBuildID, "2.4.25")
) {
return [binary(resultName, access.ALL, "TRUE", "FALSE").withDescription(resultDescription).withCategory("config")];
}
return [];
},
];
return result;
},
smartPlugLedEnableTretakt: (args) => {
const resultName = "led_enable";
const resultDescription = "Enables/disables the led on the device (When set to FALSE, the led will turn off after 10 seconds).";
const result = m.binary({
name: resultName,
cluster: "manuSpecificIkeaSmartPlug",
attribute: {ID: 0x0001, type: Zcl.DataType.BOOLEAN},
entityCategory: "config",
valueOff: ["TRUE", 0x00],
valueOn: ["FALSE", 0x01],
description: resultDescription,
zigbeeCommandOptions: {manufacturerCode: Zcl.ManufacturerCode.IKEA_OF_SWEDEN},
});
result.exposes = [
(device) => {
if (
!isDummyDevice(device) &&
device.softwareBuildID &&
semverValid(device.softwareBuildID) &&
device.softwareBuildID === "2.4.4"
) {
return [binary(resultName, access.ALL, "TRUE", "FALSE").withDescription(resultDescription).withCategory("config")];
}
return [];
},
];
return result;
},
};
export default {
zigbeeModel: ["TRETAKT Smart plug"],
model: "E22x4",
vendor: "IKEA",
description: "TRETAKT smart plug",
whiteLabel: [
{model: "E2204", vendor: "IKEA", description: "TRETAKT smart plug (EU)"},
{model: "E2214", vendor: "IKEA", description: "TRETAKT smart plug (CH)"},
],
extend: [
addCustomClusterManuSpecificIkeaSmartPlug(),
addCustomClusterManuSpecificIkeaUnknown(),
m.onOff(),
ikeaModernExtend.smartPlugChildLock(),
ikeaModernExtend.smartPlugLedEnable(),
ikeaModernExtend.smartPlugLedEnableTretakt(),
m.identify(),
],
ota: true,
};@Koenkk I know you are busy. Would you have any idea how I could merge The |
|
I think it's the nicest to extend
shouldExpose(device), based on that we can make it conditional and keep the m.binary construction.
|
|
Thanks. Let's see how far I will be able to go. |
From discussion
Koenkk/zigbee2mqtt#29257
I hope I have done it the right way.