core/homeassistant/components/browser.py

23 lines
621 B
Python
Raw Normal View History

"""
2016-02-26 22:52:54 +00:00
Provides functionality to launch a web browser on the host machine.
2015-11-09 12:12:18 +00:00
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/browser/
"""
DOMAIN = "browser"
SERVICE_BROWSE_URL = "browse_url"
def setup(hass, config):
2016-03-08 16:55:57 +00:00
"""Listen for browse_url events."""
import webbrowser
hass.services.register(DOMAIN, SERVICE_BROWSE_URL,
lambda service:
webbrowser.open(
2014-11-08 21:57:08 +00:00
service.data.get(
'url', 'https://www.google.com')))
return True