This is a simple program that shows how does the "publisher" in MQTT server model works. It publish "On" as a message on a server with IP address 192.168.1.105. Be carefull, we have already installed an instance of MQTT server on your Raspberry. And it lives on your Raspberry so the server has the same IP addres as the Raspberry. This means that you have to replace the IP addres in the program, with the addres of your Raspberry. If you forget it you can type "ifconfig" in the command promt and search for the "inet" line.
wlan0: flags=4163 mtu 1500 inet 192.168.1.105 netmask 255.255.255.0 broadcast 192.168.1.255
The name of the client in this case is "Publisher 1" and the message is posted under the topic "Air Conditioner".
- 14 Dec 2018