Monitor your cryptocurrency mining on Ethermine, Flexpool and 2miners!

is it just me or got the changes reverted in the latest release 1.1.1?
if I check for unpaid attribute it gives me 40,xxx,xxx instead of the 0,04 I would expect. Might that be an issue with the decimal separator?

Which changes are you referring to?

Assuming you’re thinking about FlexpoolInfo which is the only one out of the three that has a release v1.1.1, I’ve checked the unpaid attribute and it’s remained the same since the initial release of the component.

I was referring to the changes on the attributes (Hashrate and unpaid) that Roemer mentioned ~ 29 days ago. Or did I get the information wrong, that these attributes were changed to a readable format?

I just checked the attributes overall and it seems that I misunderstood the previous comments on that topic, as I thought that “unpaid” was changed to reflect the value shown in the 2miners page, instead of the xxxxxxxx value

I mean I helped myself, by dividing the value in my template by

{% set state = states.sensor['2minersinfo_eth_wallet'].attributes['unpaid'] %}{{ (state | float / 1000000000 )}}

btw maybe a good opportunity to update the example template code (on the 2miners integration), to reflect the requirement to write the 2miners_miner_address with [''] brackets, as it would otherwise throw an error (at least in HAOS) due to the entityID starting with a number (states.sensor.2miners_miner_address)

In EthermineInfo, yes the attributes were changed.

Hi, I got the same problem as alessandro.bardi, but i indeed run workers on the ethermine.org pool, and the https://api.ethermine.org/miner/miner_address/dashboard does return values, but i can’t get them in HA, maybe i’m doing something wrong…I tried with 40 && with 42 characters and still nothing. My only other option to failure is that haven’t setup a template yet, but it isn’t mandatory i think reading the github page. BTW i’m running the latest v1.0.20

Not quite the same as the other chap wasn’t using Ethermine :wink:

The homeassitant logs will give us both a starting point. Can you share them please?

1 Like

Insert the logger: logs: custom_components.ethermineinfo: debug to configuration?

Yep, that should give us what we need unless there’s something weirder going on.

On my testing box I have about a dozen addresses configured from the list of top miners so I would like to believe everything’s alright with the code and this is something silly like a misplaced quote mark or something.

Where does the debug place the log file? Nevermind i found what the problem was, my firewall was blocking the api.ethermine.org address.

1 Like

Thanks for the quick help though, i did find the problem when the log file said that it couldn’t connect to the api server. One quick last question, the template is configured through the configuration.yaml?

Oh that’s interesting, wasn’t betting on that being the reason! At least you know the config is solid.

The template sensor goes in the sensor: section of your configuration.yaml

1 Like

The template sensor for me isn’t working at least not with the current code i have:

sensor:
  - platform: ethermineinfo
    miner_address: "walletaddress"
    currency_name: USD
    name_override: "Wallet"
  - platform: template
    sensors:
    average_hashrate_24h:
    value_template: "{{ (state_attr('sensor.ethermineinfo_wallet','average_hashrate_24h') | float(default = 0)/1000000)| round(2)}}"
  - platform: template
    sensors:
    current_hashrate:
    value_template: "{{ (state_attr('sensor.ethermineinfo_wallet','current_hashrate')| float(default = 0)/1000000)| round(2)}}"
  - platform: template
    sensors:
    reported_hashrate:
    value_template: "{{ (state_attr('sensor.ethermineinfo_wallet','reported_hashrate')| float(default = 0)/1000000)| round(2)}}"
  - platform: template
    sensors:
    unpaid_in_local_currency:
    friendly_name: "unpaid"
    value_template: "{{ (state_attr('sensor.ethermineinfo_wallet','unpaid_in_local_currency'))}}"
  - platform: template
    sensors:
    paid_on:
    friendly_name: "paid"
    value_template: "{{ (state_attr('sensor.ethermineinfo_wallet','paid_on'))}}"

It gives me the following error


                    Invalid config for [sensor.template]: expected dictionary for dictionary value @ data['sensors']. Got None
