-
-
Notifications
You must be signed in to change notification settings - Fork 35
Xiaomi TH sensor 2 (LYWSD03MMC)
Sergey edited this page Jan 11, 2025
·
2 revisions
using var gw3 = new XiaomiGateway3("<gateway ip>", "<gateway token>");
{
gw3.OnDeviceDiscovered += x =>
{
if(x is MiThMonitor2 device && device.Did == "<specific did here>")
{
Console.WriteLine(device.ToString());
device.OnTemperatureChange += (oldTh) => Console.WriteLine($"Temperature is {device.Temperature}");
device.OnHumidityChange += (oldHumidity) => Console.WriteLine($"Humidity is {device.Humidity}");
device.OnBatteryPercentChange += (oldBatteryPercent) => Console.Write($"Battery perce}nt is {device.BatteryPercent}");
}
};
gw3.DiscoverDevices();
}