zigbee2mqtt
zigbee2mqtt copied to clipboard
[New device support]: Aqara wireless relay controller T2
Link
https://www.aqara.com/controller_overview
Database entry
{"id":13,"type":"Router","ieeeAddr":"0x54ef44100092e5e2","nwkAddr":14162,"manufId":4447,"manufName":"Aqara","powerSource":"DC Source","modelId":"lumi.switch.acn047","epList":[1,2,21],"endpoints":{"1":{"profId":260,"epId":1,"devId":0,"inClusterList":[2820,1794,5,4,3,18,0,6,64704],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"modelId":"lumi.switch.acn047","appVersion":27}},"genOnOff":{"attributes":{"245":117440575,"onOff":0}},"aqaraOpple":{"attributes":{"10":1,"223":{"type":"Buffer","data":[22,33,0,0,23,33,0,0,12,33,0,0,24,33,0,0]},"229":{"type":"Buffer","data":[6,0,6,0,0,36,73,68,93,37,8,252,100,37,68,228,103,37,8,175,112,5,188,150,152,37,93]},"235":200,"247":{"type":"Buffer","data":[3,40,37,5,33,18,0,9,33,0,4,10,33,0,0,12,32,10,13,35,27,0,0,0,17,35,1,0,0,0,100,16,0,101,16,0,149,57,0,0,0,0,150,57,205,132,12,69,152,57,0,0,0,0,151,57,0,0,0,0,154,32,0]},"512":1,"515":0,"649":0,"720":0,"1303":1}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b0026b747c7","endpointID":1}],"configuredReportings":[{"cluster":6,"attrId":0,"minRepIntval":0,"maxRepIntval":3600,"repChange":0}],"meta":{}},"2":{"profId":260,"epId":2,"devId":0,"inClusterList":[5,4,3,18,6,64704],"outClusterList":[],"clusters":{"genOnOff":{"attributes":{"245":53957120,"onOff":1}},"aqaraOpple":{"attributes":{"512":1}}},"binds":[],"configuredReportings":[],"meta":{}},"21":{"profId":260,"epId":21,"devId":0,"inClusterList":[12],"outClusterList":[],"clusters":{"genAnalogInput":{"attributes":{"presentValue":0}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":27,"stackVersion":27,"hwVersion":1,"dateCode":"20230606","zclVersion":3,"interviewCompleted":true,"meta":{"configured":1466202208},"lastSeen":1693799779280,"defaultSendRequestWhen":"immediate"}
Comments
I tried to control the lamp with external_converter, but only can turn it ON and OFF.
External converter
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const definition = {
zigbeeModel: ['lumi.switch.acn047'],
model: 'LLKZMK12LM',
vendor: 'Xiaomi',
description: 'Aqara wireless relay controller T2',
fromZigbee: [fz.xiaomi_basic, fz.xiaomi_power, fz.ignore_multistate_report, fz.on_off, fz.temperature],
toZigbee: [tz.on_off, tz.LLKZMK11LM_interlock, tz.xiaomi_power, tz.xiaomi_switch_power_outage_memory],
exposes: [e.switch()],
// The configure method below is needed to make the device reports on/off state changes
// when the device is controlled manually through the button on it.
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
await reporting.onOff(endpoint);
},
};
module.exports = definition;
Supported color modes
No response
Color temperature range
No response
Hi, I made a convertor, that can control L1/ L2 separately and show energy status However, fail to get switch_type/ flip_indicator_light/ power_outage_memory (so I commented those codes)
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const definition = {
zigbeeModel: ['lumi.switch.acn047'],
model: 'LLKZMK12LM',
vendor: 'Xiaomi',
description: 'Aqara Dual Relay Module T2',
fromZigbee: [
fz.on_off,
fz.aqara_opple,
fz.xiaomi_power
],
toZigbee: [
tz.on_off
// tz.xiaomi_switch_operation_mode_opple,
// tz.xiaomi_flip_indicator_light,
// tz.xiaomi_switch_power_outage_memory
],
meta: {multiEndpoint: true},
endpoint: (device) => {
return { 'l1': 1, 'l2': 2 };
},
exposes: [
e.switch().withEndpoint('l1'),
e.switch().withEndpoint('l2'),
e.power(),
e.current(),
e.energy(),
e.voltage(),
e.device_temperature()
// e.switch_type(),
// e.flip_indicator_light(),
// e.power_outage_memory()
],
};
module.exports = definition;
- Does power outage memory work with: https://gist.github.com/Koenkk/4d8b2b11998465c7e8228d18e4a9e8e3
- Are you sure the other features are supported? LLKZMK11LM also doesn't support these.
- Does power outage memory work with: https://gist.github.com/Koenkk/4d8b2b11998465c7e8228d18e4a9e8e3
- Are you sure the other features are supported? LLKZMK11LM also doesn't support these.
Thanks for your advice. I've changed convertor, sadly it shows error
Those features are supported in Aqara app. BTW, my main purpose is to get energy status, other features are not necessary to me
Again, thank you Koenkk and zigbee2mqtt is greatful
Error 2023-09-12 09:51:57Publish 'set' 'power_outage_memory' to 'Toilet double socket' failed: 'ReferenceError: manufacturerOptions is not defined'
Made a mistake, updated https://gist.github.com/Koenkk/4d8b2b11998465c7e8228d18e4a9e8e3
Made a mistake, updated https://gist.github.com/Koenkk/4d8b2b11998465c7e8228d18e4a9e8e3
Thanks Koenkk After changing converter, power_outage_momory returns another error Here's the error shown, thank you
Error 2023-09-14 09:35:36Publish 'set' 'power_outage_memory' to 'Toilet double socket' failed: 'Error: Write 0x54ef44100092f9b2/1 genBasic({"65520":{"value":[170,128,5,209,71,7,1,16,1],"type":65}}, {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4447,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'UNSUPPORTED_ATTRIBUTE')'
Seems this device works different than e.g. the LLKZMK11LM, to add support for these function sniffing with the Xiaomi gateway when setting these options is needed.
https://www.zigbee2mqtt.io/advanced/zigbee/04_sniff_zigbee_traffic.html
Seems this device works different than e.g. the LLKZMK11LM, to add support for these function sniffing with the Xiaomi gateway when setting these options is needed.
https://www.zigbee2mqtt.io/advanced/zigbee/04_sniff_zigbee_traffic.html
Thanks But it seems too advanced for me study, study, study...…
No problem, I've added initial support for this device without the power outage memory.
Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)
Hi, thanks for making the initial support available, is it possible to add device specific options for the interlock mode? This is very important for roller shutter operation, as there must only be one phase active at any moment. I dont have an Aqara Hub unfortunatly so I can't sniff traffic for that option.
Sadly I neither have an Aqara Hub and thankfully it works on Z2M
Even if the interlock feature is not found. Is is possible to do the interlock functionality within Z2M? All we need is to read the states of the switch and safely only turn one switch at a time finally publish an interface that only allows to push up or push down the roller. Right now I don't know how to do it but it might do the trick for the time being.
Another way is to address this by hardware
I have add this device to my network, but i think the energy meter is not kWH but is Wh, can you correct the définition ?
Sadly I neither have an Aqara Hub and thankfully it works on Z2M
Even if the interlock feature is not found. Is is possible to do the interlock functionality within Z2M? All we need is to read the states of the switch and safely only turn one switch at a time finally publish an interface that only allows to push up or push down the roller. Right now I don't know how to do it but it might do the trick for the time being.
Another way is to address this by hardware
I think hardware support should be possible, Aqara supports this via their app but it isn't an app feature but more a device option. It would be alot better than software, as you still need to make sure that your hardware buttons are also interlocked...
I have add this device to my network, but i think the energy meter is not kWH but is Wh, can you correct the définition ?
I noticed that too
Hi, add more the energy correct to kWH, can you check the data source of energy because in the history chart, the curve seems linear .. I use this device to follow my solar product and the curve must be more chaotic 😁
À good historic chart 👍
Hello, some function are note present in module configuration This module can be configured with pulse commande or interlock to be use with shutter. This parameter can be seen with xiomi hub (that i don't have).
I just bought this device since I saw it was supported.
I was able to hook it up to control my garage door (although I have to turn the switch on then off again). However, the sensors (S1/S2) don't seem to be available. I use them for my open/closed contact sensors.
Is this something that can be added or is there a config I can use to expose them?
Thanks. 😊
Has anyone found out how to set Interlock mode ?
I have add this device to my network, but i think the energy meter is not kWH but is Wh, can you correct the définition ?
i think the same. the energy meter its imposible to measure in kwh. a simply lamp have more consumption than a lot of devices in my home, jejeje
can i change this in zigbee2mqtt or need a new version?
Has anyone found out how to set Interlock mode ?
yeah, I want this interlock mode, too
hey guys, I saw the interlock is implemented already in https://github.com/Koenkk/zigbee-herdsman-converters/pull/6554, but works not alright.
@xirius
I have add this device to my network, but i think the energy meter is not kWH but is Wh, can you correct the définition ?
i think the same. the energy meter its imposible to measure in kwh. a simply lamp have more consumption than a lot of devices in my home, jejeje
can i change this in zigbee2mqtt or need a new version?
I also concur that this reading is in kW and is most defiantly not kWh - everything else is working as expected apart from it thinks that my Gas boiler has used 97kWh of electricity in an hour. This is compliantly imposable. That's nearly 6 times the energy suppliers daily meter reading of the whole house. When you do the math's of an average of 0.4A (at 240v) over the same time is 95Wh confirming this. To pull 95kWh in the same time period, I would have to be drawing 395A. I dont think my neighbors or my DNO would like me if that was the case on my domestic supply 😆
Is it possible to divide this by 1000 in the config to make it 95 wH?
Hi everyone, Not sure if I need to open another bug ticket but I repaired every zigbee device I have at home and I keep getting an error concerning this device. Here is the log:
Zigbee2MQTT:error 2024-01-07 21:25:33: Exception while calling fromZigbee converter: Expected one of: 1, 2, 3, got: 'undefined'}
Zigbee2MQTT:error 2024-01-07 21:25:33: Failed to configure 'Relais PaC', attempt 3 (Error: Read 0x54ef441000990ea9/2 aqaraOpple([10], {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4447,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'UNSUPPORTED_ATTRIBUTE')
at Endpoint.checkStatus (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:321:28)
at Endpoint.read (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:463:22)
at setupAttributes (/app/node_modules/zigbee-herdsman-converters/src/lib/modernExtend.ts:62:9)
at configure (/app/node_modules/zigbee-herdsman-converters/src/lib/modernExtend.ts:72:9)
at Object.configure (/app/node_modules/zigbee-herdsman-converters/src/index.ts:140:25)
at Configure.configure (/app/lib/extension/configure.ts:120:13)
at EventEmitter.wrappedCallback (/app/lib/eventBus.ts:167:17))
The device itself appears to work fine when changing L1 or L2. I'm currently configured as below:
Is it maybe linked to the new Zigbee2Mqtt update where it tries to automatically get functions for unsupported devices?
I just bought this device since I saw it was supported.
I was able to hook it up to control my garage door (although I have to turn the switch on then off again). However, the sensors (S1/S2) don't seem to be available. I use them for my open/closed contact sensors.
Is this something that can be added or is there a config I can use to expose them?
Thanks. 😊
Hello, this is also a problem I am facing. Want to use S1 as a manual button for garage opening/closing and S2 for monitoring the state of the door with a magnetic contact sensor. For this ideally I should be able to configure S2 as a "wireless switch" (that's how Aqara name this feature in their app). However I am not sure that you can do this even in the Aqara app currently, but only to set both S1/S2 switches as wireless switches or not.
Anyway, a great first step would be to have the switches state separated and visible from the relays.
Want to use S1 as a manual button for garage opening/closing and S2 for monitoring the state of the door with a magnetic contact sensor
To use an external button you should connect it to S1/S2 and COM. I use a rocker switch for that. In Zigbee2MQTT there are 3 options for external buttons:
-
toggle
that I suppose is for a button swtich -
momentum
that I suppose is for a rocker switch -
none
For my rocker switch I tried both: toggle
and momentum
do work OK. Perhaps it's just the state how they are being reported in HA, but I had no issues with opening/closing the garage door with the external button.
If you want to add a contact sensor, indeed there's no way to select operational mode for S1 and S2 separately. But I suppose that toggle
mode will work just fine for this case. You just need to set the option operation_mode
to decoupled
and control manually the actions when S1 and S2 contacts are triggered... As for a connection scheme I think the following should work:
- For external switch - connect wires to S1 and COM
- For contact sensor - connect wires to S2 and COM
hey guys, I saw the interlock is implemented already in https://github.com/Koenkk/zigbee-herdsman-converters/pull/6554, but works not alright.
In my tests the interlock mode works fine.
If you want to add a contact sensor, indeed there's no way to select operational mode for S1 and S2 separately. But I suppose that
toggle
mode will work just fine for this case. You just need to set the optionoperation_mode
todecoupled
and control manually the actions when S1 and S2 contacts are triggered... As for a connection scheme I think the following should work:
- For external switch - connect wires to S1 and COM
- For contact sensor - connect wires to S2 and COM
That was exactly my plan to make the connections and wiring. But, I have the relay on my test bench right no (only power supplied) and I cannot see anywhere in z2m the state of the switches, only the outputs. And of course that's because the switches are binded to the outputs.
I wanted to suggest an improvement because I saw that Aqara supports the option of having "wireless switches" in their native app (connected via aqara hub), so if you check that and the switches become wireless (not binded to outputs) this means you are able to have different states for the switches and the relays. And ideally, for me, would be to be able to have only one of them as a wireless switch - basically the contact sensor (S2) not to control the output anymore, to be decoupled from the output. And the button (S1) to work as a wired switch directly to the output.
Just wanted to give an idea of improvement, maybe it's possible to be done.
Appreciate all the work that is done already and I am a very happy 6-months old user of zigbee2mqtt!
I cannot see anywhere in z2m the state of the switches
I think you can catch it in action
event which is triggered when the external button is pressed. However, I'm not sure that it's possible to distinguish here between what source triggered the event - S1 or S2. This should be tested...
Ok, here's what I got. The Aqara T2 really reports information from sensors S1 and S2 via zigbee2mqtt - it sends action
with value either single_l1
or single_l2
for S1 and S2 sensor respectively. Example:
These actions are sent no matter of the operation mode (decoupled
or control_relay
). And the trigger only works for single tap - double tap or hold are not detected by the relay. However, I have a problem of receiving the state action in HA automation. My example of automation is as follow:
---
alias: "Garage Door Switch"
description: >-
Controls the garage door switch.
id: "switch.garage.door"
mode: queued
max_exceeded: silent
trace:
stored_traces: 5
trigger:
- platform: state
entity_id: sensor.garage_door_relay_action
action:
- service: notify.channel
data:
message: "Garage relay state change\r\nFrom {{trigger.from_state}} to {{trigger.to_state}}"
This automation never runs. And no issues in logs. Can anyone test that the action
trigger works for T2?
Great info you provided here, @rvalitov. Yesterday I finished installing my Aqara T2 on the garage door and I will definitely try this next week!
I also have some progress in working with the contact sensor. I will share my results after finishing all the tests.