extra keys not allowed @ data['average_hashrate_24h']. Got None
extra keys not allowed @ data['value_template']. Got "{{ (state_attr('sensor.ethermineinfo_wallet','average_hashrate_24h') | float(default = 0)/1000000)| round(2)}}". (See ?, line ?). 
Invalid config for [sensor.template]: expected dictionary for dictionary value @ data['sensors']. Got None
extra keys not allowed @ data['current_hashrate']. Got None
extra keys not allowed @ data['value_template']. Got "{{ (state_attr('sensor.ethermineinfo_wallet','current_hashrate')| float(default = 0)/1000000)| round(2)}}". (See ?, line ?). 
Invalid config for [sensor.template]: expected dictionary for dictionary value @ data['sensors']. Got None
extra keys not allowed @ data['reported_hashrate']. Got None
extra keys not allowed @ data['value_template']. Got "{{ (state_attr('sensor.ethermineinfo_wallet','reported_hashrate')| float(default = 0)/1000000)| round(2)}}". (See ?, line ?). 
Invalid config for [sensor.template]: expected dictionary for dictionary value @ data['sensors']. Got None
extra keys not allowed @ data['friendly_name']. Got 'unpaid'
extra keys not allowed @ data['unpaid_in_local_currency']. Got None
extra keys not allowed @ data['value_template']. Got "{{ (state_attr('sensor.ethermineinfo_wallet','unpaid_in_local_currency'))}}". (See ?, line ?). 
Invalid config for [sensor.template]: expected dictionary for dictionary value @ data['sensors']. Got None
extra keys not allowed @ data['friendly_name']. Got 'paid'
extra keys not allowed @ data['paid_on']. Got None
extra keys not allowed @ data['value_template']. Got "{{ (state_attr('sensor.ethermineinfo_wallet','paid_on'))}}". (See ?, line ?). 
                  

Your formatting is off.

sensor:
  - platform: template
    sensors:
      stale_shares:
        friendly_name: "Stale shares"
        value_template: "{{ states.sensor.ethermineinfo_miner_address.attributes['stale_shares'] }}"
      current_hashrate:
        friendly_name: "Current hash rate"
        value_template: "{{ states.sensor.ethermineinfo_miner_address.attributes['current_hashrate'] }}"
        unit_of_measurement: "MH/s"
1 Like

For anybody who wants to have the template:

  - platform: template
    sensors:
      stale_shares:
        friendly_name: "Stale shares"
        value_template: "{{ states.sensor.ethermineinfo_wallet.attributes['stale_shares'] }}"
      current_hashrate:
        friendly_name: "Current hash rate"
        value_template: "{{ (states.sensor.ethermineinfo_wallet.attributes['current_hashrate'] | float(default = 0)/1000000)| round(2)}}"
        unit_of_measurement: "MH/s"
      reported_hashrate:
        friendly_name: "Reported hashrate"
        value_template: "{{ (states.sensor.ethermineinfo_wallet.attributes['reported_hashrate'] | float(default = 0)/1000000)| round(2)}}"
        unit_of_measurement: "MH/s"
      unpaid_in_local_currency:
        friendly_name: "Unpaid in USD"
        value_template: "{{ states.sensor.ethermineinfo_wallet.attributes['unpaid_in_local_currency'] }}"
      paid_on:
        friendly_name: "Last Paid On"
        value_template: "{{ states.sensor.ethermineinfo_wallet.attributes['paid_on'] }}"
2 Likes

Hello @thomasprior,

