Extract developer site (#5249)

* Extract developer site

* Fix title in sidebar

* Update dev section reference

* Update edit in github link on help page
This commit is contained in:
Paulus Schoutsen 2018-04-26 11:14:55 -04:00 committed by GitHub
parent a83fd1d874
commit 80b268cd65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
75 changed files with 282 additions and 4166 deletions

View file

@ -9,58 +9,6 @@ sharing: true
footer: true
---
This is a minimum implementation of a platform for the sensor component.
### {% linkable_title Installation %}
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` file:
```yaml
# Example configuration.yaml entry
sensor:
platform: example
```
### {% linkable_title Code %}
```python
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the sensor platform."""
add_devices([ExampleSensor()])
class ExampleSensor(Entity):
"""Representation of a Sensor."""
def __init__(self):
"""Initialize the sensor."""
self._state = None
@property
def name(self):
"""Return the name of the sensor."""
return 'Example Temperature'
@property
def state(self):
"""Return the state of the sensor."""
return self._state
@property
def unit_of_measurement(self):
"""Return the unit of measurement."""
return TEMP_CELSIUS
def update(self):
"""Fetch new state data for the sensor.
This is the only method that should fetch new data for Home Assistant.
"""
self._state = 23
```
<script>
window.location = 'https://developers.home-assistant.io/docs/en/creating_platform_example_sensor.html';
</script>