switch to list for options

This commit is contained in:
Fabian Affolter 2015-05-17 00:36:32 +02:00
parent 61148d8215
commit 397336e03c

View File

@ -20,28 +20,27 @@ sensor:
password: YOUR_ACCOUNT_PASSWORD password: YOUR_ACCOUNT_PASSWORD
currency: YOUR CURRENCY currency: YOUR CURRENCY
display_options: display_options:
- type: 'exchangerate' - exchangerate
- type: 'trade_volume_btc' - trade_volume_btc
- type: 'miners_revenue_usd' - miners_revenue_usd
- type: 'btc_mined' - btc_mined
- type: 'trade_volume_usd' - trade_volume_usd
- type: 'difficulty' - difficulty
- type: 'minutes_between_blocks' - minutes_between_blocks
- type: 'number_of_transactions' - number_of_transactions
- type: 'hash_rate' - hash_rate
- type: 'timestamp' - timestamp
- type: 'mined_blocks' - mined_blocks
- type: 'blocks_size' - blocks_size
- type: 'total_fees_btc' - total_fees_btc
- type: 'total_btc_sent' - total_btc_sent
- type: 'estimated_btc_sent' - estimated_btc_sent
- type: 'total_btc' - total_btc
- type: 'total_blocks' - total_blocks
- type: 'next_retarget' - next_retarget
- type: 'estimated_transaction_volume_usd' - estimated_transaction_volume_usd
- type: 'miners_revenue_btc' - miners_revenue_btc
- type: 'market_price_usd' - market_price_usd
Variables: Variables:
@ -62,12 +61,8 @@ display_options
*Required *Required
An array specifying the variables to display. An array specifying the variables to display.
These are the variables for the display_options array.: These are the variables for the display_options array. See the configuration
example above for a list of all available variables.
type
*Required
The variable you wish to display, see the configuration example above for a
list of all available variables.
""" """
import logging import logging
from datetime import timedelta from datetime import timedelta
@ -141,10 +136,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
dev.append(BitcoinSensor('wallet', currency, wallet)) dev.append(BitcoinSensor('wallet', currency, wallet))
for variable in config['display_options']: for variable in config['display_options']:
if variable['type'] not in OPTION_TYPES: if variable not in OPTION_TYPES:
_LOGGER.error('Option type: "%s" does not exist', variable['type']) _LOGGER.error('Option type: "%s" does not exist', variable)
else: else:
dev.append(BitcoinSensor(variable['type'], currency)) print("############ ", variable)
dev.append(BitcoinSensor(variable, currency))
add_devices(dev) add_devices(dev)