Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Commit

Permalink
fixed keyerror for timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
eavanvalkenburg committed May 11, 2021
1 parent 0d68b63 commit eb0fa8f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 3 additions & 2 deletions custom_components/sia/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady

from .const import DOMAIN
from .const import DOMAIN, CONF_IGNORE_TIMESTAMPS
from .hub import SIAHub

PLATFORMS = [ALARM_CONTROL_PANEL_DOMAIN, BINARY_SENSOR_DOMAIN, SENSOR_DOMAIN]
Expand Down Expand Up @@ -66,9 +66,10 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry):
"""Migrate old entry."""
_LOGGER.debug("Migrating from version %s", config_entry.version)

if config_entry.version == 1:
if config_entry.version < 2:
data = config_entry.data.copy()
data[CONF_PROTOCOL] = "TCP"
data[CONF_IGNORE_TIMESTAMPS] = False
config_entry.version = 2
hass.config_entries.async_update_entry(config_entry, data=data)

Expand Down
10 changes: 8 additions & 2 deletions custom_components/sia/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,18 @@ def __init__(
SIAAccount(
a[CONF_ACCOUNT],
a.get(CONF_ENCRYPTION_KEY),
IGNORED_TIMEBAND if a[CONF_IGNORE_TIMESTAMPS] else DEFAULT_TIMEBAND,
IGNORED_TIMEBAND
if a.get(CONF_IGNORE_TIMESTAMPS, False)
else DEFAULT_TIMEBAND,
)
for a in self._accounts
]
self.sia_client = SIAClient(
"", self._port, self.sia_accounts, self.async_create_and_fire_event, CommunicationsProtocol(self._protocol)
"",
self._port,
self.sia_accounts,
self.async_create_and_fire_event,
CommunicationsProtocol(self._protocol),
)

async def async_setup_hub(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/sia/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"codeowners": [
"@eavanvalkenburg"
],
"version": "0.5.0b8",
"version": "0.5.0b9",
"iot_class": "local_push"
}

0 comments on commit eb0fa8f

Please sign in to comment.