Git Product home page Git Product logo

mornesaunders360 / nh_nicehash Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 147 KB

The NiceHash API Integration for Home Assistant provides real-time monitoring of your cryptocurrency mining. It tracks mining status, profitability, balance, and individual worker details. It also supports personalized alerts and scheduling for optimal mining operations.

License: MIT License

Python 100.00%
hacs hacs-custom hacs-integration nicehash nicehash-api

nh_nicehash's Introduction

NiceHash Api hacs_badge

A Home Assistant integration to track your Nicehash rigs.

image

HACS Install

  1. Access HACS: Open Home Assistant and click on HACS in the sidebar.
  2. Go to Integrations: Navigate to the Integrations tab.
  3. Add Custom Repository: Click on the menu in the top right corner (three vertical dots), then select Custom Repositories.
  4. Enter Details: In the new window, you need to input the necessary information about the custom integration you want to add
  5. Add custom repository URL: Paste the URL of the repository you want to add.
  6. Select category: Choose 'Integration' from the category dropdown menu.
  7. Add: Click the Add button to confirm. This action should add the custom integration to HACS.
  8. Select "+ Explore & Download Repositories" and search for "NiceHash Api"
  9. Select "NiceHash Api" and "Download this repository with HACS"
  10. Once downloaded, go to settings, then devices and services
  11. Click on add intergration and search for 'NiceHash Api'

Enabling the integration

Setup the API Key

You'll need to create an API key in NiceHash for this integration to work:

  1. head over to your NiceHash account settings

  2. Go into the API Keys menu

  3. In this menu at the top, you'll find your Organisation ID which is required to later setup the integration in Home-Assistant

    org_id

  4. click CREATE NEW API KEY

  5. This will present you with this popup:

    api_config

  6. โš ๏ธ Make sure you configure it like the above picture (DO NOT ENABLE ANY OF THE OTHER SETTINGS, this is at your own risk)

  7. Click on GENERATE API KEY

  8. This will give you 2 strings, note them down, you can't retrieve them later on:

    • The Key
    • The Secret
  9. Validate the popup and enable the API Key (it will be through email)

Setup Home Assistant

Once that is done, head over to Home-Assistant and add the integration from the integration menu:

  1. Key and Secret: This is the key/secret you retrieved from the API Key creation
  2. Org ID: This is the Organization ID
  3. You're all set

nh_nicehash's People

Contributors

mornesaunders360 avatar

Watchers

 avatar

Forkers

showdpro

nh_nicehash's Issues

Integration does not load any entities or devices

For the past 6 months I have been using the RomRider NiceHash integration.
It stopped responding this past weekend, and I have been looking for a alternate, including use of the Home Assistant REST and the NiceHash API.
I came upon your integration, recently added and updated, and installed.

Your integration seems to load (no errors in the interface), unfortunately "No devices or entities"

Here is an output of the log and an error related to the integration...hope it helps

Home Assistant version 2023.6.2

-=-===-=-=-=-=-=

Logger: homeassistant.components.sensor
Source: helpers/update_coordinator.py:258
Integration: Sensor (documentation, issues)
First occurred: 11:38:16 AM (1 occurrences)
Last logged: 11:38:16 AM

Error while setting up nh_nicehash platform for sensor
Traceback (most recent call last):
File "/config/custom_components/nh_nicehash/coordinator.py", line 37, in fetch_data
totalBalance = json.loads(my_accounts_json)['totalBalance'] | int
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
TypeError: string indices must be integers, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 242, in _async_update_data
return await self.update_method()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/nh_nicehash/coordinator.py", line 103, in fetch_data
raise UpdateFailed(f"Error fetching data from NiceHash API: {e}")
homeassistant.helpers.update_coordinator.UpdateFailed: Error fetching data from NiceHash API: string indices must be integers, not 'str'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 320, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/nh_nicehash/sensor.py", line 10, in async_setup_entry
await coordinator.async_config_entry_first_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in async_config_entry_first_refresh
raise ex
homeassistant.exceptions.ConfigEntryNotReady: Error fetching data from NiceHash API: string indices must be integers, not 'str'

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.