Jon Hobbs
Published © GPL3+

Home Automation Laboratory (HAL) - Part 3 - Messaging

Expanding our home automation system, known as HAL, to include a lightweight messaging system to communicate with custom IoT devices.

BeginnerFull instructions provided1 hour2,729
Home Automation Laboratory (HAL) - Part 3 - Messaging

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
Raspberry Pi Pi Case
×1

Software apps and online services

Mosquitto

Story

Read more

Code

Our mqtt.cfg file

LiveScript
This is the confgiuration file that OpenHAB uses to connect to your mqtt broker. In our case, Mosquitto.
# Define your MQTT broker connections here for use in the MQTT Binding or MQTT
# Persistence bundles. Replace <broker> with an ID you choose.
#

# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
bloodsucker.url=tcp://192.168.1.127:1883

# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a default one is generated.
#<broker>.clientId=<clientId>

# Optional. User id to authenticate with the broker.
#<broker>.user=<user>

# Optional. Password to authenticate with the broker.
#<broker>.pwd=<password>

# Optional. Set the quality of service level for sending messages to this broker.
# Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2
# (Deliver exactly once). Defaults to 0.
#<broker>.qos=<qos>

# Optional. True or false. Defines if the broker should retain the messages sent to
# it. Defaults to false.
#<broker>.retain=<retain>

# Optional. True or false. Defines if messages are published asynchronously or
# synchronously. Defaults to true.
#<broker>.async=<async>

# Optional. Defines the last will and testament that is sent when this client goes offline
# Format: topic:message:qos:retained <br/>
#<broker>.lwt=<last will definition>

Credits

Jon Hobbs

Jon Hobbs

9 projects • 27 followers
Just a Minnesota kid hanging out in Kansas

Comments