23 lines
481 B
Python
23 lines
481 B
Python
"""
|
|
homeassistant.components.browser
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Provides functionality to launch a webbrowser on the host machine.
|
|
"""
|
|
|
|
DOMAIN = "browser"
|
|
|
|
SERVICE_BROWSE_URL = "browse_url"
|
|
|
|
|
|
def setup(bus):
|
|
""" Listen for browse_url events and open
|
|
the url in the default webbrowser. """
|
|
|
|
import webbrowser
|
|
|
|
bus.register_service(DOMAIN, SERVICE_BROWSE_URL,
|
|
lambda service: webbrowser.open(service.data['url']))
|
|
|
|
return True
|