Skip to content

blockchain.info sensor#7856

Merged
balloob merged 5 commits into
home-assistant:devfrom
nkgilley:blockchain
Jun 5, 2017
Merged

blockchain.info sensor#7856
balloob merged 5 commits into
home-assistant:devfrom
nkgilley:blockchain

Conversation

@nkgilley
Copy link
Copy Markdown
Contributor

@nkgilley nkgilley commented Jun 1, 2017

Description:

Sensor to monitor a list of bitcoin wallet addresses via blockchain.info. This sensor will return the total balance of all of the listed wallet addresses.

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2734

Example entry for configuration.yaml (if applicable):

sensor:
  - platform: blockchain
    addresses:
      - '1BMsHFczb2vY1BMDvFGWgGU8mkWVm5fupp'
      - '183J5pXWqYYsxZ7inTVw9tEpejDXyMFroe'

Checklist:

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

@mention-bot
Copy link
Copy Markdown

@nkgilley, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @fabaff and @robbiet480 to be potential reviewers.

import homeassistant.helpers.config_validation as cv
import voluptuous as vol

REQUIREMENTS = ['python-blockchain-api==0.0.1']
Copy link
Copy Markdown
Member

@fabaff fabaff Jun 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bitcoin sensor is using the blockchain module. Perhaps it's worth to re-use that to avoid two deps while using both sensors.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could use it, but it was missing the method I was looking for: https://github.com/blockchain/api-v1-client-python/issues/51



def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the etherscan sensors."""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy-&-paste error.



class BlockchainSensor(Entity):
"""Representation of an Etherscan.io sensor."""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dito

def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the etherscan sensors."""
add_devices([BlockchainSensor('Bitcoin Balance',
config.get(CONF_ADDRESSES))])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be that the addresses are not valid.

@balloob balloob merged commit 81b1446 into home-assistant:dev Jun 5, 2017
@balloob
Copy link
Copy Markdown
Member

balloob commented Jun 5, 2017

Thanks! 🐬

@balloob balloob mentioned this pull request Jun 16, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Sep 4, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants