Nicehash Component

I am using IOTLink, but for my use case I have my Harmony activity being monitored accordingly. Another automation turns the switch on when “leaving” that activity.

alias: Mining - Turn off when PC in use
description: ''
trigger:
  - platform: state
    entity_id: sensor.theater_harmony
    to: Watch PC
condition: []
action:
  - service: switch.turn_off
    data: {}
    entity_id: switch.nh_morpheus_power
mode: single

2 Likes

good evening. I have prices appearing in EUR and the problem is showing 14 decimal places. in value in BTC and MH / S the same is also true. how can i decrease these decimal places? thanks

1 Like

Great work on this. Thank you so much!

There’s a solution over there: https://github.com/RomRider/ha_nicehash/issues/7

First time creating a template sensor. This is the template I used:

value_template: {{ states('sensor.nh_nicehash_totalprofitability_sek')|round }}

Configuration.yaml:

- platform: template

  sensors:

    nice_hash_wallet_balance: 

      value_template: >-

        {{ states('sensor.nh_nicehash_totalbalance_sek')|round }}

This creates a new sensor in HA called “nice_hash_wallet_balance” that removes the decimals.

Thank you both …
Is there no way to change the decimal places without touching the configuration.yaml file?
touching a file in the custom_components folder …
Thank you for your help

Hello,

@RomRider Thank you for this great integration.

I can’t get it to work in Euro. When i enter EUR in currency, it connects, but all the entities for euro are unavailable.

Here are the logs.

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 126, in _handle_refresh_interval
await self.async_refresh()
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 200, in async_refresh
update_callback()
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 260, in _handle_coordinator_update
self.async_write_ha_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 295, in async_write_ha_state
self._async_write_ha_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 319, in _async_write_ha_state
sstate = self.state
File “/config/custom_components/nicehash/sensor.py”, line 379, in state
* self.coordinator.data[ACCOUNT_OBJ][“currencies”][0][“fiatRate”]
KeyError: ‘fiatRate’

Did you enable the right API authorization as described on github?

Yes. Also the entities only update when i restart.I also just tried with USD and it also doesn’t work for me.

Today, it is working. I don’t know what changed.

Maybe the API was down yesterday, it happens quite often with NiceHash

1 Like

Thanks for the integration! I was able to build a nice dashboards using it. Is there a way to obtain payment events via api? I’d like to create alert each time I get paid.

You can consider payment happens when last state of unpaid amount is inferior to its previous state.

Does anyone have this working? I just started nice hash, made the API etc.

But when I hit next on the integration page it just fails.

* 500: Internal Server Error: {"error_id":"9bdc9c7e-7CCf-402e-8120-5f9495254536","errors":[{"code":10,"message":"An error occurred while fulfilling the request"}]}

This is what I need!

I’ve been using this for a while now, and love it, thought i would share my Lovelace card with others as i couldnt find anything that nice looking, The card requires some frontend addons from hacs which ive also listed below:

  • custom:vertical-stack-in-card
  • custom:uptime-card
  • horizontal-stack
  • custom:button-card
  • custom:template-entity-row
  • custom:mini-graph-card

Screenshot


Ive thrown the raw code below for anybody that wants to make it their own!

