8000 GitHub - nikolaos83/hass-MinerMonitor: Control and monitor your Bitcoin Miners from Home Assistant.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

nikolaos83/hass-MinerMonitor

 
 

Repository files navigation

hass-MinerMonitor

hacs Project Maintenance Project Maintenance Project Maintenance

Control and monitor your Bitcoin Miners from Home Assistant.

Great for Heat Reusage, Solar Mining, or any use case where you don't need your miners running 24/7 or with a specific wattage.

Works great in coordination with ESPHome for Sensors (like temperature) and Grafana for Dashboards.

Support for:

  • Antminers
  • Whatsminers
  • Avalonminers
  • Innosilicons
  • Goldshells
  • Auradine
  • BitAxe
  • IceRiver
  • Hammer
  • Braiins Firmware
  • Vnish Firmware
  • ePIC Firmware
  • HiveOS Firmware
  • LuxOS Firmware
  • Mara Firmware

Full list of supported miners.

This component will set up the following platforms -

Platform Description
sensor Show info from miner API.
number Set Power Limit of Miner.
switch Switch Miner on and off

This component will add the following services -

Service Description
reboot Reboot a miner by IP
restart_backend Restart the backend of a miner by IP

Recent Fixes and Improvements

1. Enhanced Sensor and Coordinator Data Handling

  • Improvement: Added new sensors (uptime, percent_expected_hashrate, env_temp, errors, fault_light) and ensured they are correctly defined and handled.

2. Improved Error Handling

  • Improvement: Added clearer processing for miner data errors.

3. Consistent Entity Availability Checks

  • Improvement: Ensured all entities have consistent available property implementations referencing the coordinator’s availability status.

4. Clarified Board Indexing Logic

  • Improvement: Documented and distinguished between hardware board indices (board_num) and Home Assistant-friendly indices (display_idx).

5. Verified device_info Structure

  • Improvement: Ensured consistent and complete definitions of device_info for all sensor types.

Using the Integration

Correcting Hashrate for Antminer E9 Pro

TAntminer E9 Pro hashrate is reported in TH/s, which is 1000x too high. Use the following template in your configuration.yaml to correct the hashrate:

template:
  sensor:
    - name: "Antminer E9 Corrected Hashrate"
      unit_of_measurement: "MH/s"
      device_class: power
      state_class: measurement
      state: >
        {% set raw = states('sensor.antminer_e9_hashrate') | float(0) %}
        {% if raw > 0 %}
          {{ (raw / 1000) | round(0) }}
        {% else %}
          0
        {% endif %}

Automating Miner Reset on Failure

To automatically reboot the Antminer E9 Pro in case of malfunction, use the following automation in your automations.yaml:

alias: Reset Antminer E9 Pro on Failure
description: Automatically reboot the E9 Pro if the hashrate remains below 400 MH/s for more than 120 seconds and uptime exceeds 1600 seconds.
trigger:
  - platform: numeric_state
    entity_id: sensor.antminer_e9_hashrate
    below: 400
    for:
      seconds: 120
condition:
  - condition: numeric_state
    entity_id: sensor.antminer_e9_uptime
    above: 1600
action:
  - service: miner.reboot
    target:
      device_id: <your_device_id_here>
mode: single

Note: The uptime threshold of 1600 seconds accounts for the time required to create the DAG file. Adjust this value based on the blockchain you are mining.

Here's an automation example for Antminer D7. You probably don't need the "condition:" block but it's probably a good idea to give 2-3 min slack for good measure.

alias: Reset Antiminer D7 on Failure
description: Automatically reboot D7 if the hashrate remains below 400 GH/s for more than 120 seconds and uptime exceeds 120 seconds.
triggers:
  - entity_id: sensor.antminer_d7_hashrate
    below: 400
    for:
      seconds: 120
    trigger: numeric_state
conditions:
  - type: is_value
    condition: device
    entity_id: sensor.antminer_d7_uptime
    device_id: <your_device_id_here>
    domain: sensor
    above: 120
actions:
  - action: miner.reboot
    metadata: {}
    data: {}
    target:
      device_id: <your_device_id_here>
mode: single

Installation

Use HACS, add the custom repo https://github.com/Schnitzel/hass-miner to it.

Installation and usage Video


Contributions are welcome!

If you want to contribute to this, please read the Contribution guidelines.


Credits

This project was generated from @oncleben31's Home Assistant Custom Component Cookiecutter template.

Code template was mainly taken from @Ludeeus's integration_blueprint template.

Miner control and data is handled using @UpstreamData's pyasic.


About

Control and monitor your Bitcoin Miners from Home Assistant.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.4%
  • Shell 1.6%
0