NoeticTools.Net2HassMqtt
0.3.2-InitialDev.97.1
See the version list below for details.
dotnet add package NoeticTools.Net2HassMqtt --version 0.3.2-InitialDev.97.1
NuGet\Install-Package NoeticTools.Net2HassMqtt -Version 0.3.2-InitialDev.97.1
<PackageReference Include="NoeticTools.Net2HassMqtt" Version="0.3.2-InitialDev.97.1" />
paket add NoeticTools.Net2HassMqtt --version 0.3.2-InitialDev.97.1
#r "nuget: NoeticTools.Net2HassMqtt, 0.3.2-InitialDev.97.1"
// Install NoeticTools.Net2HassMqtt as a Cake Addin #addin nuget:?package=NoeticTools.Net2HassMqtt&version=0.3.2-InitialDev.97.1&prerelease // Install NoeticTools.Net2HassMqtt as a Cake Tool #tool nuget:?package=NoeticTools.Net2HassMqtt&version=0.3.2-InitialDev.97.1&prerelease
Net2HassMqtt
NOTE
This project is currently experimental/pre-release with much of the code untested. Early trial and feedback would be great!
Net2HassMqtt provides Home Assistant (HASS) integration to .NET applications via MQTT. It not a MQTT transport layer. It provides a Home Assistant centric fluent configuration interface to map your application's models to Home Assistant entities.
The devices and entities you configure automatically appear fully configured in Home Assistant (Home Assistant MQTT Discovery). Configure once, use twice & no YAML! 😃
You do not need to code any MQTT publish calls, value conversions, subscriptions, or connection management. It just all happens. Net2HassMqtt layers over MQTT so you do not have to. It is designed to let you work with the "what" (Home Assistant) not the "how" (MQTT).
An example:
// Your application model(s)
var environment = new EnvironmentSensorModel();
// MQTT broker connection options
var mqttClientOptions = ExampleMqttClientOptions.GetOptions("NET2HassMqtt_NodeIdExample", secretsConfig);
// Now we map your app's model to HASS device and entities.
var config = new BridgeConfiguration(mqttClientOptions)
.HasDevice("Demo Home Environment",
"my_home_environment",
device => device.Model(environment)
// Map model 'Temperature' property to HASS entity - "Lounge Temperature"
.HasTemperatureSensor(nameof(EnvironmentSensorModel.Temperature),
TemperatureSensorUoM.DegreesCelsius,
"Lounge Temperature", "lounge_temperature")
// Map model 'Humidity' property to HASS entity - "Lounge Humidiy"
.HasHumiditySensor(nameof(EnvironmentSensorModel.Humidity),
HumiditySensorUoM.Percent,
"Lounge Humidity", "lounge_humidity"));
var bridge = config.Build();
await bridge.StartAsync(); // Done! Running.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- CommunityToolkit.Mvvm (>= 8.3.2)
- FluentDateTime (>= 3.0.0)
- Microsoft.Extensions.Hosting (>= 8.0.1)
- MQTTnet (>= 4.3.6.1152)
- MQTTnet.Extensions.ManagedClient (>= 4.3.6.1152)
- NoeticTools.Git2SemVer.MSBuild (>= 0.11.5)
- Serilog.Extensions.Logging (>= 8.0.0)
- System.Configuration.ConfigurationManager (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 72 | 11/7/2024 |
0.3.5-InitialDev.100 | 40 | 11/3/2024 |
0.3.3-InitialDev.98.1 | 41 | 10/16/2024 |
0.3.2-InitialDevAlpha.96.2 | 37 | 10/14/2024 |
0.3.2-InitialDev.97.1 | 38 | 10/15/2024 |
0.3.1-alpha.1 | 41 | 8/6/2024 |
0.3.0-alpha.78-1 | 56 | 7/5/2024 |