diff --git a/README.md b/README.md index 3545c8a..de66eff 100644 --- a/README.md +++ b/README.md @@ -55,9 +55,10 @@ A collection of delicious docker recipes. ## IoT -- [x] hass :+1: -- [x] hbdg :+1: +- [x] hass +- [x] hbdg - [x] node-red :+1: +- [x] mqtt-io-arm - [x] mosquitto :+1: - [x] tile38-arm :+1: diff --git a/mqtt-io-arm/Dockerfile b/mqtt-io-arm/Dockerfile new file mode 100644 index 0000000..411dd02 --- /dev/null +++ b/mqtt-io-arm/Dockerfile @@ -0,0 +1,15 @@ +# +# Dockerfile for mqtt-io-arm +# + +FROM debian:bullseye + +RUN set -xe \ + && apt update -y \ + && apt install -y python3 python3-pip python3-rpi.gpio \ + && pip3 install --no-cache mqtt-io \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +CMD ["python3", "-m", "mqtt_io", "config.yml"] diff --git a/mqtt-io-arm/README.md b/mqtt-io-arm/README.md new file mode 100644 index 0000000..5cd0cca --- /dev/null +++ b/mqtt-io-arm/README.md @@ -0,0 +1,22 @@ +mqtt-io +======= + +[mqtt-io][1] exposes general purpose inputs and outputs (GPIO), hardware sensors and +serial devices to an MQTT server. Ideal for single-board computers such as the +Raspberry Pi. + +## up and running + +``` +docker-compose up -d +docker-compose logs -f +``` + +## mqtt sub/pub + +``` +mosquitto_sub -v -h test.mosquitto.org -t easypi/# +mosquitto_pub -h test.mosquitto.org -t easypi/output/light/set -m ON +``` + +[1]: https://mqtt-io.app/ diff --git a/mqtt-io-arm/data/config.yml b/mqtt-io-arm/data/config.yml new file mode 100644 index 0000000..4add9ff --- /dev/null +++ b/mqtt-io-arm/data/config.yml @@ -0,0 +1,20 @@ +# Doc: https://mqtt-io.app/ + +mqtt: + host: test.mosquitto.org + port: 1883 + topic_prefix: easypi + +gpio_modules: + - name: rpi + module: raspberrypi + +digital_inputs: + - name: doorbell + module: rpi + pin: 21 + +digital_outputs: + - name: light + module: rpi + pin: 22 diff --git a/mqtt-io-arm/docker-compose.yml b/mqtt-io-arm/docker-compose.yml new file mode 100644 index 0000000..cf3514a --- /dev/null +++ b/mqtt-io-arm/docker-compose.yml @@ -0,0 +1,8 @@ +version: "3.8" +services: + mqtt-io: + image: easypi/mqtt-io-arm + volumes: + - ./data:/app + privileged: true + restart: unless-stopped