mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-08-11 10:19:41 +00:00
.github
.themes
_deploy
plugins
sass
source
_components
_cookbook
_details
_ecosystem
_includes
_layouts
_posts
_topics
assets
blog
components
cookbook
demo
details
developers
add_new_platform.markdown
architecture.markdown
architecture_components.markdown
asyncio.markdown
asyncio_categorizing_functions.markdown
asyncio_misc.markdown
asyncio_working_with_async.markdown
component_deps_and_reqs.markdown
component_discovery.markdown
component_events.markdown
component_generic_discovery.markdown
component_initialization.markdown
component_loading.markdown
component_states.markdown
component_visibility.markdown
creating_components.markdown
credits.markdown
development.markdown
development_catching_up.markdown
development_checklist.markdown
development_environment.markdown
development_submitting.markdown
development_testing.markdown
development_validation.markdown
frontend.markdown
frontend_add_card.markdown
frontend_add_more_info.markdown
frontend_creating_custom_panels.markdown
helpers.markdown
index.markdown
maintenance.markdown
multiple_instances.markdown
platform_example_light.markdown
platform_example_sensor.markdown
python_api.markdown
releasing.markdown
rest_api.markdown
server_sent_events.markdown
website.markdown
websocket_api.markdown
ecosystem
font
getting-started
help
images
javascripts
static
topics
CNAME
atom.xml
favicon.png
googlef4f3693c209fe788.html
index.html
robots.txt
service_worker.js
version.json
.editorconfig
.gitattributes
.gitignore
.gitmodules
.powrc
.ruby-version
.slugignore
.travis.yml
Gemfile
Gemfile.lock
README.markdown
Rakefile
_config.yml
config.rb
config.ru
28 lines
799 B
Markdown
28 lines
799 B
Markdown
---
|
|
layout: page
|
|
title: "Creating components"
|
|
description: "Guidelines to get you create your first component for Home Assistant."
|
|
date: 2014-12-21 13:32
|
|
sidebar: true
|
|
comments: false
|
|
sharing: true
|
|
footer: true
|
|
---
|
|
|
|
Alright, you're ready to make your first component. AWESOME. Don't worry, we've tried hard to keep it as easy as possible.
|
|
|
|
### {% linkable_title Example component %}
|
|
|
|
Add `hello_state:` to your `configuration.yaml` file and create a file `<config_dir>/custom_components/hello_state.py` with the below code to test it locally.
|
|
|
|
```python
|
|
DOMAIN = 'hello_state'
|
|
|
|
def setup(hass, config):
|
|
hass.states.set('hello.world', 'Paulus')
|
|
|
|
return True
|
|
```
|
|
|
|
For more examples, see the [Custom Python Component Examples](/cookbook/#custom-python-component-examples) on our examples page.
|