Code Monkey home page Code Monkey logo

ethermineinfo's Introduction

EthermineInfo

⚠️ This repository is archived as Ethermine.org has suspended Ethereum mining indefinitely. Please refer to their announcement for more information.

hacs_badge

A custom component for HomeAssistant

Provides data from Ethermine.org on a specified miner.

If this has been of use, please consider funding my caffeine habit:

Functionality

  • Create sensor items for Ethermine items:
    • Current statistics

      ✔ Unpaid balance

      ✔ Reported hash rate

      ✔ Average hash rate

      ✔ Current hash rate

      ✔ Valid shares

      ✔ Invalid shares

      ✔ Stale shares

      ✔ Active workers

      ✔ Balance in local currency

    • Payouts

      ✔ Paid on

      ✔ Amount

      ✔ Transaction hash

      ✔ Value in local currency

Things you should know about EthermineInfo

  • The Ethermine API has been subject to change - there may be occaisions where a code change is required before the component will work again.
  • There are limits on how many requests can be made to Ethermine's API and therefore the data retrieved by EthermineInfo will be updated periodically and may be out of date by the time you look at it.
  • Please do not use EthermineInfo in isolation to make decisions about your cryptocurrency holdings.
  • EthermineInfo only reads the statistics of the provided miner.

Pre-requisite knowledge

Before downloading and configuring EthermineInfo, please ensure you are familiar with the following items:

  • HomeAssistant's configuration file LINK
  • YAML syntax LINK
  • Installation of custom components via:
    • HACS LINK
    • Manual custom component installation
  • Adding template sensors to your configuration LINK

Installation

Copy the files in the /custom_components/ethermineinfo/ folder to: [homeassistant]/config/custom_components/ethermineinfo/

HACS users, you know what to do! In case you don't:

  1. Open HACS from your HomeAssistant sidebar
  2. Press the "Explore & Add Repositories"
  3. Enter "EthermineInfo" into the search box
  4. Press "EthermineInfo"
  5. Press "Install this repository in HACS"
  6. Don't forget to complete the configuration before restart HomeAssistant!

Configuration

To use EthermineInfo, please add the following items to your HomeAssistant configuration.yaml

sensor:
  - platform: ethermineinfo
    miner_address: (required) the address of your Ethermine miner
    currency_name: (required) the currency you would like your unpaid balance to be converted to 
    name_override: (optional) name to identify your wallet instead of your miner address.

Please note that the Ethermine API accepts the address in two formats:

  • 42 characters beginning with 0x
  • 40 characters with the 0x removed

Both can be configured, but the 42 character options must be encapsulated in quote marks. Failure to do so will just return "unknown" in HomeAssistant.

Examples:

sensor:
  - platform: ethermineinfo
    miner_address: "0x1234567890123456789012345678901234567890"
    currency_name: USD
sensor:
  - platform: ethermineinfo
    miner_address: "1234567890123456789012345678901234567890"
    currency_name: USD
sensor:
  - platform: ethermineinfo
    miner_address: "1234567890123456789012345678901234567890"
    currency_name: USD
    name_override: "wallet name"

Multiple addresses can be configured.

Templates

You can create a template sensor for any of the attributes returned by EthermineInfo. For example:

Stale shares: {{ states.sensor.ethermineinfo_miner_address.attributes['stale_shares'] }}

Current hashrate: {{ states.sensor.ethermineinfo_miner_address.attributes['current_hashrate'] }}

Unpaid amount: {{ states.sensor.ethermineinfo_miner_address.attributes['unpaid'] }}

How does it look?

image

Some rather pretty graphs are possible with the mini-graph-card:

image

Discussion

Talk about EthermineInfo here

Post issues with EthermineInfo here

Issues should be posted with logs and relevant, redacted excerpts from your configuration.yaml file to ensure that help can be given most effectively.

Pull requests and constructive criticism are always welcome.

Credits

@heyajohnny's CryptoInfo from which this component was born.

W3Schools for being an invaluable learning resource.

ethermineinfo's People

Contributors

scribblrsam avatar thomasprior avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ethermineinfo's Issues

Sensor does not seem to get data

Hey, it's me from the home assistant forum. I collected the following logs:

Logger: homeassistant.helpers.entity
Source: custom_components/ethermineinfo/sensor.py:124
Integration: ethermineinfo (documentation, issues)
First occurred: 23:16:10 (1 occurrences)
Last logged: 23:16:10

Update for sensor.ethermineinfo_83984_____________________________________________113 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 316, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 524, in async_device_update
raise exc
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/util/init.py", line 280, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/ethermineinfo/sensor.py", line 124, in _update
self._state = r.json()['data']['currentStatistics']['activeWorkers']
KeyError: 'data'

