forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom panel example using React (home-assistant#2651)
- Loading branch information
Showing
10 changed files
with
471 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.