GithubHelp home page GithubHelp logo

whatsminer2mqtt's Introduction

Whatsminer to MQTT Gateway

whatsminer2mqtt enables data from the unofficial Whatsminer API to be polled and pushed to MQTT. Special thanks to Satoshi Anonymoto for creation of the unofficial Whatsminer API (https://github.com/satoshi-anonymoto/whatsminer-api)

How to run

Docker via docker-compose (RECOMMENDED)

  1. Create your docker-compose.yaml (or add to existing). Example docker-compose.yaml with all environmental variables:
version: '3'
services:
  whatsminer2mqtt:
    container_name: whatsminer2mqtt
    image: tediore/whatsminer2mqtt:latest
    environment:
    - MQTT_HOST=10.0.0.2
    - MQTT_PORT=1883
    - MQTT_USER=user
    - MQTT_PASSWORD=password
    - BASE_TOPIC=whatsminer2mqtt
    - HOME_ASSISTANT=True
    - MINER_IP=10.0.1.4
    - INTERVAL=10
    - LOG_LEVEL=debug
    restart: unless-stopped
  1. docker-compose up -d whatsminer2mqtt

Docker via docker run

Example docker run command with all environment variables:

docker run --name whatsminer2mqtt \
-e MQTT_HOST=10.0.0.2 \
-e MQTT_PORT=1883 \
-e MQTT_USER=user \
-e MQTT_PASSWORD=password \
-e BASE_TOPIC=whatsminer2mqtt \
-e HOME_ASSISTANT=True \
-e MINER_IP=10.0.1.4 \
-e INTERVAL=10 \
-e LOG_LEVEL=debug \
tediore/whatsminer2mqtt:latest

Bare metal (not recommended) (Requires Python 3.9+)

  1. Set the necessary environment variables
  2. git clone https://github.com/Tediore/whatsminer2mqtt
  3. cd whatsminer2mqtt
  4. python3 whatsminer2mqtt.py

Configuration

Variable Default Required Description
MQTT_HOST None True IP address or hostname of the MQTT broker to connect to.
MQTT_PORT 1883 True The port the MQTT broker is bound to.
MQTT_USER None False The user to send to the MQTT broker.
MQTT_PASSWORD None False The password to send to the MQTT broker.
BASE_TOPIC whatsminer True The topic prefix to use for all payloads.
HOME_ASSISTANT True False Set to True to enable Home Assistant MQTT discovery or False to disable.
MINER_IP None True IP address of the Whatsminer API.
INTERVAL 10 True Interval (in seconds) to query the Whatsminer API and publish MQTT payloads.
LOG_LEVEL info False Set minimum log level. Valid options are debug, info, warning, and error

Home Assistant

whatsminer2mqtt supports Home Assistant MQTT discovery which creates a Device for the Whatsminer instance and entities for each piece of information from the Whatsminer API summary command.


MQTT topic structure

Payloads for each piece of information are published to BASE_TOPIC/info/PARAMETER where BASE_TOPIC is the base topic you define and PARAMETER is the name of each monitored condition from the summary command.


Buy Me A Coffee

whatsminer2mqtt's People

Stargazers

 avatar

Watchers

 avatar

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.