Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#341)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.1 → v0.1.13](astral-sh/ruff-pre-commit@v0.1.1...v0.1.13)
- [github.com/psf/black: 23.10.0 → 23.12.1](psf/black@23.10.0...23.12.1)
- [github.com/pre-commit/mirrors-prettier: v3.0.3 → v4.0.0-alpha.8](pre-commit/mirrors-prettier@v3.0.3...v4.0.0-alpha.8)
- [github.com/pre-commit/mirrors-mypy: v1.6.1 → v1.8.0](pre-commit/mirrors-mypy@v1.6.1...v1.8.0)
- [github.com/adrienverge/yamllint.git: v1.32.0 → v1.33.0](https://github.com/adrienverge/yamllint.git/compare/v1.32.0...v1.33.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Jan 21, 2024
1 parent 7ba675f commit bb9942f
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 80 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ default_language_version:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.1
rev: v0.1.13
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 23.10.0
rev: 23.12.1
hooks:
- id: black
args:
Expand All @@ -24,17 +24,17 @@ repos:
- --quiet-level=2
exclude_types: [csv, json]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v4.0.0-alpha.8
hooks:
- id: prettier
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
rev: v1.8.0
hooks:
- id: mypy
additional_dependencies: [types-all]
args: [--config-file=pyproject.toml]
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.32.0
rev: v1.33.0
hooks:
- id: yamllint
exclude: (.vscode|.devcontainer|.github)
Expand Down
6 changes: 5 additions & 1 deletion custom_components/alarmdotcom/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ def state(self) -> str | None:
match self._device.desired_state:
case libPartition.DeviceState.DISARMED:
return str(STATE_ALARM_DISARMING)
case libPartition.DeviceState.ARMED_STAY | libPartition.DeviceState.ARMED_AWAY | libPartition.DeviceState.ARMED_NIGHT:
case (
libPartition.DeviceState.ARMED_STAY
| libPartition.DeviceState.ARMED_AWAY
| libPartition.DeviceState.ARMED_NIGHT
):
return str(STATE_ALARM_ARMING)

LOGGER.error(
Expand Down
14 changes: 6 additions & 8 deletions custom_components/alarmdotcom/base_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,12 @@ def __init__(

self._attr_extra_state_attributes: MutableMapping[str, Any] = {}

self._attr_device_info = DeviceInfo(
{
"manufacturer": "Alarm.com",
"name": device.name,
"identifiers": {(DOMAIN, self._adc_id)},
"via_device": (DOMAIN, self._device.partition_id),
}
)
self._attr_device_info = DeviceInfo({
"manufacturer": "Alarm.com",
"name": device.name,
"identifiers": {(DOMAIN, self._adc_id)},
"via_device": (DOMAIN, self._device.partition_id),
})

@property
def device_type_name(self) -> str:
Expand Down
114 changes: 52 additions & 62 deletions custom_components/alarmdotcom/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,14 @@ async def async_step_user(self, user_input: dict[str, Any] | None = None) -> Flo
else:
return await self.async_step_final()

creds_schema = vol.Schema(
{
vol.Required(CONF_USERNAME): TextSelector(
TextSelectorConfig(type=TextSelectorType.TEXT, autocomplete="username")
),
vol.Required(CONF_PASSWORD): TextSelector(
TextSelectorConfig(type=TextSelectorType.PASSWORD, autocomplete="current-password")
),
}
)
creds_schema = vol.Schema({
vol.Required(CONF_USERNAME): TextSelector(
TextSelectorConfig(type=TextSelectorType.TEXT, autocomplete="username")
),
vol.Required(CONF_PASSWORD): TextSelector(
TextSelectorConfig(type=TextSelectorType.PASSWORD, autocomplete="current-password")
),
})

return self.async_show_form(step_id="user", data_schema=creds_schema, errors=errors, last_step=False)

Expand Down Expand Up @@ -176,17 +174,15 @@ async def async_step_otp_select_method(self, user_input: dict[str, Any] | None =
)
errors["base"] = "cannot_connect"

otp_method_schema = vol.Schema(
{
vol.Required(CONF_OTP_METHOD, default=self._enabled_otp_methods[0].name): SelectSelector(
SelectSelectorConfig(
options=[otp_type.name for otp_type in self._enabled_otp_methods],
mode=SelectSelectorMode.DROPDOWN,
translation_key=CONF_OTP_METHODS_LIST,
)
),
}
)
otp_method_schema = vol.Schema({
vol.Required(CONF_OTP_METHOD, default=self._enabled_otp_methods[0].name): SelectSelector(
SelectSelectorConfig(
options=[otp_type.name for otp_type in self._enabled_otp_methods],
mode=SelectSelectorMode.DROPDOWN,
translation_key=CONF_OTP_METHODS_LIST,
)
),
})

return self.async_show_form(
step_id="otp_select_method", data_schema=otp_method_schema, errors=errors, last_step=False
Expand Down Expand Up @@ -229,13 +225,11 @@ async def async_step_otp_submit(self, user_input: dict[str, Any] | None = None)
else:
return await self.async_step_final()

creds_schema = vol.Schema(
{
vol.Required(CONF_OTP): TextSelector(
TextSelectorConfig(type=TextSelectorType.TEXT, autocomplete="one-time-code")
),
}
)
creds_schema = vol.Schema({
vol.Required(CONF_OTP): TextSelector(
TextSelectorConfig(type=TextSelectorType.TEXT, autocomplete="one-time-code")
),
})

return self.async_show_form(step_id="otp_submit", data_schema=creds_schema, errors=errors, last_step=True)

Expand Down Expand Up @@ -296,25 +290,23 @@ async def async_step_init(self, user_input: dict[str, Any] | None = None) -> Flo
self.options.update(user_input)
return await self.async_step_modes()

schema = vol.Schema(
{
vol.Optional(
CONF_ARM_CODE,
default=("" if not (arm_code_raw := self.options.get(CONF_ARM_CODE)) else arm_code_raw),
): selector.selector({"text": {"type": "password"}}),
vol.Required(
CONF_UPDATE_INTERVAL,
default=self.options.get(CONF_UPDATE_INTERVAL, CONF_DEFAULT_UPDATE_INTERVAL_SECONDS),
): selector.selector(
{
"number": {
"mode": "box",
CONF_UNIT_OF_MEASUREMENT: "seconds",
}
schema = vol.Schema({
vol.Optional(
CONF_ARM_CODE,
default=("" if not (arm_code_raw := self.options.get(CONF_ARM_CODE)) else arm_code_raw),
): selector.selector({"text": {"type": "password"}}),
vol.Required(
CONF_UPDATE_INTERVAL,
default=self.options.get(CONF_UPDATE_INTERVAL, CONF_DEFAULT_UPDATE_INTERVAL_SECONDS),
): selector.selector(
{
"number": {
"mode": "box",
CONF_UNIT_OF_MEASUREMENT: "seconds",
}
),
}
)
}
),
})

return self.async_show_form(
step_id="init",
Expand All @@ -331,22 +323,20 @@ async def async_step_modes(self, user_input: dict[str, Any] | None = None) -> Fl
self.options.update(user_input)
return self.async_create_entry(title="", data=self.options)

schema = vol.Schema(
{
vol.Required(
CONF_ARM_HOME,
default=self.options.get(CONF_ARM_HOME, CONF_OPTIONS_DEFAULT[CONF_ARM_HOME]),
): cv.multi_select(CONF_ARM_MODE_OPTIONS),
vol.Required(
CONF_ARM_AWAY,
default=self.options.get(CONF_ARM_AWAY, CONF_OPTIONS_DEFAULT[CONF_ARM_AWAY]),
): cv.multi_select(CONF_ARM_MODE_OPTIONS),
vol.Required(
CONF_ARM_NIGHT,
default=self.options.get(CONF_ARM_NIGHT, CONF_OPTIONS_DEFAULT[CONF_ARM_NIGHT]),
): cv.multi_select(CONF_ARM_MODE_OPTIONS),
}
)
schema = vol.Schema({
vol.Required(
CONF_ARM_HOME,
default=self.options.get(CONF_ARM_HOME, CONF_OPTIONS_DEFAULT[CONF_ARM_HOME]),
): cv.multi_select(CONF_ARM_MODE_OPTIONS),
vol.Required(
CONF_ARM_AWAY,
default=self.options.get(CONF_ARM_AWAY, CONF_OPTIONS_DEFAULT[CONF_ARM_AWAY]),
): cv.multi_select(CONF_ARM_MODE_OPTIONS),
vol.Required(
CONF_ARM_NIGHT,
default=self.options.get(CONF_ARM_NIGHT, CONF_OPTIONS_DEFAULT[CONF_ARM_NIGHT]),
): cv.multi_select(CONF_ARM_MODE_OPTIONS),
})

return self.async_show_form(
step_id="modes",
Expand Down
5 changes: 1 addition & 4 deletions custom_components/alarmdotcom/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"integration_type": "hub",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/pyalarmdotcom/alarmdotcom/issues",
"requirements": [
"beautifulsoup4>=4.10.0",
"pyalarmdotcomajax==0.5.10"
],
"requirements": ["beautifulsoup4>=4.10.0", "pyalarmdotcomajax==0.5.10"],
"version": "3.0.10"
}

0 comments on commit bb9942f

Please sign in to comment.