Skip to content

Commit

Permalink
Fix missing entities (#828)
Browse files Browse the repository at this point in the history
When creating a new integration.
  • Loading branch information
twrecked authored Nov 2, 2023
1 parent 40b7d77 commit 8b96b8a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
aarlo
0.8.1a4
Fix initial options to create devices.
Fix integration naming.
0.8.1a3
Allow pyaarlo config to be passed from `/config/aarlo.yaml`
Bump pyaarlo revision.
Expand Down
2 changes: 1 addition & 1 deletion custom_components/aarlo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from .cfg import BlendedCfg, PyaarloCfg


__version__ = "0.8.1a3"
__version__ = "0.8.1a4"

_LOGGER = logging.getLogger(__name__)

Expand Down
41 changes: 41 additions & 0 deletions custom_components/aarlo/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,43 @@

AARLO_CONFIG_FILE = "/config/aarlo.yaml"

DEFAULT_OPTIONS = {
"alarm_control_panel_disarmed_mode_name": "disarmed",
"alarm_control_panel_home_mode_name": "home",
"alarm_control_panel_away_mode_name": "away",
"alarm_control_panel_night_mode_name": "night",
"alarm_control_panel_code_arm_required": False,
"alarm_control_panel_code_disarm_required": False,
"alarm_control_panel_trigger_time": 60,
"alarm_control_panel_alarm_volume": 3,
"binary_sensor_sound": True,
"binary_sensor_motion": True,
"binary_sensor_ding": True,
"binary_sensor_cry": True,
"binary_sensor_connectivity": True,
"binary_sensor_contact": True,
"binary_sensor_light": True,
"binary_sensor_tamper": True,
"binary_sensor_leak": True,
"sensor_last_capture": True,
"sensor_total_cameras": True,
"sensor_recent_activity": True,
"sensor_captured_today": True,
"sensor_battery_level": True,
"sensor_signal_strength": True,
"sensor_temperature": True,
"sensor_humidity": True,
"sensor_air_quality": True,
"switch_siren": True,
"switch_all_sirens": True,
"switch_siren_allow_off": True,
"switch_siren_volume": 3,
"switch_siren_duration": 10,
"switch_snapshot": True,
"switch_snapshot_timeout": 15,
"switch_doorbell_silence": True
}


def _fix_config(config):
"""Find and return the aarlo entry from any platform config.
Expand Down Expand Up @@ -319,6 +356,10 @@ def _load(self):
def _merge(self, data, options):
"""Rebuild config from flow data and options."""

if not options:
_LOGGER.debug("empty options, using defaults")
options = DEFAULT_OPTIONS

self._main_config = {**data, **self._main_config}
self._alarm_config = ALARM_SCHEMA(_extract_platform_config(options, "alarm_control_panel_"))
self._binary_sensor_config = _extract_monitored_conditions(options, "binary_sensor_")
Expand Down
3 changes: 2 additions & 1 deletion custom_components/aarlo/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
)
from .cfg import UpgradeCfg


_LOGGER = logging.getLogger(__name__)

DEFAULT_IMPORTED_NAME = "imported"
Expand Down Expand Up @@ -123,7 +124,7 @@ async def async_step_user(self, info: dict = None):
if not errors:
_LOGGER.debug(f"aarlo-config={config}")
return self.async_create_entry(
title=f"Aarlo for ${self._username}",
title=f"Aarlo for {info[CONF_USERNAME]}",
data=config
)

Expand Down
2 changes: 1 addition & 1 deletion custom_components/aarlo/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"unidecode",
"pyaarlo>=0.8.0.1"
],
"version": "0.8.1a3"
"version": "0.8.1a4"
}

0 comments on commit 8b96b8a

Please sign in to comment.