Skip to content
fieldfoxWim edited this page Dec 16, 2014 · 6 revisions

Intro

My DIY Home Automation system is powerd by a WAGO PLC 750-881. This PLC has ethernet and is wired to my Home network. I wanted to start tracking the usage of lights and powerusage. During my research I stumbled accross the IBM MQTT protocol. Being a simple protocol and being flexible enough to do what I wanted, I planned to make my PLC support MQTT. A little bit of Googling showed that there was not off the shelf library available. So I read the specs and started my first advanced PLC program.

Roadmap

Ofcourse this first version is rather simple and is just enough to do the bare minimum. It supports the following messages:

  • CONNECT
    • Only a QoS of 0 is supported.
    • Username and password are supported.
  • CONNACK
  • PUBLISH
  • PINGREQ Fixed to 10s
  • PINGRESP

In the future I want to implement QoS 1 en 2 and enable subscribing to topics.

#Usage ` mqttClient(xPublish := xPublish, xSubscribe := xSubscribe, sIP:='192.168.10.10', wPortNumber:=1883, sUsername:='user', sPassword:='pass');

mqttClient.sTopic := 'home/lights/kitchen'; mqttClient.sPayload := BOOL_TO_STRING('FALSE'); xPublish := TRUE; `

Clone this wiki locally