mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 07:17:14 +00:00
Minor updates
This commit is contained in:
parent
676f426a53
commit
3bef0ad30f
@ -63,13 +63,14 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
# Verify that passed in configuration works
|
# Verify that passed in configuration works
|
||||||
if not hub.is_valid_login():
|
if not hub.is_valid_login():
|
||||||
_LOGGER.error('Could not connect to AwesomeLight hub')
|
_LOGGER.error("Could not connect to AwesomeLight hub")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Add devices
|
# Add devices
|
||||||
add_devices(AwesomeLight(light) for light in hub.lights())
|
add_devices(AwesomeLight(light) for light in hub.lights())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AwesomeLight(Light):
|
class AwesomeLight(Light):
|
||||||
"""Representation of an Awesome Light."""
|
"""Representation of an Awesome Light."""
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ class AwesomeLight(Light):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def brightness(self):
|
def brightness(self):
|
||||||
"""Brightness of the light (an integer in the range 1-255).
|
"""Return the brightness of the light.
|
||||||
|
|
||||||
This method is optional. Removing it indicates to Home Assistant
|
This method is optional. Removing it indicates to Home Assistant
|
||||||
that brightness is not supported for this light.
|
that brightness is not supported for this light.
|
||||||
|
@ -15,7 +15,7 @@ This is a minimum implementation of a platform for the sensor component.
|
|||||||
|
|
||||||
Copy the code below and create it as a file in `<config_dir>/custom_components/sensor/example.py`.
|
Copy the code below and create it as a file in `<config_dir>/custom_components/sensor/example.py`.
|
||||||
|
|
||||||
Add the following to your configuration.yaml:
|
Add the following to your `configuration.yaml` file:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
|
Loading…
x
Reference in New Issue
Block a user