Skip to content

Latest commit

 

History

History
350 lines (280 loc) · 11.4 KB

README.md

File metadata and controls

350 lines (280 loc) · 11.4 KB

Helium Blockchain for Home Assistant

Helium Logo

NOTE: This integration ONLY WORKS on the ORIGINAL Helium blockchain, and will no longer work once Helium migrates to the Solana blockchain in mid-2023.

Sensors for monitoring individual Helium hotspots, Helium blockchain wallets, and the Helium HNT/USD Oracle price for Home Assistant. For more detailed metrics, HeliumTracker gives more detailed analytics over time including dashboards for your hosts.

beta_badge release_badge release_date hacs_badge License

Buy Me A Coffee Donate

Installation

Make sure Home Assistant Community Store (HACS) is installed. This integration is part of the default HACS store (though can also be added manually using repository: rsnodgrass/hass-helium)

Configuration

The bare minimum configuration creates general sensors to track the Helium blockchange, notably the HNT/USD Oracle price.

sensor:
  - platform: helium

Configure sensors for Helium hotspots:

sensor:
  - platform: helium
    hotspots:
      - 112JbKk4fvYmoSqHR93vRYugjiduT1JrF8EyC86iMUWjUrmW95Mn

Configure sensors for Helium wallets:

sensor:
  - platform: helium
    wallets:
      - 12ywrqqzeNFwSMvCcaohpVdiwEeK4NZChtL9rs7dhKYd85fKG9U
      - 14YeKFGXE23yAdACj6hu5NWEcYzzKxptYbm5jHgzw9A1P1UQfMv

NOTE: By default, the sensors update from the Helium Blockchain every 15 minutes. This interval can be changed by adding a 'scan_interval' entry for the sensor, but this effects all sensors. You can create automations to dynamically trigger more frequent of specific sensors using the 'homeassistant.update_entity' service call.

Advanced Configuration

This configuration.yaml setting adds a sensor to track total HNT added to wallet by day/week/month usng the utility meter integration.

utility_meter:
  helium_wallet_today:
    source: sensor.helium_wallet_12ywrqqzeNFwSMvCcaohpVdiwEeK4NZChtL9rs7dhKYd85fKG9U
    cycle: daily

  helium_wallet_weekly:
    source: sensor.helium_wallet_12ywrqqzeNFwSMvCcaohpVdiwEeK4NZChtL9rs7dhKYd85fKG9U
    cycle: weekly

  helium_wallet_monthly:
    source: sensor.helium_wallet_12ywrqqzeNFwSMvCcaohpVdiwEeK4NZChtL9rs7dhKYd85fKG9U
    cycle: monthly

Example Lovelace UI

Status of Helium hotspots using uptime card:

Lovelace Status Example

type: custom:uptime-card
entity: sensor.helium_rough_chili_bird
icon: mdi:router-wireless
ok: online
ko: offline
ko_icon: mdi:router-wireless-off
hours_to_show: 24
status_adaptive_color: true
color:
  icon: grey
show:
  icon: true
  status: false
  timeline: true
  average: true
title_adaptive_color: true
name: Rough Chili Bird

HNT Price Tracking

Track the price of HNT using mini-graph-card:

Lovelace Price Example

animate: true
entities:
  - entity: sensor.helium_hnt_oracle_price
    name: HNT/USD
graph: line
hour24: true
font_size: 75
hours_to_show: 24
points_per_hour: 12
name: Helium HNT/USD
show:
  extrema: true
  icon: false
  name: true
type: custom:mini-graph-card

Track the price of HNT using apexcharts-card:

Lovelace Price Example

type: custom:apexcharts-card
header:
  show: true
  title: Helium HNT/USD
  show_states: true
  colorize_states: true
series:
  - entity: sensor.helium_hnt_oracle_price
  - entity: sensor.helium_hnt_oracle_price
    type: column

For custom price alerts ideas, see example stock alert.

Helium Wallet

Helium wallet size per day over last 7 days:

entities:
  - entity: sensor.helium_wallet_12ywrqqzeNFwSMvCcaohpVdiwEeK4NZChtL9rs7dhKYd85fKG9U
    name: Wallet HNT
hours_to_show: 168
icon: mdi:cash
name: Helium Wallet
group_by: date
show:
  graph: bar
  icon: false
  state: true
type: custom:mini-graph-card

Wallet value:

  - platform: template
    sensors:
      helium_wallet_value:
        value_template:
          "{{ (states('sensor.helium_hnt_oracle_price') |float(0) * states('sensor.helium_wallet_12ywrqqzeNFwSMvCcaohpVdiwEeK4NZChtL9rs7dhKYd85fKG9U') | float(0)) | round(2) }}"

Total HNT Mined Today

