Commit Graph

49 Commits (0c3489c1b3a15f2e12aa8e18280652a8e3f1e623)

Author SHA1 Message Date
G Johansson cdfec7ebb4
Implement new state property for alarm_control_panel which is using an enum (#126283)
* Alarm state from enum

* Fixes

* Set final

* Fix rebase

* Test const

* Fix breaking version

* Fix other for alarm_control_panel

* Fix integrations

* More

* More

* More

* More

* Fix zha

* Replace _attr_state

* Fix alarm_control_panel

* Fix tests

* Fixes

* Mods

* Change some

* More

* More

* More

* Tests

* Last tests

* Return enum

* Fix zha

* Remove not needed check

* Fix wording

* Fix homekit

* Mod prometheus

* Fix mypy

* Fix homekit

* Fix ifttt
2024-10-21 22:54:27 +02:00
Austin Mroczek af03003305
Improve TotalConnect translations (#125978)
* improve translations

* remove periods from tests

* simplify message strings

* use a comma
2024-09-16 12:17:17 +02:00
Austin Mroczek ad467029c7
Use Freezer for tests in TotalConnect (#125960)
use Freezer for tests in TotalConnect
2024-09-14 23:46:21 +02:00
Austin Mroczek 0c1a605693
Add TotalConnect option to require alarm code (#122270)
* add config option

* use code_required option in alarm

* test code_required options

* only use code for disarm

* change tests to disarm with code

* remove unneeded code variable

* Update homeassistant/components/totalconnect/alarm_control_panel.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* use ServiceValidationError

* translate ServiceValidationError

* complete typing

* Update tests/components/totalconnect/test_alarm_control_panel.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* use ServiceValidationError in test

* grab usercode from correct spot

* use client code instead of unfilled location code

* Revert "remove unneeded code variable"

This reverts commit 220de0e698e5779fcd7c45bee999a60ad186ab7f.

* remove unneeded code variable

* improve usercode checking

* use freezer

* fix usercode test data

* Update homeassistant/components/totalconnect/strings.json

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* Update homeassistant/components/totalconnect/strings.json

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* update test with new message

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
2024-09-11 18:23:19 +02:00
epenet f9928a5843
Fix location_id datatype in totalconnect tests (#125298)
Adjust location_id type in totalconnect tests
2024-09-06 15:19:54 +02:00
epenet 7652c35ee6
Use start_reauth helper method in integration tests (t) (#124794) 2024-08-28 16:47:10 +02:00
epenet 3dc83ef19d
Add missing hass type hint in component tests (t) (#124274) 2024-08-20 12:55:39 +02:00
Austin Mroczek 53870617e8
Add binary sensors to TotalConnect (#121888)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2024-07-19 09:35:54 +02:00
Sid 721b2c2ca8
Enable Ruff PT012 (#113957) 2024-06-08 17:59:08 +02:00
G Johansson 6b7ff2bf44
Add default code to alarm_control_panel (#112540) 2024-05-29 10:46:53 +02:00
Maciej Bieniek 3498cb3ced
Increase test coverage for Total Connect (#116851)
Increase test coverage

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-05-05 15:37:24 +02:00
Joost Lekkerkerker 7d5aa03bf0
Move Totalconnect coordinator to separate module (#116368)
* Move Totalconnect coordinator to separate module

* Move Totalconnect coordinator to separate module

* Move Totalconnect coordinator to separate module
2024-05-05 13:05:36 +02:00
Austin Mroczek 8153ff78bf
Add Button for TotalConnect (#114530)
* add button for totalconnect

* test button for totalconnect

* change to zone.can_be_bypassed

* Update homeassistant/components/totalconnect/button.py

Co-authored-by: Jan-Philipp Benecke <github@bnck.me>

* Update homeassistant/components/totalconnect/button.py

Co-authored-by: Jan-Philipp Benecke <github@bnck.me>

* Update homeassistant/components/totalconnect/button.py

Co-authored-by: Jan-Philipp Benecke <github@bnck.me>

* remove unused logging

* Update homeassistant/components/totalconnect/button.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Update homeassistant/components/totalconnect/button.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* fix button and test

* Revert "bump total_connect_client to 2023.12.1"

This reverts commit 189b7dcd89cf3cc8309dacc92ba47927cfbbdef3.

* bump total_connect_client to 2023.12.1

* use ZoneEntity for Bypass button

* use LocationEntity for PanelButton

* fix typing

* add translation_key for panel buttons

* mock clear_bypass instead of disarm

* use paramaterize

* use snapshot

* sentence case in strings

* remove un-needed stuff

* Update homeassistant/components/totalconnect/button.py

* Apply suggestions from code review

* Fix

---------

Co-authored-by: Jan-Philipp Benecke <github@bnck.me>
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-04-29 09:47:05 +02:00
Joost Lekkerkerker b5bd25d4fb
Add entity translations to totalconnect (#115950) 2024-04-23 21:54:13 +02:00
Joost Lekkerkerker 693bd08a0b
Add snapshot tests to Totalconnect (#115952)
* Add snapshot tests to Totalconnect

* Add snapshot tests to Totalconnect
2024-04-22 13:01:31 +02:00
Joost Lekkerkerker ee66f6ec8c
Use is in enum comparison in config flow tests P-T (#114675) 2024-04-02 11:21:50 -10:00
J. Nick Koston 9a79320861
Mark executor jobs as background unless created from a tracked task (#114450)
* Mark executor jobs as background unless created from a tracked task

If the current task is not tracked the executor job should not
be a background task to avoid delaying startup and shutdown.

Currently any executor job created in a untracked task or
background task would end up being tracked and delaying
startup/shutdown

* import exec has the same issue

* Avoid tracking import executor jobs

There is no reason to track these jobs as they are always awaited
and we do not want to support fire and forget import executor jobs

* fix xiaomi_miio

* lots of fire time changed without background await

* revert changes moved to other PR

* more

* more

* more

* m

* m

* p

* fix fire and forget tests

* scrape

* sonos

* system

* more

* capture callback before block

* coverage

* more

* more races

* more races

* more

* missed some

* more fixes

* missed some more

* fix

* remove unneeded

* one more race

* two
2024-03-30 00:16:53 -04:00
Joost Lekkerkerker 6bb4e7d62c
Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Marc Mueller 87165c0d6e
Add empty line after module docstring [tests t-z] (#112712) 2024-03-08 14:44:56 +01:00
J. Nick Koston 3a06659120
Speed up single entity/response service calls (#96729)
* Significantly speed up single entity/response service calls

Since the majority of service calls are single entity, we can
avoid creating tasks in this case. Since the multi-entity
service calls always check the result and raise, we can switch
the asyncio.wait to asyncio.gather

* Significantly speed up single entity/response service calls

Since the majority of service calls are single entity, we can
avoid creating tasks in this case. Since the multi-entity
service calls always check the result and raise, we can switch
the asyncio.wait to asyncio.gather

* revert

* cannot be inside pytest.raises

* one more

* Update homeassistant/helpers/service.py
2023-07-17 09:33:13 +02:00
Austin Mroczek 252c0e8ad9
Fix Totalconnect BinarySensorDeviceClass logic (#94772)
* handle temperature

* test for temperature

* test for unknown
2023-06-20 22:12:11 +02:00
Ville Skyttä 1ce74ba25c
Import `util.dt` as `dt_util` in `components/[t-z]*` (#93763) 2023-05-29 23:00:43 +02:00
Austin Mroczek 16c915864b
Add diagnostic sensors for TotalConnect (#73152)
* add diagnostic sensors

* test binary_sensor.py file

* add tests for binary sensor

* fix zone type checks and error on unknown

* improve entity tests

* hide entities by default

* Revert "hide entities by default"

This reverts commit 9808d732471385e45ccc5f7c3aea93bfecbdfa6f.

* Update homeassistant/components/totalconnect/binary_sensor.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* update binary_sensor per comments

* update test

* move to _attr_extra_state_attributes

* no spaces in unique_id

* update per balloob suggestions

* fix typing

* fix black and mypy

* Apply suggestions from code review

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* add more to binary_sensor tests

* remove unused import

---------

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
2023-05-07 10:27:33 +02:00
epenet 9a5f88f55f
Add type hints to integration tests (part 23) (#88235) 2023-02-17 16:40:46 +01:00
epenet 278050a73f
Add type hints to integration tests (t-z) (#87707) 2023-02-08 19:10:53 +01:00
Franck Nijhof 5e81d28116
Update black to 23.1.0 (#87188) 2023-02-02 18:35:24 +01:00
J. Nick Koston 7bd56ad7d6
Migrate totalconnect to use async_forward_entry_setups (#86580)
* Migrate totalconnect to use async_forward_entry_setups

Replaces deprecated async_setup_platforms with async_forward_entry_setups

* fix double update and tests
2023-01-25 10:26:49 +01:00
Franck Nijhof 7cd68381f1
Search/replace RESULT_TYPE_* by FlowResultType enum (#74642) 2022-07-07 19:57:36 +03:00
Austin Mroczek 5b896b315e
Add TotalConnect options flow to auto-bypass low battery (#62458)
* rebase

* use bypass option in async_setup_entry

* add test for options flow

* default to False for AUTO_BYPASS

* fix bypass defaults
2022-05-25 10:49:53 +02:00
Franck Nijhof 69cc6ab5f1
Clean up accessing entity_registry.async_get_registry helper via hass (#72005) 2022-05-17 16:40:45 +02:00
Austin Mroczek 3d2f4e31af
Add diagnostics for TotalConnect (#71506) 2022-05-14 21:06:05 -05:00
Austin Mroczek e5fe18bdb1
Improve totalconnect error handling (#68716) 2022-04-03 07:12:33 -06:00
Austin Mroczek 3198211a7f
Add instant arming for totalconnect (#60156)
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-12-11 15:58:12 -10:00
Austin Mroczek 49c4886f40
Fix totalconnect config flow (#59461)
* update total_connect_client to 2021.10

* update for total_connect_client changes

* remove unused return value

* bump total_connect_client to 2021.11.1

* bump total_connect_client to 2021.11.2

* Move to public ResultCode

* load locations to prevent 'unknown error occurred'

* add test for zero locations

* put error message in strings

* test for abort and message from strings

* handle AuthenticationError in step_user

* update tests with exceptions

* update reauth with exceptions

* use try except else per suggestion

* only create schema if necessary

* catch auth error in async_setup_entry

* one more fix in test_init
2021-11-15 11:32:35 -06:00
Austin Mroczek 72aaeda8a0
Bump total_connect_client to 2021.11.2 (#58818)
* update total_connect_client to 2021.10

* update for total_connect_client changes

* remove unused return value

* bump total_connect_client to 2021.11.1

* bump total_connect_client to 2021.11.2

* Move to public ResultCode

* load locations to prevent 'unknown error occurred'

* add test for zero locations

* Revert "load locations to prevent 'unknown error occurred'"

This reverts commit 28b8984be5.

* Revert "add test for zero locations"

This reverts commit 77bf7908d5.
2021-11-07 15:30:34 -08:00
Austin Mroczek baaaf3d2bc
Add multi-partition support for TotalConnect (#55429) 2021-10-27 12:15:13 -05:00
jjlawren e08de22737
Fix totalconnect test calling public host (#51138) 2021-05-27 21:30:37 -05:00
Austin Mroczek 22dd7df66c
Improve totalconnect config flow user experience (#47926) 2021-05-26 09:48:44 -07:00
Ville Skyttä 19d25cd901
Change config entry state to an enum (#49654)
* Change config entry state to an enum

* Allow but deprecate EntryState str equality comparison

* Test fixes

* Rename to ConfigEntryState

* Remove str comparability backcompat

* Update new occurrences of strs cropped up during review
2021-05-20 19:19:20 +02:00
Austin Mroczek a9c73ac264
Fix armed_night logic in totalconnect alarm and add tests (#50694)
* Fix armed_night, add tests for alarm

* end assertions with expected values
2021-05-17 13:18:50 +02:00
Austin Mroczek f8d82bbf80
Add unique_id to TotalConnect alarm_control_panel (#49961)
* add unique_id to alarm_control_panel

* Update homeassistant/components/totalconnect/alarm_control_panel.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-05-03 11:38:59 +02:00
Ville Skyttä 153d6e891e
Use config_entries.SOURCE_* constants (#49631) 2021-04-25 11:27:40 +02:00
Franck Nijhof 5a2b5fe7c5
Yoda assertion style removed is (#48142) 2021-03-20 13:55:10 +01:00
Austin Mroczek e5aef45bd7
Add usercode support to totalconnect (#39199)
* Add test for invalid usercode

* Add usercodes to totalconnect.

* Update existing tests for usercodes

* Fix tests

* Add test for invalid usercode

* Add usercodes to totalconnect.

* Update existing tests for usercodes

* Fix tests

* Remove YAML support

* Fix conflict

* Bump to total_connect_client 0.56

* Change Exception to HomeAssistantError

* Fix config_flow.py

* Simplify async_setup since no yaml

* Remove import from config flow and tests

* Add reauth and test for it.  Various other fixes.

* Fix pylint in __init__

* Show config yaml as deprecated

* separate config_flow and init tests

* Assert ENTRY_STATE_SETUP_ERROR in init test

* Add test for reauth flow

* Fix reauth and tests

* Fix strings

* Restore username and usercode with new passord

* Correct the integration name

* Update tests/components/totalconnect/test_config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/totalconnect/test_init.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update .coveragerc

* Add test for invalid auth during reauth

* Bump total-connect-client to 0.57

* Fix .coveragerc

* More tests for usercodes

* Fix usercode test

* Reload config entry on reauth

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-02-22 10:39:10 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
SNoof85 f654834d34
Use reference strings in Totalconnect (#41047)
* Update strings.json

* Update config_flow.py

* Update test_config_flow.py
2020-10-02 21:45:49 +02:00
Austin Mroczek 98a056f7a9
Notify user if arming or disarming totalconnect alarm fails (#36085) 2020-06-03 18:38:31 +02:00
Paulus Schoutsen 2af984917e
Use asynctest-mock in most places (#35109)
* Use asynctest-mock in most places

* Fix broken patch in pilight
2020-05-03 11:27:19 -07:00
Austin Mroczek c7ab5de07c
Add Totalconnect config flow (#32126)
* Bump skybellpy to 0.4.0

* Bump skybellpy to 0.4.0 in requirements_all.txt

* Added extra states for STATE_ALARM_TRIGGERED to allow users to know if
it is a burglar or fire or carbon monoxide so automations can take
appropriate actions.  Updated TotalConnect component to handle these new
states.

* Fix const import

* Fix const import

* Fix const imports

* Bump total-connect-client to 0.26.

* Catch details of alarm trigger in state attributes.

Also bumps total_connect_client to 0.27.

* Change state_attributes() to device_state_attributes()

* Move totalconnect component toward being a multi-platform integration.  Bump total_connect_client to 0.28.

* add missing total-connect alarm state mappings

* Made recommended changes of MartinHjelmare at
https://github.com/home-assistant/home-assistant/pull/24427

* Update __init__.py

* Updates per MartinHjelmare comments

* flake8/pydocstyle fixes

* removed . at end of log message

* added blank line between logging and voluptuous

* more fixes

* Adding totalconnect zones as HA binary_sensors

* fix manifest.json

* flake8/pydocstyle fixes.  Added codeowner.

* Update formatting per @springstan guidance.

* Fixed pylint

* Add zone ID to log message for easier troubleshooting

* Account for bypassed zones in update()

* More status handling fixes.

* Fixed flake8 error

* Another attempt at black/isort fixes.

* Bump total-connect-client to 0.50.  Simplify code using new functions in
total-connect-client package instead of importing constants.  Run black
and isort.

* Fix manifest file

* Another manifest fix

* one more manifest fix

* more manifest changes.

* sync up

* fix indent

* one more pylint fix

* Hopefully the last pylint fix

* make variable names understandable

* create and fill dict in one step

* Fix name and attributes

* rename to logical variable in alarm_control_panel

* Remove location_name from alarm_control_panel attributes since it is
already the name of the alarm.

* Multiple fixes to improve code per @springstan suggestions

* Update homeassistant/components/totalconnect/binary_sensor.py

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Multiple changes per @MartinHjelmare review

* simplify alarm adding

* Fix binary_sensor.py is_on

* Move DOMAIN to .const in line with examples.

* Move to async_setup

* Simplify code using new features of total-connect-client 0.51

* First crack at config flow for totalconnect

* bump totalconnect to 0.52

* use client.is_logged_in() to avoid total-connect-client details.

* updated generated/config_flow.py

* use is_logged_in()

* Hopefully final touches for config flow

* Add tests for config flow

* Updated requirements for test

* Fixes to test_config_flow

* Removed leftover comments and code

* fix const.py flake8 error

* Simplify text per @Kane610 https://github.com/home-assistant/home-assistant/pull/32126#pullrequestreview-364652949

* Remove .get() to speed things up since the required items should always
be available.

* Move CONF_USERNAME and CONF_PASSWORD into .const to eliminate extra I/O
to import from homeassistant.const

* Fix I/O async issues

* Fix flake8 and black errors

* Mock the I/O in tests.

* Fix isort error

* Empty commit to re-start azure pipelines (per discord)

* bump total-connect-client to 0.53

* Update homeassistant/components/totalconnect/__init__.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Update homeassistant/components/totalconnect/config_flow.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Fixes per @balloob comments

* Fix imports

* fix isort error

* Fix async_unload_entry

It still referenced CONF_USERNAME instead of entry.entity_id

* Added async_setup so not breaking change.  Fixed imports.

* Update tests/components/totalconnect/test_config_flow.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Remove TotalConnectSystem() per @MartinHjelmare suggestion

* Moved from is_logged_in() to is_valid_credentials()

The second is more accurate for what we are checking for, because is_logged_in() could return False due to connection error.

* Fix import in test

* remove commented code and decorator

* Update tests/components/totalconnect/test_config_flow.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* fix test_config_flow.py

* bump total-connect-client to 0.54

* remove un-needed import of mock_coro

* bump to total-connect-client 0.54.1

* re-add CONFIG_SCHEMA

* disable pylint on line 10 to avoid pylint bug

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-12 21:29:57 -05:00