Commit Graph

119 Commits (3fda66d9e2cc9dc1347be178b0f5747d7b62a32c)

Author SHA1 Message Date
J. Nick Koston b10534359b
Reduce config entry setup/unload boilerplate K-M (#49775) 2021-04-27 18:49:13 +02:00
HomeAssistant Azure 32dfaccf1f [ci skip] Translation update 2021-04-24 00:03:34 +00:00
Milan Meulemans 48695869f9
Change dict[str, Any] to FlowResultDict (#49546) 2021-04-22 17:23:15 -10:00
jan iversen d76993034e
Replace HomeAssistantType with HomeAssistant for integrations m* - n* (#49566)
* Integration neato: rename HomeAssistantType to HomeAssistant.

* Integration mysensors: rename HomeAssistantType to HomeAssistant.

* Integration mobile_app: rename HomeAssistantType to HomeAssistant.

* Integration minecraft_server: rename HomeAssistantType to HomeAssistant.

* Clean up

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-04-22 22:23:36 +02:00
HomeAssistant Azure 69c1721c2a [ci skip] Translation update 2021-04-22 00:02:50 +00:00
HomeAssistant Azure 020d456889 [ci skip] Translation update 2021-04-21 00:03:47 +00:00
Martin Hjelmare 410f0e3604
Fix mysensors mqtt integration setup guard (#49423) 2021-04-20 09:21:38 -07:00
Marc Mueller c07646db5d
Update typing syntax (#49480)
* Update typing syntax

* Replace typing imports with ones from collections where possible

* Changes after review
2021-04-20 17:40:41 +02:00
HomeAssistant Azure f6a24e8d68 [ci skip] Translation update 2021-04-20 00:04:05 +00:00
Martin Hjelmare 1b5148a3af
Fix mysensors sensor protocol version check (#49257) 2021-04-15 16:12:49 +02:00
Franck Nijhof 055cdc64c0
Add support for IoT class in manifest (#46935) 2021-04-15 10:21:38 +02:00
HomeAssistant Azure 93c68f8be6 [ci skip] Translation update 2021-04-13 00:04:04 +00:00
Martin Hjelmare e988062034
Fix mysensor cover closed state (#48833) 2021-04-08 12:39:03 -07:00
HomeAssistant Azure 82cc5148d7 [ci skip] Translation update 2021-04-07 00:04:06 +00:00
Franck Nijhof 6932cf9534
Use contextlib.suppress where possible (#48189) 2021-03-23 14:36:43 +01:00
Erik Montnemery fdf97eaca3
Migrate integrations i-m to extend SensorEntity (#48213) 2021-03-22 19:59:03 +01:00
HomeAssistant Azure 6fab4a2c82 [ci skip] Translation update 2021-03-22 00:08:34 +00:00
Marc Mueller 25a13d1554
Update typing 10 (#48071) 2021-03-18 13:07:04 +01:00
HomeAssistant Azure f625e324dd [ci skip] Translation update 2021-03-18 00:07:07 +00:00
HomeAssistant Azure 4306c8fbb4 [ci skip] Translation update 2021-03-17 00:03:55 +00:00
HomeAssistant Azure c11b85af2f [ci skip] Translation update 2021-03-16 00:04:36 +00:00
Erik Montnemery 14a59d290a
Update integrations j-o to override extra_state_attributes() (#47758) 2021-03-11 20:11:25 +01:00
Martin Hjelmare d85d1a65a7
Fix mysensors unload clean up (#47541) 2021-03-07 14:20:21 +01:00
Martin Hjelmare f542b360d5
Fix mysensors device tracker (#47536) 2021-03-06 23:41:43 +01:00
Martin Hjelmare d944bbbc52
Bump pymysensors to 0.21.0 (#47530) 2021-03-06 23:06:50 +01:00
Martin Hjelmare 1600207f5c
Fix mysensors notify platform (#47517) 2021-03-06 18:33:55 +01:00
FidgetyRat 4cade4b736
Add OPENING & CLOSING state to MySensors cover (#47285)
* Added OPENING & CLOSING State Support

Added support for OPENING and CLOSING states using a combination of
the required V_ variables. Simplified the determination of the
cover's state by use of a new enumeration and single method allowing
the state to be used by all three HomeAssistant query methods.

* Fixes for HomeAssistant Style

Corrections to style to allow flake8, isort, and black to pass.

* Peer Review Changes

Added @unique to the main enumeration. Removed unnecessary parens from
door state logic. Reordered CLOSING and CLOSED in the enumeration.
2021-03-06 10:26:04 +01:00
functionpointer a2ee7d598b
Use conn_made callback in MySensors (#47463) 2021-03-05 20:21:24 +01:00
Quentame 198ecb0945
Uniformize platform setup (#47101)
* A platform is not a component

* Fix dynalite

* SUPPORTED_PLATFORMS --> PLATFORMS

* In tests

* In tests 2

* Fix SmartThings

* Fix ZHA test

* Fix Z-Wave

* Revert Z-Wave

* Use PLATFORMS const in ambient_station

* Fix ihc comment
2021-03-02 21:43:59 +01:00
Ville Skyttä dc880118a4
Lint suppression cleanups (#47248)
* Unused pylint suppression cleanups

* Remove outdated pylint bug references

* Add flake8-noqa config and note to run it every now and then

* Add codes to noqa's

* Unused noqa cleanups
2021-03-02 09:02:04 +01:00
HomeAssistant Azure 44ed6cda40 [ci skip] Translation update 2021-03-01 00:09:01 +00:00
Martin Hjelmare 17f4c9dd06
Improve mysensors config flow (#46984) 2021-02-24 12:52:04 +01:00
Martin Hjelmare 1c7c6163dd
Save mysensors gateway type in config entry (#46981) 2021-02-24 11:31:31 +01:00
HomeAssistant Azure 9159f54900 [ci skip] Translation update 2021-02-24 00:04:14 +00:00
HomeAssistant Azure 580d25c622 [ci skip] Translation update 2021-02-23 00:05:06 +00:00
HomeAssistant Azure 0cb1f61deb [ci skip] Translation update 2021-02-21 00:07:04 +00:00
HomeAssistant Azure fd60d4273b [ci skip] Translation update 2021-02-20 00:08:25 +00:00
HomeAssistant Azure d9ce7db554 [ci skip] Translation update 2021-02-19 00:03:06 +00:00
HomeAssistant Azure 0af634a9f8 [ci skip] Translation update 2021-02-15 00:14:36 +00:00
HomeAssistant Azure 8bacfcec50 [ci skip] Translation update 2021-02-13 00:03:13 +00:00
HomeAssistant Azure ee04473e85 [ci skip] Translation update 2021-02-12 00:02:46 +00:00
HomeAssistant Azure 8007391244 [ci skip] Translation update 2021-02-11 00:02:56 +00:00
HomeAssistant Azure 936ee7d733 [ci skip] Translation update 2021-02-09 00:07:22 +00:00
HomeAssistant Azure 818501216e [ci skip] Translation update 2021-02-07 00:06:57 +00:00
HomeAssistant Azure ce159d7db3 [ci skip] Translation update 2021-02-06 00:07:22 +00:00
functionpointer c01e01f797
MySensors config flow (#45421)
* MySensors: Add type annotations

Adds a bunch of type annotations that were created
while understanding the code.

* MySensors: Change GatewayId to string

In preparation for config flow.
The GatewayId used to be id(gateway).

With config flows, every gateway will have its own
ConfigEntry. Every ConfigEntry has a unique id.
Thus we would have two separate but one-to-one related ID systems.

This commit removes this unneeded duplication by using the id of the ConfigEntry
as GatewayId.

* MySensors: Add unique_id to all entities

This allows entities to work well with the frontend.

* MySensors: Add device_info to all entities

Entities belonging to the same node_id will now by grouped as a device.

* MySensors: clean up device.py a bit

* MySensors: Add config flow support

With this change the MySensors can be fully configured from the GUI.

Legacy configuration.yaml configs will be migrated by reading them once.
Note that custom node names are not migrated. Users will have to re-enter
the names in the front-end.
Since there is no straight-forward way to configure global settings,
all previously global settings are now per-gateway. These settings include:
- MQTT retain
- optimistic
- persistence enable
- MySensors version

When a MySensors integration is loaded, it works as follows:
1. __init__.async_setup_entry is called
2. for every platform, async_forward_entry_setup is called
3. the platform's async_setup_entry is called
4. __init__.setup_mysensors_platform is called
5. the entity's constructor (e.g. MySensorsCover) is called
6. the created entity is stored in a dict in the hass object

* MySensors: Fix linter errors

* MySensors: Remove unused import

* MySensors: Feedback from @MartinHjelmare

* MySensors: Multi-step config flow

* MySensors: More feedback

* MySensors: Move all storage in hass object under DOMAIN

The integration now stores everything under hass.data["mysensors"]
instead of using several top level keys.

* MySensors: await shutdown of gateway instead of creating a task

* MySensors: Rename Ethernet to TCP

* MySensors: Absolute imports and cosmetic changes

* MySensors: fix gw_stop

* MySensors: Allow user to specify persistence file

* MySensors: Nicer log message

* MySensors: Add lots of unit tests

* MySensors: Fix legacy import of persistence file name

Turns out tests help to find bugs :D

* MySensors: Improve test coverage

* MySensors: Use json persistence files by default

* MySensors: Code style improvements

* MySensors: Stop adding attributes to existing objects

This commit removes the extra attributes that were being
added to the gateway objects from pymysensors.

Most attributes were easy to remove, except for the gateway id.
The MySensorsDevice class needs the gateway id as it is part of its DevId
as well as the unique_id and device_info.
Most MySensorsDevices actually end up being Entities.
Entities have access to their ConfigEntry via self.platform.config_entry.

However, the device_tracker platform does not become an Entity.
For this reason, the gateway id is not fetched from self.plaform but
given as an argument.

Additionally, MySensorsDevices expose the address of the gateway
(CONF_DEVICE). Entities can easily fetch this information via self.platform,
but the device_tracker cannot. This commit chooses to remove the gateway
address from device_tracker. While this could in theory break some automations,
the simplicity of this solution was deemed worth it.
The alternative of adding the entire ConfigEntry as an argument to MySensorsDevices
is not viable, because device_tracker is initialized by the async_setup_scanner function
that isn't supplied a ConfigEntry. It only gets discovery_info.
Adding the entire ConfigEntry doesn't seem appropriate for this edge case.

* MySensors: Fix gw_stop and the translations

* MySensors: Fix incorrect function calls

* MySensors: Fewer comments in const.py

* MySensors: Remove union from _get_gateway and remove id from try_connect

* MySensors: Deprecate nodes option in configuration.yaml

* MySensors: Use version parser from packaging

* MySensors: Remove prefix from unique_id and change some private property names

* MySensors: Change _get_gateway function signature

* MySensors: add packaging==20.8 for the version parser

* MySensors: Rename some stuff

* MySensors: use pytest.mark.parametrize

* MySensors: Clean up test cases

* MySensors: Remove unneeded parameter from devices

* Revert "MySensors: add packaging==20.8 for the version parser"

This reverts commit 6b200ee01a.

* MySensors: Use core interface for testing configuration.yaml import

* MySensors: Fix test_init

* MySensors: Rename a few variables

* MySensors: cosmetic changes

* MySensors: Update strings.json

* MySensors: Still more feedback from @MartinHjelmare

* MySensors: Remove unused strings

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

* MySensors: Fix typo and remove another unused string

* MySensors: More strings.json

* MySensors: Fix gateway ready handler

* MySensors: Add duplicate detection to config flows

* MySensors: Deal with non-existing topics and ports.

Includes unit tests for these cases.

* MySensors: Use awesomeversion instead of packaging

* Add string already_configured

* MySensors: Abort config flow when config is found to be invalid while importing

* MySensors: Copy all error messages to also be abort messages

All error strings may now also be used as an abort reason,
so the strings should be defined

* Use string references

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-02-05 22:13:57 +01:00
springstan d5efb3e3de
Remove temporary variable by only retrieving needed value (#42522) 2020-11-29 00:44:25 +01:00
J. Nick Koston 41872341f5
Update mysensors to use async_add_executor_job (#41849) 2020-10-15 09:22:50 -05:00
Philip Allgaier 625bbe6238
Cleanup unused loggers (components A-M) (#41600) 2020-10-12 16:59:05 +02:00
springstan 6c8e0e20fb
Add and use light lux constant in entire code base (#40171) 2020-09-23 20:48:01 +02:00