---
title: "A Journey in to MQTT With Roller Shutters, Mosquitto, HomeAssistant & Low Powered Micro-Controllers"
url: "https://maker.wiznet.io/gemma/projects/a-journey-in-to-mqtt-with-roller-shutters%2C-mosquitto%2C-homeassistant-low-powered-micro-controllers/"
markdown_url: "https://maker.wiznet.io/gemma/projects/a-journey-in-to-mqtt-with-roller-shutters%2C-mosquitto%2C-homeassistant-low-powered-micro-controllers/md"
type: "UCC: User Created Content"
author: "Shane Baldacchino"
author_url: "https://automation.baldacchino.net/roller-shutters-mqtt-mosquitto-homeassistant-relays-and-fun/"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Shane Baldacchino"
original_url: "https://automation.baldacchino.net/roller-shutters-mqtt-mosquitto-homeassistant-relays-and-fun/"
published: "2023-01-02"
language: "en"
hardware: ["Arduino Ethernet Shield"]
likes: 4
views: 618
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# A Journey in to MQTT With Roller Shutters, Mosquitto, HomeAssistant & Low Powered Micro-Controllers

> A Journey in to MQTT With Roller Shutters, Mosquitto, HomeAssistant & Low Powered Micro-Controllers

Original author: Shane Baldacchino (source: https://automation.baldacchino.net/roller-shutters-mqtt-mosquitto-homeassistant-relays-and-fun/)

## Components

- **Arduino Ethernet Shield** x 1 ([docs](https://docs.arduino.cc/retired/shields/arduino-ethernet-shield-without-poe-module))

## Article

The Arduino needs to know what to do. I thought about explaining this but I think for those techincally inclined the code speaks volume below but in essence we are

1. Establishing an IP connection

2. Connecting to the MQTT Broker, Mosquitto

3. Subscribing to topics

4. Listening for MQTT messages

5. Taking action on received messages

6. Publishing updates to MQTT broker on state change

```c
// INCLUDE SYSTEM LIBRARIES 
 #include <util.h>
    #include <Ethernet2.h>
    #include <SPI.h>
    #include <PubSubClient.h>
    
    //Setup Ethernet Controller
    byte mac[] = { 0x90, 0xA2, 0xDA, 0x10, 0XD0, 0x66 };
    byte gateway[] = { 10, 0, 0, 1 }; 
    byte subnet[] = { 255, 255, 255, 0 }; 
    IPAddress ip(10, 0, 0, 50 );

    // Initialize the Ethernet server library
    // with the IP address and port you want to use
    // (port 80 is defaudlt for HTTP):
    EthernetServer server(80);
```

---

Source: https://maker.wiznet.io/gemma/projects/a-journey-in-to-mqtt-with-roller-shutters%2C-mosquitto%2C-homeassistant-low-powered-micro-controllers/