I hope this will help solving the problem.

Greetings,

[ISSUE] It do not work again after 12-30-2021

Describe the issue
All sensor of the integration are in "unknown" state

This is what the log says:

`Este error se originó a partir de una integración personalizada.

Logger: homeassistant.helpers.entity
Source: custom_components/ethermineinfo/sensor.py:190
Integration: ethermineinfo (documentation, issues)
First occurred: 23:38:00 (7 occurrences)
Last logged: 23:41:26

Update for sensor.ethermineinfo_ethermine_alsaje fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 487, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 691, in async_device_update
raise exc
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/util/init.py", line 195, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/ethermineinfo/sensor.py", line 190, in _update
self._state = r.json()['data']['currentStatistics']['activeWorkers']
KeyError: 'activeWorkers'`

This is in my sensors.yaml
- platform: ethermineinfo miner_address: "0xa2fF046A6346f686Ba8Cf77C28706F4319600613" currency_name: EUR name_override: "Ethermine Alsaje"

[ISSUE] Fails if all workers are offline

  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 487, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 691, in async_device_update
    raise exc
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 195, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/ethermineinfo/sensor.py", line 190, in _update
    self._state = r.json()['data']['currentStatistics']['activeWorkers']
KeyError: 'activeWorkers'```

Entity sensor.ethermineinfo_eth (<class 'custom_components.ethermineinfo.sensor.EthermineInfoSensor'>) implements device_state_attributes. Please report it to the custom component author.

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:549
First occurred: 09:46:41 (1 occurrences)
Last logged: 09:46:41

Entity sensor.ethermineinfo_eth (<class 'custom_components.ethermineinfo.sensor.EthermineInfoSensor'>) implements device_state_attributes. Please report it to the custom component author.

System Health

version: core-2021.12.6
installation_type: Home Assistant OS
dev: false
hassio: true
docker: true
user: root
virtualenv: false
python_version: 3.9.7
os_name: Linux
os_version: 5.10.83
arch: x86_64
timezone: Asia/Shanghai

GitHub API: ok
Github API Calls Remaining: 4885
Installed Version: 1.18.0
Stage: running
Available Repositories: 932
Installed Repositories: 15

logged_in: false
can_reach_cert_server: ok
can_reach_cloud_auth: ok
can_reach_cloud: ok

host_os: Home Assistant OS 7.0
update_channel: stable
supervisor_version: supervisor-2021.12.2
docker_version: 20.10.9
disk_total: 30.8 GB
disk_used: 18.1 GB
healthy: true
supported: true
board: ova
supervisor_api: ok
version_api: ok
installed_addons: File editor (5.3.3), Mosquitto broker (6.0.1), Terminal & SSH (9.2.2), RPC Shutdown (2.2), Node-RED (9.2.1), Samba share (9.5.1), ESPHome (1.20.3), Duck DNS (1.14.0), InfluxDB (4.3.0), Nginx Proxy Manager (0.11.0)

dashboards: 1
resources: 6
views: 3
mode: storage

After updating to 1.0.0, the sensor fails to update if local_currency is specified

Describe the issue
The sensor fails to update if the currency_name parameter is specified

To Reproduce
Steps to reproduce the behavior:

  1. Configure the sensor like in the example
  2. Restart HA to apply the new config
  3. Observe the sensor not updating and this in the log:
2021-05-21 18:53:48 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ethermineinfo_metamask fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 316, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 524, in async_device_update
    raise exc
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 280, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/ethermineinfo/sensor.py", line 212, in _update
    self._single_coin_in_local_currency = r4.json()['ethereum'][self.local_currency]
KeyError: 'USD'
  1. Removing the parameter and restarting HA fixes the sensor

Expected behaviour
Sensor updates correctly, no exceptions in the log

Configuration

  - platform: ethermineinfo
    miner_address: "0x..."
    currency_name: USD
    name_override: "Metamask"

Environment (please complete the following information):

System Health

version core-2021.5.5
installation_type Home Assistant Container
dev false
hassio false
docker true
virtualenv false
python_version 3.8.9
os_name Linux
os_version 5.4.0-62-generic
arch x86_64
timezone Europe/Moscow
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 4642
Installed Version 1.12.3
Stage running
Available Repositories 825
Installed Repositories 26
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Lovelace
dashboards 1
resources 10
views 6
mode storage

Additional context
Add any other context about the problem here.

[ISSUE]

Describe the issue
A clear and concise description of what the issue is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behaviour
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Configuration

Environment (please complete the following information):

Additional context
Add any other context about the problem here.

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.