diff --git a/custom_components/remote_homeassistant/__init__.py b/custom_components/remote_homeassistant/__init__.py index c2cb955..07bd9b1 100644 --- a/custom_components/remote_homeassistant/__init__.py +++ b/custom_components/remote_homeassistant/__init__.py @@ -40,7 +40,7 @@ CONF_INCLUDE_DOMAINS, CONF_INCLUDE_ENTITIES, CONF_LOAD_COMPONENTS, CONF_OPTIONS, CONF_REMOTE_CONNECTION, CONF_SERVICE_PREFIX, CONF_SERVICES, CONF_UNSUB_LISTENER, - DOMAIN, REMOTE_ID) + DOMAIN, REMOTE_ID, DEFAULT_MAX_MSG_SIZE) from .proxy_services import ProxyServices from .rest_api import UnsupportedVersion, async_get_discovery_info @@ -72,7 +72,7 @@ vol.Optional(CONF_SECURE, default=False): cv.boolean, vol.Optional(CONF_VERIFY_SSL, default=True): cv.boolean, vol.Required(CONF_ACCESS_TOKEN): cv.string, - vol.Optional(CONF_MAX_MSG_SIZE, default=16*1024*1024): vol.Coerce(int), + vol.Optional(CONF_MAX_MSG_SIZE, default=DEFAULT_MAX_MSG_SIZE): vol.Coerce(int), vol.Optional(CONF_EXCLUDE, default={}): vol.Schema( { vol.Optional(CONF_ENTITIES, default=[]): cv.entity_ids, diff --git a/custom_components/remote_homeassistant/config_flow.py b/custom_components/remote_homeassistant/config_flow.py index 474eef6..1d2750a 100644 --- a/custom_components/remote_homeassistant/config_flow.py +++ b/custom_components/remote_homeassistant/config_flow.py @@ -71,7 +71,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): def __init__(self): """Initialize a new ConfigFlow.""" - self.prefill = {CONF_PORT: 8123, CONF_SECURE: True, CONF_MAX_MSG_SIZE: 16*1024*1024} + self.prefill = {CONF_PORT: 8123, CONF_SECURE: True, CONF_MAX_MSG_SIZE: DEFAULT_MAX_MSG_SIZE} @staticmethod @callback diff --git a/custom_components/remote_homeassistant/const.py b/custom_components/remote_homeassistant/const.py index 6fb50a7..618ce7e 100644 --- a/custom_components/remote_homeassistant/const.py +++ b/custom_components/remote_homeassistant/const.py @@ -30,3 +30,5 @@ # replaces 'from homeassistant.core import SERVICE_CALL_LIMIT' SERVICE_CALL_LIMIT = 10 + +DEFAULT_MAX_MSG_SIZE = 16*1024*1024 diff --git a/custom_components/remote_homeassistant/sensor.py b/custom_components/remote_homeassistant/sensor.py index 385c00c..117b396 100644 --- a/custom_components/remote_homeassistant/sensor.py +++ b/custom_components/remote_homeassistant/sensor.py @@ -3,7 +3,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import DeviceInfo, Entity -from .const import DOMAIN, CONF_ENTITY_PREFIX, CONF_SECURE, CONF_MAX_MSG_SIZE +from .const import DOMAIN, CONF_ENTITY_PREFIX, CONF_SECURE, CONF_MAX_MSG_SIZE, DEFAULT_MAX_MSG_SIZE async def async_setup_entry(hass, config_entry, async_add_entities): @@ -44,7 +44,7 @@ def extra_state_attributes(self): "port": self._entry.data[CONF_PORT], "secure": self._entry.data.get(CONF_SECURE, False), "verify_ssl": self._entry.data.get(CONF_VERIFY_SSL, False), - "max_msg_size": self._entry.data[CONF_MAX_MSG_SIZE], + "max_msg_size": self._entry.data.get(CONF_MAX_MSG_SIZE, DEFAULT_MAX_MSG_SIZE), "entity_prefix": self._entry.options.get(CONF_ENTITY_PREFIX, ""), "uuid": self.unique_id, }