1
mirror of https://github.com/home-assistant/core synced 2024-09-12 15:16:21 +02:00
Commit Graph

33 Commits

Author SHA1 Message Date
J. Nick Koston
d624bbbc0c
Migrate elkm1 to use a dataclass for integration data (#99830)
* Migrate elkm1 to use a dataclass for integration data

* fix unsaved

* slotted

* missing coveragerc

* Revert "missing coveragerc"

This reverts commit 3397b40309.
2023-09-08 13:07:09 -04:00
Glenn Waters
a3d0719c49
Add binary_sensor to ElkM1 integration (#74485)
* Add binary_sensor to ElkM1 integration

* Update for review comments.

* Fix black.

* Fix pylint error.

Co-authored-by: J. Nick Koston <nick@koston.org>
2022-07-11 09:11:37 +02:00
Glenn Waters
a03a4b0d13
ElkM1 integration updates for new version of base library (#71508)
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-05-11 21:32:19 -05:00
Glenn Waters
1492ea1fe3
Elk types 4 (#70305) 2022-04-19 16:45:45 -10:00
Franck Nijhof
1e4aacaeb1
Replace Alarm Control Panel FORMAT_ constants with CodeFormat enum (#69861) 2022-04-18 19:37:32 +02:00
Glenn Waters
c80853496d
Improve Elk-M1 Control typing (#69924)
* Add types to __init__.py

* Fixup typing.

* Fix type error.

* Bump lib to fix login error.

Co-authored-by: Shay Levy <levyshay1@gmail.com>
2022-04-16 00:14:45 +03:00
Glenn Waters
75fce1f036
Update elkm1_lib to 1.3.0 (#69885) 2022-04-11 12:28:39 -10:00
epenet
78045df227
Use EntityFeature enum in components (e**) (#69384) 2022-04-06 11:03:29 +02:00
epenet
3f3ba4f714
Add setup type hints [e] (#63430)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-05 12:49:13 +01:00
Marc Mueller
887d04be60
Use assignment expressions 32 (#58716) 2021-10-30 16:30:13 +02:00
Marc Mueller
ff853b2d53
Use assignment expressions 19 (#57968) 2021-10-18 15:54:38 +02:00
Franck Nijhof
a2d12f9a51
Fix ELKM1 entity service schema (#50020) 2021-05-03 09:40:01 -07:00
Franck Nijhof
2ed386f9e6
Migrate to async_get_current_platform everywhere (#50034) 2021-05-03 09:34:28 -07:00
Erik Montnemery
6c084ae6ce
Update integrations a-e to override extra_state_attributes() (#47756) 2021-03-11 16:51:03 +01:00
Glenn Waters
304b9f47b4
ElkM1 fix auto-configure. (#42064)
The elkm1-lib autoconfigure set the `configured` flag based on an
attribute of the element being changed. This approach misses counters
and thermostats. It also does not work well well an "unconfigured"
element's default value is different from what is on the panel. This
was the case for zones (the `area` attribute was different).

The fix in the library is to mark an element as `configured` when
the element has a name associated with it. This change is
technically breaking, although I imagine, few if any people will be
affected as (1) they configure names on all elements (2) the
functionality was not working properly, so element would not be missing.

The HA docs will be updated to add a section on autoconfigure. It will
describe that to have an element automatically configured then the
element must be configured on the ElkM1 panel with a name.

This particular patch is required for ElkM1 areas. The existing logic
assumes that an area is configured if it has an associated keypad. Not
all areas have keypads (I have an area only armable with HA). The
library fix should catch all configured areas.
2020-10-18 19:48:20 -05:00
Glenn Waters
f7d3f3a1ed
Add elkm1 bypass and trigger services (#41584) 2020-10-12 21:41:19 -05:00
Philip Allgaier
625bbe6238
Cleanup unused loggers (components A-M) (#41600) 2020-10-12 16:59:05 +02:00
Glenn Waters
95e4048f4e
Fix elkm1 changed by (#41378) 2020-10-07 10:36:49 +02:00
gjbadros
f9aff4fc41
Use new elkm1-lib module's LD log data support to correctly identify user_ids (#36211)
* Requires 0.7.18 of elkm1 library to decode LD messages, and uses those messages to reliably set the arming/disarming user when there are more than one area.  See https://github.com/home-assistant/core/issues/35310.

* Fixed typo

* Fixed off by one error -- LD command reports 1-based user-numbers which is the changed_by_id we want, but we need 0-based indices as argument to username.

* Bump required version of elkm1, remove logging message I was using for testing; prepping for PR.

* Black formatted

* Fixed bug whereby I needed to ref elements when running against released build of elkm1-lib
2020-05-28 18:26:03 -05:00
Erik Montnemery
6f7f5b4034
Rename AlarmControlPanel to AlarmControlPanelEntity (#34590) 2020-04-25 18:05:28 +02:00
J. Nick Koston
44f8dab0b0
Add changed_by to elkm1 alarm device_state_attributes (#33982)
* Add last_user_name to alarm device_state_attributes

changed_by_entity_id was removed in 0.108 and replaced
with changed_by_keypad.  This didn't provide enough
data to discover the last user that changed the alarm.

* Switch to changed_by and restore since
we loose the attributes on restart

* use built-in
2020-04-10 21:41:59 -05:00
J. Nick Koston
18a4829314
Config flow for elkm1 (#33297)
* Config flow for elkm1

* As entity ids can now be changed, the “alarm_control_panel”
attribute “changed_by_entity_id” is now “changed_by_keypad”
and will show the name of the Elk keypad instead of the entity id.

* An auto configure mode has been introduced which avoids the
need to setup the complex include and exclude filters.  This
functionality still exists when configuring from yaml for power
users who want more control over which entities elkm1 generates.

* restore _has_all_unique_prefixes

* preserve legacy behavior of creating alarm_control_panels that have no linked keypads when auto_configure is False

* unroll loop
2020-03-27 15:38:35 -05:00
Bas Nijholt
f9e06ca2fd Sort imports according to PEP8 for components starting with "E" (#29765) 2019-12-09 14:10:04 +01:00
Raman Gupta
975ee0ea7f Update service domain for elkm1 from 'alarm_control_panel' to 'elkm1' (#29128)
* move elkm1 services to elkm1 domain

* update missed variable references
2019-11-27 11:15:27 +01:00
SukramJ
1fde0d18ed Add supported_features to Alarm Control Panel to limit device_actions (#29065)
* Add supported_features to Alarm Control Panel

* mark supported_features abstract

* Add SF to async_register_entity_service

* fix test

* Add missing SF SUPPORT_ALARM_ARM_CUSTOM_BYPASS

* isort

* fix async_register_entity_service

* Update alarm_control_panel.py
2019-11-25 15:42:53 -08:00
Diefferson Koderer Môro
ce00d06cbd Move imports in elkm1 component (#27982) 2019-10-20 23:37:52 +02:00
Franck Nijhof
fa79ef1220 Use literal string interpolation in integrations E-G (f-strings) (#26379) 2019-09-03 17:10:56 +02:00
Paulus Schoutsen
4de97abc3a Black 2019-07-31 12:25:30 -07:00
gjbadros
7d68def303 Support multiple Elk instances (#23839)
* Support multiple Elk instances

* Allow more than one Elk M1 alarm system to be integrated into a single hass instance.

* Introduces new "devices" schema at the top level, each of which has
  the prior configuration schema.

* Requires new version of elkm1, 0.7.14, that gwww and I just updated (thanks Glen!)

QUESTION: Should the "devices" section be optional to avoid breaking
old configuration files?  I chose not to do that for simplicity and
because I was following the doorbird code which requires the "devices"
section for all configurations even with only one device.

* Fixed a bunch of hound-raised issues

Fixed issues raised by hound -- there was clearly
a tool I was supposed to run to get those warnings
before submitting the PR.  Sorry!

Updated REQUIREMENTS.

* Fixed whitespace and line-length mistakes

Also fixed unused prefix local variable lint warning.

* Fixed missing blank line

* Fixed more lint warnings.

Not sure if I missed these on the first pass or if the linter stopped
after a certain number of warnings or something else.

Switched logging to use %d and %s instead of string concatenation (per
lint request and because I imagine it migth be better performing
in some (oldish, I presume) implementations of python.

* Fixed typo in last commit.

* Eliminate devices subsection in config schema

This eliminates the breaking change for configurations wanting a
singleton elk m1 instance (the majority of users, no doubt).  I did
not do it like this before because I was following the lead of the
doorbird component which introduced a devices: section when moving
to support multiple doorbells.  But Rohan Kapoor kindly pointed me
at the zoneminder component which sets the other (IMO) preferable
precedent. Will update the docs change shortly.

* Call async_add_entities once for all the elk controllers.

Just move async_add_entities() outside of the loops across the elk m1
controllers, so it's called once for each platform.

* Call async_add_entities only once per platform.

Move it to after the loop, so it's called only once
per platform even when there are multiple elk m1 controllers.

* Various improvements to be more idiomatic python + bug fixes

Thanks to Martin Hjelmare for the careful review and suggestions.
(All mistaken improvements and new bugs are my own.)

* Removed semicolon that lint caught.

* Idiomatic python improvements

Use dict.values() (instead of making it easier to add local looping variable
on the keys by using _, bar = ...items())

Use [] when the key is known to exist.

* Support multiple Elk instances

* Allow more than one Elk M1 alarm system to be integrated into a single hass instance.

* Introduces new "devices" schema at the top level, each of which has
  the prior configuration schema.

* Requires new version of elkm1, 0.7.14, that gwww and I just updated (thanks Glen!)

QUESTION: Should the "devices" section be optional to avoid breaking
old configuration files?  I chose not to do that for simplicity and
because I was following the doorbird code which requires the "devices"
section for all configurations even with only one device.

* Fixed a bunch of hound-raised issues

Fixed issues raised by hound -- there was clearly
a tool I was supposed to run to get those warnings
before submitting the PR.  Sorry!

Updated REQUIREMENTS.

* Fixed whitespace and line-length mistakes

Also fixed unused prefix local variable lint warning.

* Fixed missing blank line

* Fixed more lint warnings.

Not sure if I missed these on the first pass or if the linter stopped
after a certain number of warnings or something else.

Switched logging to use %d and %s instead of string concatenation (per
lint request and because I imagine it migth be better performing
in some (oldish, I presume) implementations of python.

* Fixed typo in last commit.

* Eliminate devices subsection in config schema

This eliminates the breaking change for configurations wanting a
singleton elk m1 instance (the majority of users, no doubt).  I did
not do it like this before because I was following the lead of the
doorbird component which introduced a devices: section when moving
to support multiple doorbells.  But Rohan Kapoor kindly pointed me
at the zoneminder component which sets the other (IMO) preferable
precedent. Will update the docs change shortly.

* Call async_add_entities once for all the elk controllers.

Just move async_add_entities() outside of the loops across the elk m1
controllers, so it's called once for each platform.

* Call async_add_entities only once per platform.

Move it to after the loop, so it's called only once
per platform even when there are multiple elk m1 controllers.

* Various improvements to be more idiomatic python + bug fixes

Thanks to Martin Hjelmare for the careful review and suggestions.
(All mistaken improvements and new bugs are my own.)

* Removed semicolon that lint caught.

* Idiomatic python improvements

Use dict.values() (instead of making it easier to add local looping variable
on the keys by using _, bar = ...items())

Use [] when the key is known to exist.

* Use dict[key] instead of .get (incl. fixing typo). Use .values() instead of .items() when ignoring keys.

* Gotta use devices.get(prefix) since we use no prefix for the singleton elk instance

* fix requirement to use newer elkm1 that supports my changes for multiple elk devices

* Removed spurious + between a string broken between two lines for formatting; was failing a lint check about logging needing to use %s

* Remove REQUIREMENTS and DEPENDENCIES since those are now taken care of by the manifest.json file.

* Add configuration check that the prefixes are all unique

* Use new dependency 'getmac' to get mac address of Elk M1 controllers and use that for uniqueid if possible, else use None.  Also removed some procedural checking of unique prefix since that's now handled at schema check time.

* Whitespace changes to make style checker happy and code more consistent

* Removed unused variable, added blank line

* Make getmac a requirement not dependency

I should've RTFM.

* ws only change; I really need to get Emacs to understand these style guidelines

* Ran script/gen_requirements_all.py; script/setup needed to be run so that was failing.

* More style check fixes and one bug fix.

* Incomplete set of changes from last push

* More conform-to-hass-style changes: use caps to start log message (and do not use function name even for debug message. And do not use string concatenation; prefer new-style .format.

* Style fixes.

* Switch back to using the prefix config field for setting the unique_id since the mac address approach has numerous shortcomings including: 1) new dependency; 2) lack of reliability; 3) doesn't work for serial connections; 4) breaks when a layer 4+ networking entity intermediates the elk m1 connection.

* Reran to update (removing getmac dependency)

* Skipped trailing ','; keep forgetting which languages are forgiving about this practical nicety of allowing trailing commas without changing the semantics.

* Validate uniqueness on lowercase versions of the prefix since we're gonna use .lower() on creating the entity id that has to be unique; do the _has_all_unique_prefixes check last so we get errors from the device schema before complaining about the uniqueness problem, if any

* Use vol.Lower to convert to lowercase instead of the map.  Also fixed a pair of bugs for the alarm control panel display message service -- since data templates always generate strings, the values subject to range/set restrictions need to be coerced to their proper type before the check

* Fix some flake8 warnings.

* Fixed typo; it's Coerce not coerce.

* Use elkm1m_ string to start unique_id when and only when there is a non-empty prefix given; this enables backward compatibility to avoid a breaking change by letting the elkm1_ start to unique_id keep working exactly as it used to.

* minor comment tweak to force automation tests to run again since they failed for unrelated reasons last time

* There's actually been a 0.7.15 release which was meta-information and tidying only so we might as well depend on it

* Forgot to update this with gen_requirements_all.py
2019-07-27 10:36:09 +02:00
cgtobi
2c07bfb9e0 Remove dependencies and requirements (#23024)
* Remove dependencies and requirements

* Revert "Remove dependencies and requirements"

This reverts commit fe7171b4cd.

* Remove dependencies and requirements

* Revert "Remove dependencies and requirements"

This reverts commit 391355ee2c.

* Remove dependencies and requirements

* Fix flake8 complaints

* Fix more flake8 complaints

* Revert non-component removals
2019-04-12 10:13:30 -07:00
Paulus Schoutsen
4b1de61110
Use relative imports inside integrations (#22235)
* Use relative imports inside integrations

* Lint

* Fix automation tests

* Fix scene imports
2019-03-20 22:56:46 -07:00
Fabian Affolter
127c55e0c1
Update file header (#21023)
* Update file header

* Update file header

* Update file header

* Update file header

* Update file header

* Fix lint issues
2019-02-13 21:21:14 +01:00
Paulus Schoutsen
e2d3c27e85
Embed all platforms into components (#20677)
* Consolidate all components with platforms

* Organize tests

* Fix more tests

* Fix Verisure tests

* one final test fix

* Add change

* Fix coverage
2019-02-02 07:13:16 -08:00