This requires the advanced configuration above to add a utility meter for tracking today's HNT wallet amount versus yesterday's wallet. This requires the apexcharts-card.

Lovelace Today Example

type: custom:config-template-card
entities:
  - sensor.helium_wallet_today
card:
  type: custom:apexcharts-card
  header:
    show: true
    show_states: true
    colorize_states: true
    title: Helium Mined Today
  span:
    start: day
  graph_span: 24h
  all_series_config:
    stroke_width: 4
    type: line
    extend_to_end: false
    float_precision: 2
  color_list:
    - lightblue
    - grey
  series:
    - entity: sensor.helium_wallet_today
      name: Today
      type: area
      group_by:
        func: avg
        duration: 20min
    - entity: sensor.helium_wallet_today
      name: Yesterday
      offset: '-24h'
      opacity: 0.2
      group_by:
        func: avg
        duration: 20min
      show:
        in_header: true
  y_axis_precision: 0
  apex_config:
    yaxis:
      - seriesName: HNT
        decimalsInFloat: 0
      - seriesName: Helium
        show: false
    tooltip:
      x:
        format: ddd dd MMM - HH:mm
    xaxis:
      tooltip:
        enabled: false
    legend:
      show: false
    grid:
      borderColor: '#7B7B7B'
    chart:
      foreColor: '#7B7B7B'
      toolbar:
        show: false

Is there a way to change fiat currency from USD to EUR, GBP, CAD, etc?

No. By design, Helium HNT is currently tightly coupled with USD since both the Oracles are all in USD and the Helium DC (Data Credits) are all fixed to USD prices. However, you can of course convert from the USD price to other currencies using add on sensors.

For example, setting up conversion to CAD:

sensor:
  - platform: openexchangerates
    name: Canadian Currency
    api_key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    quote: CAD

  - platform: template
      sensors:
        helium_wallet_value:
          entity_id: sensor.helium_wallet_xxxxxxxxxxxxx, sensor.helium_hnt_oracle_price
          value_template: "{{ ((states('sensor.helium_hnt_oracle_price') | float(0)  * states('sensor.helium_wallet_xxxxxxxx') | float(0)) * states('sensor.canadian_currency') | float(0)) | round(2) }}"
          unit_of_measurement: "CAD"

And a simple Lovelace display (thanks @ThaNerd):

- type: custom:apexcharts-card
  header:
    show: true
    title: Helium Wallet/CAD
    show_states: true
    colorize_states: true
  series:
    - entity: sensor.helium_wallet_value
      name: Helium Wallet
      type: column

Support

This is a community supported custom component integration for Home Assistant. Code improvents and Pull Requests are appreciated.

Community Support

Feature Requests

  • allow auto-creating sensors for ALL hotspots for a given wallet (optionally)
  • create sensor for current wallet value (based on Oracle HNT price)
  • create sensors or attributes for being able to display per-hotspot rewards per 24-hour, 7-day, 30-day
  • disable polling to allow dynamic scan intervals (e.g. every min for price, every 15 min for hotspot avail, every hour for wallet value)

Out of Scope

  • local access to Helium hotspot status from proprietary vendor APIs (e.g. Bobcat diagnosis interface) -- love this idea, but this should be a separate Home Assistant integration

Here is an example for Bobcat 300's using the RESTful sensor:

sensor:
  - platform: rest
    name: "Bobcat Helium Sync Status"
    scan_interval: 300 # 5 min
    resource: http://<your-bobcat-lan-ip>/status.json
    value_template: "{{ (value_json.miner_height|float / value_json.blockchain_height|float) | round(2) }}"
    unit_of_measurement: '%'
    json_attributes:
       - "status"
       - "miner_height"
       - "blockchain_height"
       - "gap"
       - "epoch"

  - platform: rest
    name: "Bobcat Temp 0"
    scan_interval: 305 # 5 min + 5 seconds
    resource: http://<your-bobcat-lan-ip>/temp.json
    device_class: temperature
    value_template: "{{value_json.temp0|float}}"
    unit_of_measurement: "°C"

  - platform: rest
    name: "Bobcat Temp 1"
    scan_interval: 310 # 5 min + 10 seconds
    resource: http://<your-bobcat-lan-ip>/temp.json
    device_class: temperature
    value_template: "{{value_json.temp1|float}}"
    unit_of_measurement: "°C"

  - platform: rest
    name: "Bobcat Light"
    scan_interval: 300 # 5 min
    resource: http://<your-bobcat-lan-ip>/led.json
    value_template: "{{value_json.led}}"
    unit_of_measurement: "color"

Note: If you make multiple calls on bobcat API, make sure that you make unsynchronized calls in order to avoid the bobcat API error 'rate limit exceeded'.

Apple Watch Extensions

Amazing Apple Watch Helium widgets by Neil Williams using this hass-helium integration

Apple Watch Example

See Also