Skip to content

Commit

Permalink
Fix mandatory entry data/options
Browse files Browse the repository at this point in the history
  • Loading branch information
gjohansson-ST committed Nov 13, 2024
1 parent 805e67c commit de3115b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion custom_components/sector/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,5 @@ async def async_alarm_disarm(self, code: str | None = None) -> None:
await self.coordinator.async_request_refresh()

def _is_valid_code(self, code: str) -> bool:
code_format = self.coordinator.config_entry.options.get(CONF_CODE_FORMAT, 6)
code_format = self.coordinator.config_entry.options[CONF_CODE_FORMAT]
return bool(code and len(code) == code_format)
3 changes: 2 additions & 1 deletion custom_components/sector/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import CONF_PANEL_ID
from .coordinator import SectorAlarmConfigEntry, SectorDataUpdateCoordinator
from .entity import SectorAlarmBaseEntity

Expand Down Expand Up @@ -63,7 +64,7 @@ async def async_setup_entry(
] = []

panel_status = coordinator.data.get("panel_status", {})
panel_id = entry.data.get("panel_id")
panel_id = entry.data[CONF_PANEL_ID]
serial_no = panel_status.get("SerialNo") or panel_id

for device in devices.values():
Expand Down
2 changes: 1 addition & 1 deletion custom_components/sector/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async def async_setup_entry(
) -> None:
"""Set up Sector Alarm locks."""
coordinator = entry.runtime_data
code_format = entry.options.get(CONF_CODE_FORMAT, 6)
code_format = entry.options[CONF_CODE_FORMAT]
devices: dict[str, dict[str, Any]] = coordinator.data.get("devices", {})
entities = []

Expand Down

0 comments on commit de3115b

Please sign in to comment.