diff --git a/homeassistant/components/sensor/bitcoin.py b/homeassistant/components/sensor/bitcoin.py index fe17ff574b12b78ca2bfdf5f620ce4d9aa4fdff1..62d1622aff4298a8069a18d164ed37236e1c2c41 100644 --- a/homeassistant/components/sensor/bitcoin.py +++ b/homeassistant/components/sensor/bitcoin.py @@ -59,12 +59,14 @@ def setup_platform(hass, config, add_devices, discovery_info=None): _LOGGER.error('Currency "%s" is not available. Using "USD".', currency) currency = 'USD' - wallet = Wallet(wallet_id, password) - - try: - wallet.get_balance() - except exceptions.APIException as error: - _LOGGER.error(error) + if wallet_id is not None and password is not None: + wallet = Wallet(wallet_id, password) + try: + wallet.get_balance() + except exceptions.APIException as error: + _LOGGER.error(error) + wallet = None + else: wallet = None data = BitcoinData()