Repository navigation
Release Notes 4.0
Sergey Brutsky edited this page Dec 3, 2026
·
1 revision
Version 4.0 completes the asynchronous transition announced in 3.5.0. Constructors no longer touch the network, information reads are explicit, value-change events carry a typed ValueChange<T>, the public API is nullable-aware and inheritance is closed except for the documented MIoT extension point. Applications upgrading from 3.x need source changes; the migration guide describes them step by step.
-
Asynchronous-only API. All 272 synchronous methods marked obsolete in 3.5.0 were removed. Use the matching
...Asyncmethod. Every public asynchronous method exceptDisposeAsyncnow ends withCancellationToken cancellationToken = default, and the 3.x overload pairs were merged. -
Constructors make no network requests.
MiotGenericDeviceno longer sendsmiIO.infowhile initializing, and MQTT gateways no longer open the socket in the constructor.MqttGatewayBase.ConnectAsyncconnects explicitly;DiscoverDevicesAsyncand the first publish connect on demand. Code that relied on information properties being filled by the constructor must callawait GetInfoAsync().ToString()no longer requests the device either:XiaomiAirHumidifierV1andXiaomiRobotVacuumCleanerV1describe the model and address, and the state is read withGetStatusAsync(). -
Information properties removed.
FirmwareVersion,Hardware,Mac,UptimeSeconds,MiioVersion,Wifi,Network,WifiSettingsandNetifSettingsare gone from MIoT devices (Macremains a real property on BLE and Mesh devices).GetInfoAsync()returns a freshMiioDeviceInfowith the same data. -
Value-change events use
ValueChange<T>. The 33 events listed in the plan now passPrevious,CurrentandTimestampUtc. Event names and raising conditions did not change. Action events such as clicks, vibration, alarms, discovery and connection notifications keep their old arguments. -
Nullable reference types. The library builds with nullable diagnostics as errors.
GetDeviceById<T>returnsT?; gatewaySid,IpandProtoVersionare nullable until the first heartbeat; optional options properties are nullable whileIpandTokenare not. -
Closed inheritance. Every concrete device and gateway is
sealed; the base classes and transport interfaces expose no protected or public extension surface.MiotGenericDeviceisabstractand the only supported base class for custom MIoT devices, withGetPropertyAsync,SetPropertyAsync,CallActionAsyncandLogger. -
Removed obsolete names.
SensivityState/SensivityMode/SetSensivityAsync/OnSmokeSensivityModeChanged, the misspelledAqaraOpple...WirelesSwitchclasses, the CyrillicSound.PoliceСar1/2, stringStatusLeft/StatusRight/Status/LastClick,MotionDate,GetDeviceByDid, the gatewaySetLoggerFactorymethods and the legacy gateway constructors were removed.MotionDateUtcand the typed state properties replace them. -
Collection and value-type changes.
GetDevices()returnsIReadOnlyList<GatewaySubDeviceBase>.XiaomiGateway2.RadioChannelis a record(int Id, string Url, int Type).AqaraDualWallSwitchchannel events passValueChange<SwitchChannelState>.
- Deferred MQTT connection: the first operation that needs the broker opens the connection, while the existing reconnect loop still owns recovery after a lost connection.
ConnectAsynclets an application verify connectivity before discovery. - Timestamped value changes:
ValueChange<T>.TimestampUtcis the reception time of the report, so consumers no longer read a separate property to reconstruct when a value changed. - Typed state instead of strings:
LeftChannel/RightChannel,Contact,LastClick,Channel1/Channel2,PlugState,RelayStateand the other state enums make unknown values explicit. - Custom MIoT devices have a small, stable contract.
SetPropertyAsync<T>andCallActionAsyncserialize primitives, strings, enums,JsonNode, arrays and dictionaries of those; unsupported objects throwNotSupportedExceptioninstead of using reflection. - Documentation examples are compiled: 121 C# blocks from the repository READMEs and the wiki are compiled against the built library, with only signature listings, historical 3.x snippets and multi-file worker service files excluded.
Physical-device validation remains the responsibility of the user for their firmware. The Gateway2 and MQTT behaviour documented on the device pages is unchanged by 4.0; only the API shape changed. Supported targets remain .NET Standard 2.0, .NET Framework 4.6.1 and 4.6.2, and .NET 10.