I’m trying 2Miners integration but when i want to do the same exercise as i made with ethermine I’ve got config errors.

  - platform: template
    sensors:
      rvn_current:
        friendly_name: "Current Hashrate 2Miners RVN"
        value_template: "{{ states.sensor.2minersinfo_rvn_binance_wallet.attributes['current_hashrate_mh_sec'] }}"
        unit_of_measurement: "RVN"
      rvn_unpaid:
        friendly_name: "Unpaid RVN"
        value_template: "{{ (states.sensor.2minersinfo_rvn_binance_wallet.attributes['unpaid'] /100000000 )|round(2)}}"
        unit_of_measurement: "RVN"
      rvn_eur_value:
        value_template: "{{ (states.sensor.2minersinfo_rvn_binance_wallet.attributes['single_coin_in_local_currency']) }}"
        unit_of_measurement: "EUR"
      rvn_unpaid_eur:
        friendly_name: "Unpaid EUR 2Miners RVN"
        value_template: "{{
            (((
            (states.sensor.2minersinfo_rvn_binance_wallet.attributes['unpaid'])
            / (states.sensor.2minersinfo_rvn_binance_wallet.attributes['single_coin_in_local_currency'])
            ))|round(2)
            )/100000000
        }}"
        unit_of_measurement: "EUR"

In Home Assistant File editor it appears ok and when I do a check configuration :

Invalid config for [sensor.template]: invalid template (TemplateSyntaxError: expected token ')', got 'minersinfo_rvn_binance_wallet') for dictionary value @ data['sensors']['rvn_eur_value']['value_template']. Got "{{ (states.sensor.2minersinfo_rvn_binance_wallet.attributes['single_coin_in_local_currency']) }}"
invalid template (TemplateSyntaxError: expected token ')', got 'minersinfo_rvn_binance_wallet') for dictionary value @ data['sensors']['rvn_unpaid']['value_template']. Got "{{ (states.sensor.2minersinfo_rvn_binance_wallet.attributes['unpaid'] /100000000 )|round(2)}}"
invalid template (TemplateSyntaxError: expected token ')', got 'minersinfo_rvn_binance_wallet') for dictionary value @ data['sensors']['rvn_unpaid_eur']['value_template']. Got "{{ ((( (states.sensor.2minersinfo_rvn_binance_wallet.attributes['unpaid']) / (states.sensor.2minersinfo_rvn_binance_wallet.attributes['single_coin_in_local_currency']) ))|round(2) )/100000000 }}"
invalid template (TemplateSyntaxError: expected token 'end of print statement', got 'minersinfo_rvn_binance_wallet') for dictionary value @ data['sensors']['rvn_current']['value_template']. Got "{{ states.sensor.2minersinfo_rvn_binance_wallet.attributes['current_hashrate_mh_sec'] }}". (See ?, line ?).

What appears to be odd is the “got ‘minersinfo_rvn_binance_wallet’” where have gone the 2 from 2miners…

Thanks for you help

As I understand it, this is an issue with the template, not the component (unless you count naming the component 2minersInfo, in which case it is) :wink:

Jinja/HomeAssistant is interpreting the name in the sensor instead of simply reading it as a whole. Try another method to expose attributes as sensors, this worked for me just now:

state_attr('sensor.wallet_id', 'unpaid')

The ' marks force homeassistant to read the name of the sensor as it is written, instead of trying to interpret the name, and that’s where things are getting messy.

If this works, pleas let me know and I’ll update the documentation.

1 Like

This worked for me too !!

You can update the documentation.

I will try to make something similar to this Topic in order to replace what was done with ETH in ethermine but with 2miners, I’ll try to have a look to Flexpool also but since I’m mining on 2Miners… :slight_smile:

1 Like

Hello, delighted Thomas, I’m trying to modify your code base to be able to implement firo in 2miners. Change the api address from zxc to firo.2miners. since it was outdated and an infinite number of things. But I can’t get it to work. Could you help me get firo working at 2miners.com Thank you very much. PS any advice would also help me :slight_smile:

Show me your progress in a PR and I’ll do what I can to help.

I changed the api to the new firo one. but I’m stuck it doesn’t return information. I’m very new, sorry for the inconvenience. https://github.com/alavadomanuel/2miners--firo-mod/blob/67935a1ed87a210c665e261d4f155bfa9a0f502a/2minersInfo-firo.rar