Commit graph

75 commits

Author SHA1 Message Date
Maciej Bieniek
14ec7e5f76
Set DeviceInfo.model_id in Shelly integration (#122040) 2024-07-17 09:04:40 +02:00
Maciej Bieniek
50751574b4
Fix configuration_url for Shelly device using IPv6 (#121939)
Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-07-15 08:31:44 +02:00
Maciej Bieniek
70f05e5f13
Add support for Shelly virtual boolean component (#119932)
Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-07-10 23:51:51 +02:00
Maciej Bieniek
c029c534d6
Do not call async_delete_issue() if there is no issue to delete in Shelly integration (#120762)
Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-06-28 19:34:24 +03:00
Shay Levy
4c6cbadc11
Align Shelly sleeping devices timeout with non-sleeping (#118969) 2024-06-26 20:53:02 +02:00
Shay Levy
ed1eb8ac9c
Change Shelly connect task log message level to error (#120582) 2024-06-26 18:19:28 +02:00
Shay Levy
57e615aa36
Don't log Shelly push update failures if there are no errors (#120189) 2024-06-23 00:36:58 +03:00
Shay Levy
b20160a465
Cleanup Shelly entry unload (#119748)
* Cleanup Shelly entry unload

* store platforms on runtime_data
2024-06-16 08:25:23 -05:00
J. Nick Koston
dbd3147c9b
Remove async_late_forward_entry_setups and instead implicitly hold the lock (#119088)
* Refactor config entry forwards to implictly obtain the lock instead of explictly

This is a bit of a tradeoff to not need async_late_forward_entry_setups

The downside is we can no longer detect non-awaited plastform setups
as we will always implicitly obtain the lock instead of explictly.

Note, this PR is incomplete and is only for discussion purposes
at this point

* preen

* cover

* cover

* restore check for non-awaited platform setup

* cleanup

* fix missing word

* make non-awaited test safer
2024-06-12 21:06:11 -04:00
Shay Levy
04222c32b5
Handle Shelly BLE errors during connect and disconnect (#119174) 2024-06-09 11:59:40 +02:00
Shay Levy
9a6902d827
Hold connection lock in Shelly RPC reconnect (#119009) 2024-06-07 09:50:05 +02:00
J. Nick Koston
ed0568c655
Ensure config entries are not unloaded while their platforms are setting up (#118767)
* Report non-awaited/non-locked config entry platform forwards

Its currently possible for config entries to be reloaded while their platforms
are being forwarded if platform forwards are not awaited or done after the
config entry is setup since the lock will not be held in this case.

In https://developers.home-assistant.io/blog/2022/07/08/config_entry_forwards
we advised to await platform forwards to ensure this does not happen, however
for sleeping devices and late discovered devices, platform forwards may happen
later.

If config platform forwards are happening during setup, they should be awaited

If config entry platform forwards are not happening during setup, instead
async_late_forward_entry_setups should be used which will hold the lock to
prevent the config entry from being unloaded while its platforms are being
setup

* Report non-awaited/non-locked config entry platform forwards

Its currently possible for config entries to be reloaded while their platforms
are being forwarded if platform forwards are not awaited or done after the
config entry is setup since the lock will not be held in this case.

In https://developers.home-assistant.io/blog/2022/07/08/config_entry_forwards
we advised to await platform forwards to ensure this does not happen, however
for sleeping devices and late discovered devices, platform forwards may happen
later.

If config platform forwards are happening during setup, they should be awaited

If config entry platform forwards are not happening during setup, instead
async_late_forward_entry_setups should be used which will hold the lock to
prevent the config entry from being unloaded while its platforms are being
setup

* run with error on to find them

* cert_exp, hold lock

* cert_exp, hold lock

* shelly async_late_forward_entry_setups

* compact

* compact

* found another

* patch up mobileapp

* patch up hue tests

* patch up smartthings

* fix mqtt

* fix esphome

* zwave_js

* mqtt

* rework

* fixes

* fix mocking

* fix mocking

* do not call async_forward_entry_setup directly

* docstrings

* docstrings

* docstrings

* add comments

* doc strings

* fixed all in core, turn off strict

* coverage

* coverage

* missing

* coverage
2024-06-04 21:34:39 -04:00
Maciej Bieniek
709e32a38a
Check if Shelly entry.runtime_data is available (#118805)
* Check if runtime_data is available

* Add tests

* Use `is` operator

---------

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-06-04 18:40:18 +02:00
epenet
e7ce01e649
Enforce namespace import in components (#118218) 2024-05-27 12:50:11 +02:00
Marc Mueller
eedce95bc9
Use PEP 695 for class annotations (2) (#117776) 2024-05-20 10:43:59 +02:00
Shay Levy
d84890bc59
Bump aioshelly to 10.0.0 (#117728) 2024-05-19 19:25:12 +02:00
Shay Levy
bfc52b9fab
Avoid Shelly RPC reconnect during device shutdown (#117702) 2024-05-19 02:05:51 +03:00
Marc Mueller
44049c34f9
Use PEP 695 type alias for ConfigEntry types (#117632) 2024-05-17 15:42:58 +02:00
Sid
ac54cdcdb4
Enable Ruff RUF010 (#115371)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-05-08 23:54:49 +02:00
Michael
8238cd9f22
Store runtime data inside the config entry in Shelly (#116763) 2024-05-04 12:41:25 +02:00
Shay Levy
d1f88ffd1e
Prevent Shelly raising in a task (#116355)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-04-29 08:03:57 -05:00
J. Nick Koston
9ca1d204b6
Fix shelly delaying shutdown (#116346) 2024-04-28 11:19:38 -05:00
Shay Levy
291df6dafe
Bump aioshelly to 9.0.0 (#114025)
* Update Shelly to use initialize from aioshelly

* Save indentation in _async_device_connect

* Use firmware_supported property from aioshelly

* Review comments

* Bump aioshelly

* Fix lint errors

* Test RPC initialized update
2024-04-14 18:07:26 +03:00
J. Nick Koston
ca5ed274cb
Deprecate calling async_listen and async_listen_once with run_immediately (#115169) 2024-04-08 10:07:54 -10:00
Shay Levy
121182167f
Fix Shelly reauth flow (#114180)
* Fix Shelly reauth flow

* Rename shutdown_device to async_shutdown_device
2024-03-25 23:27:44 +02:00
Simone Chemelli
8728057b1b
Add support for Shelly RPC devices custom TCP port (#110860)
* First coding

* add port to config_entry + gen1 not supported msg

* fix async_step_credentials

* strings

* fix reauth

* fix visit device link

* increased MINOR_VERSION

* apply review comments

* align to latest aioshelly

* missing tests

* introduce port parameter

* update tests

* remove leftover

* remove "port" data_description key

* missing key

* apply review comments

* apply more review comments

* Add tests

* apply review comment

* apply review comment (part 2)

* description update

* fine tuning description

* fix test patching

---------

Co-authored-by: Shay Levy <levyshay1@gmail.com>
2024-03-21 19:58:56 +01:00
J. Nick Koston
796f4deac2
Run shelly coordinator shutdown immediately at the stop event (#113633)
There is no need to use a call_soon here as we want to shutdown
right away
2024-03-16 19:36:02 -04:00
Shay Levy
d17e397455
Ignore Shelly block update with cfgChanged None (#113587) 2024-03-16 16:18:41 +02:00
Marc Mueller
930a396712
Add empty line after module docstring [s] (#112704) 2024-03-08 14:33:51 +01:00
J. Nick Koston
6c00d02d0b
Use eager_start for shelly task creation (#111671) 2024-02-27 11:55:38 -10:00
J. Nick Koston
ae7ebc25c7
Migrate shelly to use Debouncer.async_schedule_call (#111087) 2024-02-21 09:47:36 -06:00
Simone Chemelli
7359449636
Code quality for Shelly integration (#109061) 2024-01-30 09:47:52 +01:00
Shay Levy
ad3c78f848
Fix Shelly missing Gen value for older devices (#107294) 2024-01-05 13:32:04 -10:00
Maciej Bieniek
afcf8c9718
Get Shelly RPC device gen from config entry data (#107019)
Use gen from config entry data
2024-01-03 19:45:59 -05:00
Maciej Bieniek
35b733fa2c
Bump aioshelly to version 7.0.0 (#105384)
* Remove get_rpc_device_sleep_period() function

* Bump aioshelly version to 7.0.0

* Remove firmware compatibility check from BLE scanner

* Remove firmware compatibility check from light transition

* Update default fw ver

* Use LightEntityFeature in tests
2023-12-09 17:12:05 +02:00
Simone Chemelli
e161bb9e41
fix BLE stop error for disconnected Shelly devices (#104457) 2023-11-24 20:56:15 +02:00
Maciej Bieniek
2515dbeee1
Bump aioshelly to version 6.1.0 (#104456)
* Bump aioshelly

* Use MODEL_* consts from aioshelly

* Add missing models to BATTERY_DEVICES_WITH_PERMANENT_CONNECTION
2023-11-24 20:55:00 +02:00
Maciej Bieniek
3aa6771835
Update DeviceInfo.sw_version value for Shelly Gen2 sleeping devices (#101338)
* Update device info for gen2 sleeping devices

* Add test

* Update sw_version only if the firmware_version value has changed

* Rename device_update_info() to update_device_fw_info()

* Remove duplicate comparison
2023-10-04 11:00:17 +02:00
Shay Levy
956098ae3a
Shelly - remove unused device update info call (#101295) 2023-10-03 19:21:31 +03:00
Maciej Bieniek
5c5dff034c
Add event platform for Shelly gen1 devices (#100655)
* Initial commit

* Use description.key

* Add translations

* Check event_types

* Rename input_id to channel

* Fix removeal confition

* Add tests

* Sort classes and consts

* Use ShellyBlockEntity class

* Update tests

* Update homeassistant/components/shelly/event.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

---------

Co-authored-by: Shay Levy <levyshay1@gmail.com>
2023-09-23 16:03:57 +02:00
Maciej Bieniek
f6243a1f79
Add event platform for Shelly gen2 devices (#99659)
* Add event platform for gen2 devices

* Add tests

* Add removal condition

* Simplify RpcEventDescription; fix availability

* Improve names and docstrings

* Improve the event entity name

* Use async_on_remove()

* Improve tests coverage

* Improve tests coverage

* Prefix the entity name with the device name in the old way

* Black

* Use DeviceInfo object
2023-09-18 00:38:08 +02:00
Maciej Bieniek
d9a1ebafdd
Show OTA update progress for Shelly gen2 devices (#99534)
* Show OTA update progress

* Use an event listener instead of a dispatcher

* Add tests

* Fix name

* Improve tests coverage

* Fix subscribe/unsubscribe logic

* Use async_on_remove()
2023-09-06 08:17:45 +02:00
Maciej Bieniek
f97f33fff7
Only create an issue if push updates fail 5 times in a row for Shelly gen1 devices (#98747) 2023-08-21 22:27:36 +02:00
Shay Levy
a713d7585f
Bump aioshelly to 6.0.0 (#98719) 2023-08-21 10:49:11 +03:00
Maciej Bieniek
db83dc9acc
Create an issue if push updates fail for Shelly gen1 devices (#96910)
* Create an issue if push updates fail

* Improve strings

* Delete the issue when reloading configuration entry

* Change MAX_PUSH_UPDATE_FAILURES to 5

* Improve issue strings

* Add test

* Use for

* Update homeassistant/components/shelly/strings.json

Co-authored-by: Charles Garwood <cgarwood@newdealmultimedia.com>

* Simplify deleting the issue

---------

Co-authored-by: Charles Garwood <cgarwood@newdealmultimedia.com>
2023-07-20 13:11:05 +02:00
Maciej Bieniek
7b3f100efb
Catch InvalidAuthError in shutdown() method for Shelly gen2 devices (#94563)
* Catch InvalidAuthError in shutdown() method

* Add test

* Revert unwanted change in tests
2023-06-15 00:00:21 +03:00
epenet
1cca6f7c9e
Fix lingering timer in shelly (#92466) 2023-05-04 10:34:15 +02:00
Maciej Bieniek
5244f5731e
Do not reload Shelly TRV config entry (#92000) 2023-04-25 22:20:59 +02:00
Maciej Bieniek
95bb019f71
Do not reload Shelly TRV entry when not needed (#88037)
* Do not reload the entry when the target temperature changes

* Do not reload the entry when the mode changes

* Increase test coverage

* Increase test coverage
2023-02-15 10:21:53 +01:00
Shay Levy
ae6bc96002
Shelly code quality (#86733) 2023-01-27 10:47:05 +02:00