mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
use a list and update docs
This commit is contained in:
parent
c800508f87
commit
4221eef428
@ -12,24 +12,18 @@ following to your config/configuration.yaml
|
|||||||
sensor:
|
sensor:
|
||||||
platform: time_date
|
platform: time_date
|
||||||
display_options:
|
display_options:
|
||||||
- type: 'time'
|
- 'time'
|
||||||
- type: 'date'
|
- 'date'
|
||||||
- type: 'date_time'
|
- 'date_time'
|
||||||
- type: 'time_date'
|
- 'time_date'
|
||||||
- type: 'time_utc'
|
- 'time_utc'
|
||||||
- type: 'beat'
|
- 'beat'
|
||||||
|
|
||||||
Variables:
|
Variables:
|
||||||
|
|
||||||
display_options
|
display_options
|
||||||
*Required
|
*Required
|
||||||
An array specifying the variables to display.
|
The variable you wish to display. See the configuration example above for a
|
||||||
|
|
||||||
These are the variables for the display_options array.:
|
|
||||||
|
|
||||||
type
|
|
||||||
*Required
|
|
||||||
The variable you wish to display, see the configuration example above for a
|
|
||||||
list of all available variables.
|
list of all available variables.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
@ -57,10 +51,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
dev = []
|
dev = []
|
||||||
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(TimeDateSensor(variable['type']))
|
dev.append(TimeDateSensor(variable))
|
||||||
|
|
||||||
add_devices(dev)
|
add_devices(dev)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user