public class ProximitySensor
{
public ProximitySensor(string broker)
{
var mqtt = new Charlotte(broker);
mqtt.On["{room}/sensors/{sensor}"] = msg =>
{
Log("Data received from {0} (in {1}): {2}", msg.sensor, msg.room, msg.Message);
};
mqtt.On["sensors/bedroom/presence"] = async msg =>
{
if (msg.Message == "human present")
{
await mqtt.Publish("lights/bedroom", "on");
}
};
}
-
Notifications
You must be signed in to change notification settings - Fork 15
A modern MQTT framework for .NET
GeorgeHahn/Charlotte
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
A modern MQTT framework for .NET
Resources
Stars
Watchers
Forks
Packages 0
No packages published