Commit Graph

243 Commits (19e6867f1ae078d84ff3e1973d703c4b86504b89)

Author SHA1 Message Date
Shay Levy f94e80d4c1
Fix missing Shelly MAC address checks (#130833)
* Fix missing Shelly MAC address checks

* Make new error for mac_address_mismatch

* Use reference in translation
2024-11-18 01:34:33 +02:00
Erik Montnemery e861cab727
Add update_percentage state attribute to update entity (#128877)
* Add update_percentage state attribute to update entity

* Update tests

* Update tests
2024-10-21 15:31:48 +02:00
epenet 25aea140be
Cleanup unnecessary reconfigure_confirm from config flows (#128086) 2024-10-14 12:57:15 +02:00
Simone Chemelli e4f7ac6236
Add switch entity for Shelly scripts (#108171)
* introduce script switch only

* chore: add script switch test

* chore: apply review comments

* chore: fix tests

* chore: apply review comments
2024-10-13 15:11:40 +02:00
G Johansson 666e8e133e
Cover state is enum (#127144)
* Change light state to use enum

* Adjust cover tests

* Update cover

* Fix covers

* Some tests

* More tests

* Fix tests

* Fix
2024-10-08 18:39:04 +02:00
Maciej Bieniek 1290f18ed4
Add support for Shelly CCT light (#126989)
* Initial support for cct lights

* Move properties to the RpcShellyCctLight class

* Fix entity names

* Add async_remove_orphaned_entities() function

* Do not return

* Fix tests

* Combine async_remove_orphaned_virtual_entities and async_remove_orphaned_entities

* Remove SHELLY_PLUS_RGBW_CHANNELS from const

* Add tests

* Use _attr*

* Check ColorMode.COLOR_TEMP

* Add sensors for CCT light

* Remove removal condition

* Remove orphaned sensors

* Cleaning

* Add device temperature sensor for CCT light

* Simplify async_remove_orphaned_entities()

* Comment

* Add COMPONENT_ID_PATTERN const

* Call async_add_entities once

* Suggested change

* Better type for keys

* Do not call keys()
2024-10-04 08:49:35 +02:00
epenet 9873371413
Use start_reconfigure_flow in config flow tests (#127191)
* Use start_reconfigure_flow in config flow tests

* Adjust fritz
2024-10-02 10:01:15 +02:00
G Johansson c6a1b9fc39
Change Climate set temp action for incorrect feature will raise (#126692)
* Change Climate set temp action for incorrect feature will raise

* Fix some tests

* Fix review comments

* Fix tesla_fleet

* Fix tests

* Fix review comment
2024-09-25 21:16:14 +02:00
Erik Montnemery d82bff1bc2
Index config entry discovery_keys by discovery domain (#126563)
* Index config entry discovery_keys by discovery domain

* Add new signal

* Update tests

* Update homeassistant/config_entries.py

Co-authored-by: J. Nick Koston <nick@koston.org>

* Fix imports

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-09-23 21:48:11 +02:00
Erik Montnemery b2982c18bb
Reinitialize zeroconf discovery flow on unignore (#125753)
* Reinitialize zeroconf discovery flow on unignore

* Adjust tests

* Improve comments

* Fix logic for updating discovery keys

* Add tests

* Use mock_config_flow helper in new config_entries test

* Add discovery_keys attribute to ConfigEntry

* Update zeroconf rediscovery

* Change type of ConfigEntry.discovery_keys

* Update tests

* Fix DiscoveryKey.from_json_dict and add tests

* Fix test

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-09-23 16:49:21 +02:00
G Johansson 939f2e41e9
Change valve state to an enum (#126428) 2024-09-23 14:20:18 +02:00
Maciej Bieniek efc1ff6eff
Fix Shelly update entity names (#126512) 2024-09-23 14:18:24 +02:00
Simone Chemelli 99a65d3098
Fix update platform for Shelly gen1 devices (#124798) 2024-09-20 15:57:32 +02:00
Maciej Bieniek 6906ee0e48
Improve Shelly RPC entity naming (#125415)
* Fix default names for cover entities

* Drop component index if only one component exists

* Improve doc strings

* Use more consistent naming

* Typo

* Revert removing index 0 from entity names

* Improve names for RGB(W) lights
2024-09-15 11:29:26 +02:00
Maciej Bieniek da401cafdf
Add support for cover tilt for Shelly 2PM Gen3 (#125717)
* Add support for tilt

* Fix config

* Add test

* Increase test coverage
2024-09-12 09:28:36 +02:00
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