Giter Site home page Giter Site logo

apc2mqtt's Introduction

apc2mqtt

Post APCUPSD UPS data to MQTT broker with Home Assistant discovery.

Instructions

clone repo: git clone

enter directory: cd apc2mqtt

build image: docker build -t apc2mqtt -f Dockerfile .

docker-compose: docker-compose up -d

Example compose file with all possible environmental variables listed:

version: '3'
services:
  apc2mqtt:
    container_name: apc2mqtt
    image: apc2mqtt:latest
    environment:
    - HOMEASSISTANT_PREFIX=homeassistant
    - MQTT_USER=user
    - MQTT_PASSWORD=password
    - MQTT_HOST=10.1.1.4
    - MQTT_PORT=1883
    - MQTT_TOPIC_PREFIX=apc
    - MQTT_TIMEOUT=15
    - MQTT_QOS=1
    - INTERVAL=15
    - UPS_ALIAS=ups
    - APCUPSD_HOST=10.1.1.4
    - DEBUG=1
    restart: unless-stopped

Configuration

Variable Default Description
HOMEASSISTANT_PREFIX homeassistant The prefix for Home Assistant discovery. Must be the same as discovery_prefix in your Home Assistant configuration.
MQTT_USER None The user to send to the MQTT broker.
MQTT_PASSWORD None The password to send to the MQTT broker.
MQTT_HOST localhost IP address or hostname of the MQTT broker to connect to.
MQTT_PORT 1883 The port the MQTT broker is bound to.
MQTT_TOPIC_PREFIX apc The MQTT topic prefix.
MQTT_TIMEOUT 300 The timeout for the MQTT connection in seconds.
MQTT_QOS 1 The MQTT QoS level.
INTERVAL 15 How often (in seconds) apc2mqtt polls APCUPSD for UPS information.*
UPS_ALIAS apc Used to determine the first part of the object ID for each sensor's entity ID (sensor.XXX_battery for example).
APCUPSD_HOST 127.0.0.1 IP address or hostname of the host running APCUPSD.
DEBUG 1 Set to 1 to enable debug logging.

* By default, APCUPSD polls the UPS every 60 seconds. If you use a value lower than 60 here, you'll need to update your APCUPSD configuration (/etc/apcupsd/apcupsd.conf) by setting POLLTIME X where X is the interval in seconds.

TODO

  • Properly test everything

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.