type: 'custom:vertical-stack-in-card'
cards:
  - type: horizontal-stack
    cards:
      - type: markdown
        content: '## ******Leons PC******'
      - type: glance
        entities:
          - entity: person.leon_fisher
        show_name: false
        show_icon: true
        show_state: true
      - type: markdown
        content: '## RTX 2000 i7-9700K Max: 750W'
  - type: 'custom:uptime-card'
    entity: sensor.nh_leonspc_minerstatus
    name: Miner Up-Time
    icon: 'mdi:pickaxe'
    hours_to_show: 2
    update_interval: 10
    ko_icon: 'mdi:exclamation-thick'
    ko: OFFLINE
    ok: MINING
    icon_adaptive_color: true
    title_adaptive_color: true
    color:
      ok: '#66CC00'
      ko: orange
      half: orange
      none: black
    bar:
      spacing: 1
      height: 20
      round: 0
      amount: 40
    show:
      average: true
      status: true
      title: true
      header: true
      icon: true
      timeline: true
      footer: true
    alignment:
      status: spaced
      header: left
      icon_first: true
    tap_action:
      action: more-info
    alias: {}
    tooltip:
      animation: true
      hour24: false
  - type: horizontal-stack
    cards:
      - type: 'custom:button-card'
        color_type: label-card
        color: white
        icon: 'mdi:connection'
        entity: switch.nh_leonspc_power
        name: Leons PC | Offline
        styles:
          card:
            - height: 80px
        state:
          - value: 'on'
            color: green
            icon: 'mdi:pickaxe'
            name: Leons PC | Mining
          - value: 'off'
            color: orange
            icon: 'mdi:bell-sleep'
            name: Leons PC | Paused
      - type: 'custom:button-card'
        color_type: icon
        color: white
        icon: 'mdi:connection'
        entity: switch.leon_s_computer
        name: Ping Response API Error
        styles:
          card:
            - height: 80px
        state:
          - value: 'on'
            color: green
            icon: 'mdi:lan-connect'
            name: Connected
          - value: 'off'
            color: white
            icon: 'mdi:lan-disconnect'
            name: Disconnected
  - type: entities
    show_header_toggle: false
    entities:
      - type: 'custom:template-entity-row'
        icon: 'mdi:expansion-card'
        name: GPU Usage
        state: >-
          Overall {{
          states('sensor.leons_pc_nvidia_nvidia_geforce_rtx_2080_ti_load_gpu_core')|round
          }}%
        secondary: >-
          {{
          states('sensor.leons_pc_nvidia_nvidia_geforce_rtx_2080_ti_temperatures_gpu_core')|round
          }}°C
        active: >-
          {{
          states('sensor.leons_pc_intel_core_i7_9700k_temperatures_cpu_package')|int
          > 30|int }}
      - type: 'custom:template-entity-row'
        icon: 'mdi:cpu-64-bit'
        name: CPU Usage
        state: >-
          Overall {{
          states('sensor.leons_pc_intel_core_i7_9700k_load_cpu_total')|round }}%
        secondary: >-
          {{
          states('sensor.leons_pc_intel_core_i7_9700k_temperatures_cpu_package')|round
          }}°C
        active: >-
          {{
          states('sensor.leons_pc_intel_core_i7_9700k_temperatures_cpu_package')|int
          > 30|int }}
      - type: 'custom:template-entity-row'
        icon: 'mdi:pickaxe'
        name: Synced Hash Rate
        state: >-
          {{ states('sensor.nh_leonspc_daggerhashimoto_speedaccepted')|round }}
          MH/s
        active: >-
          {{ states('sensor.nh_leonspc_daggerhashimoto_speedaccepted')|int >
          5|int }}
      - type: 'custom:template-entity-row'
        icon: 'mdi:currency-usd'
        name: Profit Generator
        state: >-
          Generating £{{
          states('sensor.nh_leonspc_localprofitability_gbp')|round }} Per
          24/Hour
        secondary: >-
          (£{{ states('sensor.nh_leonspc_profitability_gbp')|round }} Global
          Profit)
        active: '{{ states(''sensor.nh_leonspc_profitability_gbp'')|int > 1|int }}'
  - type: horizontal-stack
    cards:
      - type: 'custom:mini-graph-card'
        entities:
          - sensor.nh_leonspc_localprofitability_gbp
        name: Profit Over Time
        hours_to_show: 7
        icon: 'mdi:currency-usd'
        unit_of_measurement: GBP
        labels: true
        color_thresholds:
          - value: 3
            color: '#95e861'
          - value: 2
            color: '#e8b261'
          - value: 1
            color: '#e86161'
      - type: 'custom:mini-graph-card'
        entities:
          - sensor.nh_leonspc_daggerhashimoto_speedaccepted
        name: MH/s Over Time
        hours_to_show: 7
        icon: 'mdi:expansion-card'
        unit_of_measurement: GBP
        show_more_detail: true
        labels: true
        color_thresholds:
          - value: 40
            color: '#95e861'
          - value: 30
            color: '#e8b261'
          - value: 10
            color: '#e86161'


Its still a work in progress but isn’t everything home assistant related :joy:
Thanks for the great work! :heart:

5 Likes

I’ve only managed to get half of this working, for some reason i’m getting alot of “unavailable”

Hello The Fonix, Great card you have made there !!!
I have it all working bar the GPU Info and CPU info witch I have no sensors for how did you get them to work.
Thanks James

Edit: I have figgered it out but thanks again.

1 Like

For anybody else struggling, I use this, as it already has an integration with Hass
Open Hardware Monitor - Core temp, fan speed and voltages in a free software gadget

1 Like

hello, i added the url to the custom integration into HACS and installed. I do see the nicehash folder in my custom_components folder but when i try to find the integration in the “setup a new integration” i cant find it. can someone help me? thanks!