Challenge
Write a program to read measurements from one of the environmental sensors and publish the readings to the MQTT broker.
Details
- Measurements should be taken once per minute
- Each measurment should be published to the
data/<id>/<measurement>topic<id>is a unique identifier for the device, you can hard code a constant for this in the program<measurement>is the type of value (i.e. "temperature", "humidity", "barometric pressure", etc)
- Messages should use the format
<value> <units>
Bonus
In addition to publishing readings, the program should handle control messages
- The program should subscribe to the
control/<id>/ledtopic - When a message containing
"on"is received the builtin LED should be turned on - When a message containing
"off"is received the builtin LED should be turned off