-
-
Notifications
You must be signed in to change notification settings - Fork 35
Aqara Door Window sensor (MCCGQ11LM)
Sergey edited this page Jul 17, 2024
·
2 revisions
using var gw2 = new XiaomiGateway2();
{
gw2.OnAqaraOpenCloseSensor = (_, x) =>
{
Console.WriteLine(x.ToString());
if(x.Sid == "<specific sid here>")
{
x.OnOpen = (_, __) => Console.WriteLine("Door/Window is open");
x.OnClose = (_, __) => Console.WriteLine("Door/Window is close");
}
};
}
using var gw3 = new XiaomiGateway3("<gateway ip>", "<gateway token>");
{
gw3.OnDeviceDiscovered = x =>
{
if(x is AqaraDoorWindowSensor device && device.Did == "<specific did here>")
{
Console.WriteLine(device.ToString());
device.OnContactChanged = () => Console.WriteLine($"Door/Window is {device.Contact}");
device.OnBatteryPercentChange = (oldBatteryValue) => Console.WriteLine($"Battery is {device.BatteryPercent}");
device.OnChipTemperatureChange = (oldChipTemperatureValue) => Console.WriteLine($"Chip Temperature is {device.ChipTemperature}");
device.OnVoltageChange = (oldVoltageValue) => Console.WriteLine($"Voltage is {device.Voltage}");
device.OnLinkQualityChange = (oldLinkQualityValue) => Console.WriteLine($"Linq quality is {device.LinqQuality}");
}
};
gw3.DiscoverDevices();
}