Skip to content

Commit

Permalink
Add custom panel example using React (home-assistant#2651)
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob authored Jul 29, 2016
1 parent 3c51d2d commit 55624bc
Show file tree
Hide file tree
Showing 10 changed files with 471 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ config/custom_components/*
!config/custom_components/example.py
!config/custom_components/hello_world.py
!config/custom_components/mqtt_example.py
!config/custom_components/react_panel

tests/testing_config/deps
tests/testing_config/home-assistant.log
Expand Down
30 changes: 30 additions & 0 deletions config/custom_components/react_panel/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""
Custom panel example showing TodoMVC using React.
Will add a panel to control lights and switches using React. Allows configuring
the title via configuration.yaml:
react_panel:
title: 'home'
"""
import os

from homeassistant.components.frontend import register_panel

DOMAIN = 'react_panel'
DEPENDENCIES = ['frontend']

PANEL_PATH = os.path.join(os.path.dirname(__file__), 'panel.html')


def setup(hass, config):
"""Initialize custom panel."""
title = config.get(DOMAIN, {}).get('title')

config = None if title is None else {'title': title}

register_panel(hass, 'react', PANEL_PATH,
title='TodoMVC', icon='mdi:checkbox-marked-outline',
config=config)
return True
Loading

0 comments on commit 55624bc

Please sign in to comment.