The `Config` object specific to the `google_assistant` component had a default value for `allow_unlock`. We were not overriding this default when constructing the Config object during `google_assistant` component setup, whereas we do when setting up the `cloud` component. To fix, we thread the `allow_unlock` parameter down through http setup, and ensure that it's set correctly. Moreover, we also change the ordering of the `Config` parameters, and remove the default. Future refactoring should not miss it, as it is now a required parameter.
25 lines
739 B
Python
25 lines
739 B
Python
"""Helper classes for Google Assistant integration."""
|
|
|
|
|
|
class SmartHomeError(Exception):
|
|
"""Google Assistant Smart Home errors.
|
|
|
|
https://developers.google.com/actions/smarthome/create-app#error_responses
|
|
"""
|
|
|
|
def __init__(self, code, msg):
|
|
"""Log error code."""
|
|
super().__init__(msg)
|
|
self.code = code
|
|
|
|
|
|
class Config:
|
|
"""Hold the configuration for Google Assistant."""
|
|
|
|
def __init__(self, should_expose, allow_unlock, agent_user_id,
|
|
entity_config=None):
|
|
"""Initialize the configuration."""
|
|
self.should_expose = should_expose
|
|
self.agent_user_id = agent_user_id
|
|
self.entity_config = entity_config or {}
|
|
self.allow_unlock = allow_unlock
|