mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 17:27:19 +00:00
Add docstrings
This commit is contained in:
parent
8683e077fc
commit
7e1c1f0391
@ -31,19 +31,25 @@ from homeassistant.helpers.entity import Entity
|
|||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
"""Setup the sensor platform."""
|
||||||
add_devices([ExampleSensor()])
|
add_devices([ExampleSensor()])
|
||||||
|
|
||||||
|
|
||||||
class ExampleSensor(Entity):
|
class ExampleSensor(Entity):
|
||||||
|
"""Representation of a Sensor."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
"""Return the name of the sensor."""
|
||||||
return 'Example Temperature'
|
return 'Example Temperature'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
|
"""Return the state of the sensor.""
|
||||||
return 23
|
return 23
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unit_of_measurement(self):
|
def unit_of_measurement(self):
|
||||||
|
"""Return the unit of measurement."""
|
||||||
return TEMP_CELSIUS
|
return TEMP_CELSIUS
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user