Commit graph

764 commits

Author SHA1 Message Date
Simone Chemelli
73929e6791
Avoid Shelly data update during shutdown (#130301) 2024-11-10 20:11:42 +01:00
Erik Montnemery
2d2f55a4df
Report update_percentage in shelly update entity (#129382)
Co-authored-by: Shay Levy <levyshay1@gmail.com>
2024-11-07 08:52:20 +01:00
epenet
d6e73a89f3
Cleanup unnecessary __init__ method in OptionsFlow (#129651)
* Cleanup unnecessary init step in OptionsFlow

* Increase coverage
2024-11-02 18:15:41 +01:00
Shay Levy
2509f18def
Bump aioshelly to 12.0.1 (#129453) 2024-10-29 22:01:38 +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
epenet
fbec61662b
Use reauth/reconfigure helpers in shelly config flow (#128019) 2024-10-09 22:05:45 +03:00
Shay Levy
963bba63d0
Bump aioshelly to 12.0.0 (#127884) 2024-10-08 02:05:23 +03: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
J. Nick Koston
0f29fd3e10
Switch to using fast cached_property implementation in propcache (#127339) 2024-10-03 13:11:02 -05:00
epenet
c658dc0ffc
Correct reconfigure flows to get data from config entry (#127393)
Fetch entry data in async_step_reconfigure
2024-10-03 09:46:41 +02:00
epenet
9219339762
Use _get_reauth/reconfigure_entry in shelly (#127308) 2024-10-02 16:12:45 +02:00
epenet
46405d7738
Improve type hints in config_flow reconfigure step (#127224) 2024-10-01 22:21:54 +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
epenet
6ef1dd56f5
Use root import for device_automation (#125836) 2024-09-12 17:01:25 +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
Shay Levy
99f43400bf
Bump aioshelly to 11.4.2 (#125036) 2024-09-01 11:08:19 -10: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
J. Nick Koston
f9bf7f7e05
Small cleanups to shelly (#124758) 2024-08-27 21:00:31 -10:00
J. Nick Koston
a63c5e6725
Cache shelly coordinator properties that never change (#124756) 2024-08-27 21:00:20 -10:00
J. Nick Koston
5bd17c9198
Bump aioshelly to 11.3.0 (#124741) 2024-08-27 12:34:30 -10: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
J. Nick Koston
d8cbb3540f
Bump aioshelly to 11.2.4 (#124080) 2024-08-19 19:13:35 -05: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
Maciej Bieniek
a040f1a9d1
Bump aioshelly to version 11.2.0 (#123602)
Bump aioshelly to version 11.2.0
2024-08-11 20:56:12 +03:00
Shay Levy
8687c32c15
Ignore Shelly IPv6 address in zeroconf (#123081) 2024-08-02 21:56:49 +03:00
epenet
5e1cca1c58
Fix implicit-return in shelly (#122926) 2024-07-31 14:54:52 +02:00
huettner94
eb3686af06
Add shelly overcurrent sensor for switches (#122494)
shelly: add overcurrent sensor for switches

just like overvoltage shelly switches can react to overcurrent and
diable the switch. Unfortunately this is is not mentioned anywhere in
the documentation.
It can be triggered by a device using more amps than set in
"Output protections" under the name "Overcurrent in amperes".
2024-07-25 21:22:18 +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
14ec7e5f76
Set DeviceInfo.model_id in Shelly integration (#122040) 2024-07-17 09:04:40 +02: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
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
Shay Levy
cdb26ef8a3
Cleanup Shelly unused strings for removed valve switch (#121813) 2024-07-12 05:44:25 +01: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
Shay Levy
b5367e5994
Fix Shelly device shutdown (#120881) 2024-07-01 19:06:56 +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
d8ab2debfd
Add last_error reporting to Shelly diagnostics (#120595) 2024-06-26 21:35:23 +03:00
Shay Levy
ed1eb8ac9c
Change Shelly connect task log message level to error (#120582) 2024-06-26 18:19:28 +02:00