Commit Graph

228 Commits (20639b0f023aabc4047c64bb51f3a07136e0b1e1)

Author SHA1 Message Date
J. Nick Koston 460363c4ba
Bump aioshelly to 11.4.1 to accomodate shelly GetStatus calls that take a few seconds to respond (#124893)
Co-authored-by: Shay Levy <levyshay1@gmail.com>
2024-08-30 09:05:16 -10:00
epenet 9bcc31a9fe
Use start_reauth helper method in integration tests (s) (#124793) 2024-08-28 16:49:05 +02:00
Shay Levy 467749eb57
Fix Shelly sleepy RPC setup if device is already awake (#124734) 2024-08-27 10:48:13 -10:00
Maciej Bieniek b960ebeb8b
Add WS outbound config to Shelly diagnostics (#124654)
Add WS Outbound config to diagnostics
2024-08-26 22:17:38 +03:00
Maciej Bieniek d8fe3c5377
Add missing units for `xpercent`, `xfreq` and `xcounts` Shelly sensors (#124288) 2024-08-26 08:59:18 -10:00
J. Nick Koston 76182c246d
Auto configure outbound websocket for sleepy shelly RPC devices (#124545) 2024-08-26 08:37:36 -10:00
J. Nick Koston be206156b0
Fix shelly sleepy entities never being created (#124547) 2024-08-25 09:21:23 -10:00
J. Nick Koston df82567356
Fix shelly available check when device is not initialized (#124182)
* Fix shelly available check when device is not initialized

available needs to check for device.initialized or if the device
is sleepy as calls to status will raise NotInitialized which results
in many unretrieved exceptions while writing state

fixes
```
2024-08-18 09:33:03.757 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 453, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/shelly/entity.py", line 374, in _update_callback
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1005, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1130, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1011, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 293, in state
    if (is_on := self.is_on) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/shelly/binary_sensor.py", line 331, in is_on
    return bool(self.attribute_value)
                ^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/shelly/entity.py", line 545, in attribute_value
    self._last_value = self.sub_status
                       ^^^^^^^^^^^^^^^
  File "/config/custom_components/shelly/entity.py", line 534, in sub_status
    return self.status[self.entity_description.sub_key]
           ^^^^^^^^^^^
  File "/config/custom_components/shelly/entity.py", line 364, in status
    return cast(dict, self.coordinator.device.status[self.key])
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aioshelly/rpc_device/device.py", line 390, in status
    raise NotInitialized
aioshelly.exceptions.NotInitialized
```

* tweak

* cover

* fix

* cover

* fixes
2024-08-22 16:14:45 +03:00
Shay Levy 49c59339d9
Shelly RPC - do not stop BLE scanner if a sleeping device (#124147) 2024-08-18 18:35:02 +03:00
Maciej Bieniek ec0012209d
Add missing sensors for Shelly Plus RGBW PM (#123589)
* Add missing sensors for Shelly Plus RGBW PM

* Add tests
2024-08-18 12:58:51 +03:00
Shay Levy 8687c32c15
Ignore Shelly IPv6 address in zeroconf (#123081) 2024-08-02 21:56:49 +03:00
Shay Levy d2cc25cee6
Prevent connecting to a Shelly device that is already connected (#122105) 2024-07-18 15:27:03 -05:00
Maciej Bieniek bf0e5baa76
Add support for Shelly `enum` virtual component (#121997)
* Support enum virtual component

* Add tests

* Cleaning

* Improve test for select

* Use values

* Update tests

* Use the option title for sensor

---------

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-07-18 17:55:14 +03:00
Maciej Bieniek 260e98c3f7
Add support for Shelly `number` virtual component (#121894)
* Support number component in field mode

* Support number in label mode

* Add tests

* Add mode_fn

* Add support for number component in slider mode

* Add comment

* Suggested change

* Revert max_fn

* Change unit 'min' to 'Hz' in test

---------

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-07-15 22:26:12 +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 a34858a567
Use parametrize in tests for Shelly `boolean` virtual component (#121895)
Use parametrize in tests

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-07-13 15:27:17 +03:00
Maciej Bieniek 3ef1e5816e
Add support for Shelly `text` virtual component (#121735)
* Add support for text component

* Add tests

* Improve const names

* Remove unnecessary code

---------

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-07-12 12:58:21 +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 dbe98de82a
Fix `pulse counter frequency` sensors for Shelly Plus Uni (#121178)
Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-07-05 09:40:43 +02:00
epenet ac57eb7614
Add monkeypatch type hints to shelly tests (#121057)
* Add monkeypatch type hints to shelly tests

* Improve
2024-07-03 12:08:40 +02:00
epenet 3df3e6d081
Use service_calls fixture in shelly tests (#120991) 2024-07-02 10:36:50 +02:00
Shay Levy 4c6cbadc11
Align Shelly sleeping devices timeout with non-sleeping (#118969) 2024-06-26 20:53:02 +02:00
Shay Levy d8ab2debfd
Add last_error reporting to Shelly diagnostics (#120595) 2024-06-26 21:35:23 +03:00
Maciej Bieniek 54f8b5afdf
Add pulse counter frequency sensors to Shelly (#119898)
* Add pulse counter frequency sensors

* Cleaning

---------

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-06-18 23:08:30 +02:00
Maciej Bieniek f5dfefb3a6
Use the humidity value in Shelly Wall Display climate entity (#119830)
* Use the humidity value with the climate entity if available

* Update tests

* Use walrus

---------

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-06-17 23:17:05 +03:00
Maciej Bieniek 87c1d5a6a7
Remove the switch entity for Shelly Gas Valve (#119817)
Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-06-17 19:17:06 +02:00
Shay Levy 40b98b70b0
Wait for background tasks in Shelly tests (#119636) 2024-06-13 22:36:03 +03:00
epenet fb1b0058ee
Fix consider-using-tuple pylint warnings in component tests (#119464)
* Fix consider-using-tuple pylint warnings in component tests

* Apply su

Co-authored-by: Michael <35783820+mib1185@users.noreply.github.com>

---------

Co-authored-by: Michael <35783820+mib1185@users.noreply.github.com>
2024-06-12 15:50:27 +02:00
epenet 08eb8232e5
Fix namespace-import pylint warning in shelly tests (#119349) 2024-06-11 08:08:47 +02:00
Shay Levy 04222c32b5
Handle Shelly BLE errors during connect and disconnect (#119174) 2024-06-09 11:59:40 +02:00
Sid 721b2c2ca8
Enable Ruff PT012 (#113957) 2024-06-08 17:59:08 +02: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 20b5aa3e0e
Move entity_registry_enabled_by_default to decorator [q-z] (#118793) 2024-06-04 13:38:32 +02:00
epenet 83e77720e9
Improve type hints for mock_bluetooth/enable_bluetooth (#118484) 2024-05-30 22:16:45 -04:00
epenet 98d24dd276
Improve typing for `calls` fixture in tests (m-z) (#118350)
* Improve typing for `calls` fixture in tests (m-z)

* More

* More
2024-05-29 09:30:41 +02:00
epenet e58d060f82
Use registry fixtures in tests (s) (#118295) 2024-05-28 15:41:03 +02:00
Shay Levy ecd48cc447
Clean up Shelly unneccesary async_block_till_done calls (#118141) 2024-05-26 00:28:48 +03:00
epenet 44f715bd02
Use issue_registry fixture in component tests (#118041) 2024-05-24 15:54:20 +02:00
Maciej Bieniek 789073384b
Support reconfigure flow in Shelly integration (#117525)
* Support reconfigure flow

* Update strings

* Add tests

---------

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-05-16 17:47:12 +02:00
Simone Chemelli 32a9cb4b14
Add Shelly motion sensor switch (#115312)
* Add Shelly motion sensor switch

* update name

* make motion switch a restore entity

* add test

* apply review comment

* Update tests/components/shelly/test_switch.py

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

* Update tests/components/shelly/test_switch.py

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

* Update tests/components/shelly/test_switch.py

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

* Update tests/components/shelly/test_switch.py

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

* rename switch

* Update tests/components/shelly/test_switch.py

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

* Update tests/components/shelly/test_switch.py

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

* Update tests/components/shelly/test_switch.py

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

* fix ruff

---------

Co-authored-by: Shay Levy <levyshay1@gmail.com>
2024-05-16 12:49:49 +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
Maciej Bieniek 51bceb1c99
Fix climate entity creation when Shelly WallDisplay uses external relay as actuator (#115216)
* Fix climate entity creation when Shelly WallDisplay uses external relay as actuator

* More comments

* Wrap condition into function

---------

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-04-25 21:06:52 +02:00
Sid 895f73d8e4
Enable Ruff A001 (#115654) 2024-04-21 23:25:27 +02: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
epenet 9204ccfa17
Use is in ConfigEntryState enum comparison in tests (N-Z) (#114926) 2024-04-05 17:37:00 +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
Maciej Bieniek c8f282c8bc
Improve Shelly RPC device update progress (#114566)
Co-authored-by: Shay Levy <levyshay1@gmail.com>
Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-04-02 10:15:58 +02:00
Shay Levy 3e99afdd54
Cleanup Shelly RGBW light entities (#114410) 2024-03-30 18:48:57 +03: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