NoeticTools.Net2HassMqtt 0.3.1-alpha.1

This is a prerelease version of NoeticTools.Net2HassMqtt.
This package has a SemVer 2.0.0 package version: 0.3.1-alpha.1+32.
dotnet add package NoeticTools.Net2HassMqtt --version 0.3.1-alpha.1                
NuGet\Install-Package NoeticTools.Net2HassMqtt -Version 0.3.1-alpha.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NoeticTools.Net2HassMqtt" Version="0.3.1-alpha.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NoeticTools.Net2HassMqtt --version 0.3.1-alpha.1                
#r "nuget: NoeticTools.Net2HassMqtt, 0.3.1-alpha.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NoeticTools.Net2HassMqtt as a Cake Addin
#addin nuget:?package=NoeticTools.Net2HassMqtt&version=0.3.1-alpha.1&prerelease

// Install NoeticTools.Net2HassMqtt as a Cake Tool
#tool nuget:?package=NoeticTools.Net2HassMqtt&version=0.3.1-alpha.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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.3.1-alpha.1 35 8/6/2024
0.3.0-alpha.78-1 51 7/5/2024