Skip to content

Commit 4018458

Browse files
Provide default value for max message size
1 parent dbec885 commit 4018458

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

custom_components/remote_homeassistant/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
CONF_INCLUDE_DOMAINS, CONF_INCLUDE_ENTITIES,
4141
CONF_LOAD_COMPONENTS, CONF_OPTIONS, CONF_REMOTE_CONNECTION,
4242
CONF_SERVICE_PREFIX, CONF_SERVICES, CONF_UNSUB_LISTENER,
43-
DOMAIN, REMOTE_ID)
43+
DOMAIN, REMOTE_ID, DEFAULT_MAX_MSG_SIZE)
4444
from .proxy_services import ProxyServices
4545
from .rest_api import UnsupportedVersion, async_get_discovery_info
4646

@@ -72,7 +72,7 @@
7272
vol.Optional(CONF_SECURE, default=False): cv.boolean,
7373
vol.Optional(CONF_VERIFY_SSL, default=True): cv.boolean,
7474
vol.Required(CONF_ACCESS_TOKEN): cv.string,
75-
vol.Optional(CONF_MAX_MSG_SIZE, default=16*1024*1024): vol.Coerce(int),
75+
vol.Optional(CONF_MAX_MSG_SIZE, default=DEFAULT_MAX_MSG_SIZE): vol.Coerce(int),
7676
vol.Optional(CONF_EXCLUDE, default={}): vol.Schema(
7777
{
7878
vol.Optional(CONF_ENTITIES, default=[]): cv.entity_ids,

custom_components/remote_homeassistant/config_flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
7171

7272
def __init__(self):
7373
"""Initialize a new ConfigFlow."""
74-
self.prefill = {CONF_PORT: 8123, CONF_SECURE: True, CONF_MAX_MSG_SIZE: 16*1024*1024}
74+
self.prefill = {CONF_PORT: 8123, CONF_SECURE: True, CONF_MAX_MSG_SIZE: DEFAULT_MAX_MSG_SIZE}
7575

7676
@staticmethod
7777
@callback

custom_components/remote_homeassistant/const.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@
3030

3131
# replaces 'from homeassistant.core import SERVICE_CALL_LIMIT'
3232
SERVICE_CALL_LIMIT = 10
33+
34+
DEFAULT_MAX_MSG_SIZE = 16*1024*1024

custom_components/remote_homeassistant/sensor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from homeassistant.helpers.dispatcher import async_dispatcher_connect
44
from homeassistant.helpers.entity import DeviceInfo, Entity
55

6-
from .const import DOMAIN, CONF_ENTITY_PREFIX, CONF_SECURE, CONF_MAX_MSG_SIZE
6+
from .const import DOMAIN, CONF_ENTITY_PREFIX, CONF_SECURE, CONF_MAX_MSG_SIZE, DEFAULT_MAX_MSG_SIZE
77

88

99
async def async_setup_entry(hass, config_entry, async_add_entities):
@@ -44,7 +44,7 @@ def extra_state_attributes(self):
4444
"port": self._entry.data[CONF_PORT],
4545
"secure": self._entry.data.get(CONF_SECURE, False),
4646
"verify_ssl": self._entry.data.get(CONF_VERIFY_SSL, False),
47-
"max_msg_size": self._entry.data[CONF_MAX_MSG_SIZE],
47+
"max_msg_size": self._entry.data.get(CONF_MAX_MSG_SIZE, DEFAULT_MAX_MSG_SIZE),
4848
"entity_prefix": self._entry.options.get(CONF_ENTITY_PREFIX, ""),
4949
"uuid": self.unique_id,
5050
}

0 commit comments

Comments
 (0)