Sign inSign up

rabarar/homie-input

By rabarar

Updated over 3 years ago

telegraf socket input processor to receive MQTT-Homie-v4 messages

Image
0

166

rabarar/homie-input repository overview

Version

  • 0.1.0 - refactored the executable and added the ability to write directly to influx
  • 0.0.10 - replaced TCP with UDP transport for Telegraf
  • 0.0.4 - added logging environment variable to docker-compose.yml file and changed to info
  • 0.0.3 - re-open didn't seem to work - may have to switch from tcp to udp if I can't re-establish the socket. Or, let it fail and have docker restart the app
  • 0.0.2 - attempting to respond to a broken telegraf socket - when the socket is closed, attempt to re-open the connection
  • 0.0.1 - initial release

Easiest way to use it is with docker-compose create

version: "3.5"

services:
  homie-input:
    build:
      context: .
      dockerfile: Dockerfile
    image: rabarar/homie-input:0.1.0
    network_mode: "bridge"
    pid: "host"
    container_name: homie-input
    environment:
      - HOMIE_MQTT_USERNAME=admin
      - HOMIE_MQTT_PASSWORD=password
      - HOMIE_INFLUX_KEY=XXXXXXXXX
      - HOMIEGRAF_LEVEL=info
    restart: always

Use the Dockerfile:

FROM rust:1.68 as build

# create a new empty shell project
RUN USER=root cargo new --bin homie-input
WORKDIR /homie-input

# copy over your manifests
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml

# this build step will cache your dependencies
RUN cargo build --release
RUN rm src/*.rs

# copy your source tree
COPY ./src ./src

# build for release
RUN rm ./target/release/deps/homie_input*
RUN cargo build --release

# our final base
FROM rust:1.68

# copy the build artifact from the build stage
COPY --from=build /homie-input/target/release/homie-input .

# set the startup command to run your binary
ENTRYPOINT ["/homie-input", "-x", "influx", "-i",  "8086", "-g", "10402q-MD", "-o", "homie"]

Tag summary

Content type

Image

Digest

sha256:9dee3db19

Size

536 MB

Last updated

over 3 years ago

docker pull rabarar/homie-input:0.1.0