Commit Graph

71 Commits

Author SHA1 Message Date
Stefano Angeleri
c8972a2234 Fix powerwall display of actual remaining battery, instead of reserved capacity (#142391) 2025-04-14 12:59:28 +02:00
epenet
d0a188b86d Standardize homeassistant imports in component tests (m-z) (#136807) 2025-01-29 08:57:57 +01:00
Christian
9993a68a55 Powerwall: Reuse authentication cookie (#136147)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-01-24 11:52:24 -10:00
epenet
fe010289b4 Use new ServiceInfo location in component tests (part 2) (#136062) 2025-01-20 13:13:45 +01:00
J. Nick Koston
e388e9f396 Fix missing title placeholders in powerwall reauth (#130389) 2024-11-11 20:48:49 +01:00
epenet
ef4caa951c Use start_reauth helper method in integration tests (p-r) (#124792) 2024-08-28 16:20:47 +02:00
epenet
d961e20b15 Add missing hass type hint in component tests (p) (#124227) 2024-08-20 12:52:33 +02:00
epenet
1ddc723274 Improve type hints in powerwall tests (#123872) 2024-08-14 13:12:24 +02:00
epenet
3e9d25f81d Add missing argument type hints to component tests (#119671) 2024-06-14 09:26:46 +02:00
Sid
721b2c2ca8 Enable Ruff PT012 (#113957) 2024-06-08 17:59:08 +02:00
epenet
3d31af3eb4 Move entity_registry_enabled_by_default to decorator [a-p] (#118794) 2024-06-04 16:18:42 +02:00
epenet
301c17cba7 Use registry fixtures in tests (o-p) (#118292) 2024-05-28 13:42:38 +02:00
J. Nick Koston
58210b1968 Bump tesla-powerwall to 0.5.2 (#117823) 2024-05-20 16:51:39 -10:00
epenet
9204ccfa17 Use is in ConfigEntryState enum comparison in tests (N-Z) (#114926) 2024-04-05 17:37:00 +02:00
Joost Lekkerkerker
f3ba713289 Use FlowResultType enum in config flow tests N-Z (#114682)
Use FlowResultType enum in config flow tests
2024-04-03 09:53:20 +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
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
Sid
00ec7f11f0 Enable Ruff rule PT007 (#113764)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-03-19 09:01:07 +01:00
Marc Mueller
1722e23df8 Add empty line after module docstring [tests l-p] (#112710) 2024-03-08 14:55:15 +01:00
J. Nick Koston
dcfff6c138 Fix formatting of mac addresses from dhcp discovery mocking in powerwall (#110591)
dhcp returns addresses in lowercase without :
2024-02-14 23:11:25 +01:00
J. Nick Koston
f6d4617c7a Avoid directly changing config entry state in tests (part 2) (#110115)
followup to #110048 for more places
2024-02-10 07:20:15 +01:00
Marc Mueller
438d3b01b9 Use builtin TimeoutError [o-s] (#109682) 2024-02-05 12:14:37 +01:00
Josh Pettersen
0cc8b2edf9 Remove battery charge sensor from powerwall (#109271) 2024-02-01 14:01:05 -06:00
Josh Pettersen
b629ad9c3d Add individual battery banks as devices (#108339) 2024-01-30 19:03:01 -10:00
J. Nick Koston
e7c25d1c36 Migrate powerwall unique ids to use the gateway din (#107509) 2024-01-13 16:17:37 -10:00
J. Nick Koston
3a4c64b0a7 Fix missing timeout exception check in powerwall config flow (#107899)
* Fix missing timeout exception check in powerwall config flow

powerwall recently switched to asyncio, and every place we
check for unreachable we need to check for timeout error.
There was one missed

```
09:08 homeassistant homeassistant[546]: 2024-01-12 10:09:08.899 ERROR (MainThread) [homeassistant.components.powerwall.config_flow] Unexpected exception
Jan 12 20:09:08 homeassistant homeassistant[546]: Traceback (most recent call last):
Jan 12 20:09:08 homeassistant homeassistant[546]:   File "/usr/src/homeassistant/homeassistant/components/powerwall/config_flow.py", line 168, in _async_try_connect
Jan 12 20:09:08 homeassistant homeassistant[546]:     info = await validate_input(self.hass, user_input)
Jan 12 20:09:08 homeassistant homeassistant[546]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jan 12 20:09:08 homeassistant homeassistant[546]:   File "/usr/src/homeassistant/homeassistant/components/powerwall/config_flow.py", line 76, in validate_input
Jan 12 20:09:08 homeassistant homeassistant[546]:     site_info, gateway_din = await _login_and_fetch_site_info(
Jan 12 20:09:08 homeassistant homeassistant[546]:                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jan 12 20:09:08 homeassistant homeassistant[546]:   File "/usr/src/homeassistant/homeassistant/components/powerwall/config_flow.py", line 43, in _login_and_fetch_site_info
Jan 12 20:09:08 homeassistant homeassistant[546]:     await power_wall.login(password)
Jan 12 20:09:08 homeassistant homeassistant[546]:   File "/usr/local/lib/python3.12/site-packages/tesla_powerwall/powerwall.py", line 58, in login
Jan 12 20:09:08 homeassistant homeassistant[546]:     return await self.login_as(User.CUSTOMER, password, email, force_sm_off)
Jan 12 20:09:08 homeassistant homeassistant[546]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jan 12 20:09:08 homeassistant homeassistant[546]:   File "/usr/local/lib/python3.12/site-packages/tesla_powerwall/powerwall.py", line 49, in login_as
Jan 12 20:09:08 homeassistant homeassistant[546]:     response = await self._api.login(user, email, password, force_sm_off)
Jan 12 20:09:08 homeassistant homeassistant[546]:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jan 12 20:09:08 homeassistant homeassistant[546]:   File "/usr/local/lib/python3.12/site-packages/tesla_powerwall/api.py", line 172, in login
Jan 12 20:09:08 homeassistant homeassistant[546]:     return await self.post(
Jan 12 20:09:08 homeassistant homeassistant[546]:            ^^^^^^^^^^^^^^^^
Jan 12 20:09:08 homeassistant homeassistant[546]:   File "/usr/local/lib/python3.12/site-packages/tesla_powerwall/api.py", line 146, in post
Jan 12 20:09:08 homeassistant homeassistant[546]:     response = await self._http_session.post(
Jan 12 20:09:08 homeassistant homeassistant[546]:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jan 12 20:09:08 homeassistant homeassistant[546]:   File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 601, in _request
Jan 12 20:09:08 homeassistant homeassistant[546]:     await resp.start(conn)
Jan 12 20:09:08 homeassistant homeassistant[546]:   File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 960, in start
Jan 12 20:09:08 homeassistant homeassistant[546]:     with self._timer:
Jan 12 20:09:08 homeassistant homeassistant[546]:   File "/usr/local/lib/python3.12/site-packages/aiohttp/helpers.py", line 735, in __exit__
Jan 12 20:09:08 homeassistant homeassistant[546]:     raise asyncio.TimeoutError from None
Jan 12 20:09:08 homeassistant homeassistant[546]: TimeoutError

```

* cov
2024-01-12 21:39:27 +01:00
bubonicbob
c74bef265a Update powerwall for tesla_powerwall 0.5.0 which is async (#107164)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-01-10 11:21:53 -10:00
Joost Lekkerkerker
0ab0901f0f Add entity translations to Powerwall (#98843) 2023-08-22 21:58:57 +02:00
epenet
69a46d4002 Adjust pylint plugin for components fixtures (#90217)
* Adjust pylint plugin for components fixtures

* Adjust components

* Use MagicMock

* Adjust

* Use None
2023-03-26 15:21:19 +02:00
epenet
d65dff3f9e Adjust entity registry access in tests (2) (#88960) 2023-03-01 16:23:36 +01:00
epenet
2cdc741900 Add type hints to integration tests (part 17) (#88163) 2023-02-15 11:14:04 +01:00
epenet
3abf7ea18a Add type hints to integration tests (m-p) (#87705) 2023-02-08 07:48:54 -08:00
epenet
59ca7780fa Add typing to tests with single hass argument (#87631) 2023-02-07 15:01:16 +01:00
Dan Simpson
66e21d7701 Add Powerwall off grid switch (#86357)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-01-23 15:03:15 -10:00
J. Nick Koston
a1d9d7116c Prevent powerwall from switching addresses if its online (#82410)
* Prevent powerwall from switching addresses if its online

If the wifi interface was discovered we would switch the
ip address in the entry to the wifi ip even if it was
connected via ethernet

* cover

* more cover
2022-11-20 10:38:30 -05:00
Franck Nijhof
a6244eea28 Search/replace RESULT_TYPE_* by FlowResultType enum (#74656) 2022-07-07 21:28:18 +02:00
jrester
ad5dbae425 Fix reauthentication for powerwall integration (#72174) 2022-05-20 14:53:43 -05:00
Matt Zimmerman
8c00fde27d [powerwall] Skip backup reserve sensor if data is unavailable (#69637) 2022-04-07 20:34:00 -07:00
epenet
053c4428a9 Prettify json (component test fixtures) (#68892) 2022-03-30 11:37:17 +02:00
J. Nick Koston
4cc8998ea7 Make powerwall attribute sensors their own sensors (#68345) 2022-03-18 21:23:26 +01:00
Matt Zimmerman
d077c3b8d1 Add sensor to expose Powerwall backup reserve percentage (#66393) 2022-02-28 09:31:34 -10:00
J. Nick Koston
3d8d507ed9 Migrate powerwall from using ip address as unique id (#65257)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-02-03 18:39:57 +01:00
epenet
c3e9c1a7e8 Use DhcpServiceInfo in powerwall (#60051) 2021-11-21 07:56:22 -06:00
Paulus Schoutsen
31153ac155 Move fixtures part 1 (#58902) 2021-11-01 20:47:05 -07:00
some-guy-in-oz
b2d67f8d19 Add grid services active sensor to telsa powerwall integration (#56317)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-10-22 14:25:25 -10:00
Paulus Schoutsen
a4d9019ffc Refactor persistent notification to no longer route all data via a service (#57157)
* Convert persistent notification tests to async

* Create/dismiss persistent notifications in exposed functions, not service calls

* Fix notify persistent_notification

* Remove setting up persistent_notification

* Drop more setups

* Empty methods

* Undeprecate sync methods because too big task

* Fix setup clearing notifications

* Fix a bunch of tests

* Fix more tests

* Uno mas

* Test persistent notification events

* Clean up stale comment

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-10-07 12:58:00 +02:00
J. Nick Koston
25f3cdde50 Add powerwall import and export sensors (#54018)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2021-08-09 16:03:22 -07:00
Ville Skyttä
153d6e891e Use config_entries.SOURCE_* constants (#49631) 2021-04-25 11:27:40 +02:00
Franck Nijhof
969c147b77 Clean up superfluous integration setup - part 4 (#49295)
* Clean up superfluous integration setup - part 4

* Adjust tests
2021-04-16 17:46:49 +02:00
Erik Montnemery
ba2978c693 Update tests p-s to use async_get() instead of async_get_registry() (#47654) 2021-03-09 14:28:32 +01:00