RomRider / ha_nicehash

💵 Custom NiceHash integration for Home-Assistant
MIT License
36 stars 13 forks source link

Not really an issue - decimal places #7

Open BassBoi opened 3 years ago

BassBoi commented 3 years ago

Very good integration! is there a simple way to limit the amount of decimal places? for example my hashrate is 61.125465859008465 MH/s. Sorry if dumb question

RomRider commented 3 years ago

There should be a way with a template sensor but for now, not natively with the integration 😊

Kryzek commented 3 years ago

I used https://github.com/thomasloven/lovelace-template-entity-row for formatting and my entity-card is something like:

entities:
  - type: 'custom:template-entity-row'
    icon: 'mdi:currency-eur'
    name: BTC Balance Unpaid / Paid
    state: >-
      {{ (states('sensor.nh_nicehash_unpaidamount_eur')| float |round(2)) }}€ /
      {{ (states('sensor.nh_nicehash_totalbalance_eur')| float |round(2)) }}€

Which turns into: image

Hope this helps and gives you the ideas to approach this :)

irekzielinski commented 2 years ago

I modified sensor.py to round most of the rig values to 2 decimal places:

image

Abruzzi04 commented 2 years ago

I modified sensor.py to round most of the rig values to 2 decimal places:

image

Captura de ecrã 2022-05-04 130451

Hello. This solution didn't work for me :s