Skip to content

Latest commit

 

History

History
25 lines (21 loc) · 715 Bytes

README.md

File metadata and controls

25 lines (21 loc) · 715 Bytes

Charlotte pipeline status NuGet

The Modern MQTT Framework

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");
			}
		};
	}