O'Reilly logo

Mastering Internet of Things by Peter Waher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding MQTT support to the actuator

To add MQTT support to our actuator, we create a new UWP app project and name it ActuatorMqtt. We copy the actuator logic from our Actuator project, and the preceding procedures to create and maintain an MQTT connection to the broker. Even though it's an actuator, we want to publish sensor data for it, representing the current state of the actuator. If it changes state, we want the new state to be published. But since the value will not be updated using a regular interval, as in the sensor case, we will ask the broker to retain our latest value. We will also use a different Quality of Service level: At Least Once. This is to make sure that the most recent value is propagated correctly. We don't need to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required