281 Commits

Author SHA1 Message Date
Simone Chemelli
74c4553bb0
Increase uptime deviation for Shelly (#142996)
* Increase uptime deviation for Shelly

* fix test

* make troubleshooting easy

* change deviation interval

* increase deviation to 1m
2025-04-19 09:16:38 +00:00
Maciej Bieniek
f702f3efcd
Fix Shelly initialization if device runs large script (#142487)
* Don't check the whole script to see if it generates events

* Fix tests

---------

Co-authored-by: Shay Levy <levyshay1@gmail.com>
2025-04-11 15:34:20 +00:00
Maciej Bieniek
485b28d9ea
Bump aioshelly to version 13.4.1 (#142477)
* Bymp aioshelly to 13.4.1

* Catch InvalidHostError

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2025-04-11 15:34:10 +00:00
Simone Chemelli
f4fa4056ac
Make BT support detection dynamic for Shelly RPC devices (#137323) 2025-03-26 11:17:54 +01:00
Simone Chemelli
8bedf97382
Remove helpers and align coding style in Shelly tests (#140080)
* Cleanup hass.states method in Shelly tests (part 1)

* remove helper functions and align coding style

* missed

* revert unwanted changes

* apply review comment

* apply review comment

* apply review comment

* apply ATTR where missing

* apply walrus

* add missed walrus

* add walrus to entity_registry.async_get

* minor tweak

* align after merge
2025-03-26 10:05:42 +01:00
Maciej Bieniek
95cc3e31f5
Add exceptions translations for Shelly integration (#141071)
* Add exceptions translations

* Improve exception strings for update platform

* Fix tests

* Improve device_communication_error

* Remove error placeholder

* Improve tests

* Fix test_rpc_set_state_errors

* Strings improvement

* Remove `device`

* Remove `entity`

* Fix tests
2025-03-24 17:16:29 +01:00
Wouter
858f0e6657
Fixed issue where the device was already disconnected when setting up the event platform (#140722)
* Changed where the script events are collected to remove any device communication from async_setup_entry

* Implemented improvements and added a test to test whats happends when script_getcode fails

* Renamed script_events to rpc_script_event to make clear this is only for RPC devices

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

---------

Co-authored-by: Shay Levy <levyshay1@gmail.com>
2025-03-21 14:13:56 +02:00
Maciej Bieniek
2785688f57
Add calibrate button for Shelly BLU TRV (#140578)
* Initial commit

* Refactor

* Call async_add_entities() once

* Type

* Cleaning

* `supported` is not needed here

* Add error handling

* Add test

* Fix name

* Change class name

* Change method name

* Move BLU_TRV_TIMEOUT

* Fix BLU_TRV_TIMEOUT import

* Coverage

* Use test snapshots

* Support error translations

* Fix tests

* Introduce ShellyBaseButton class

* Rename press_method to _press_method

* Improve exception strings
2025-03-21 10:14:20 +01:00
Simone Chemelli
12f5bd2aea
Add dedicated sensors for extra_state_attributes in Shelly integration (#140793)
* Add dedicated sensors for extra_state_attributes in Shelly integration

* add tests

* apply review comment

* fix text syntax

* add gas test

* update strings

* add icons
2025-03-18 11:48:18 +01:00
Shay Levy
9b57a831f7
Fix Shelly Air lamp life sensor (#140799) 2025-03-17 17:33:11 +02:00
J. Nick Koston
d69bcc02b0
Pass scanner mode to shelly Bluetooth scanner (#140689)
habluetooth will eventually be able to make better decisions
on how to route data based on the scanning mode.
2025-03-15 12:00:23 -10:00
Simone Chemelli
2fd91e7f9c
Remove unknown from Shelly sensor state (#140597) 2025-03-15 18:10:35 +01:00
Maciej Bieniek
5ea7c113b0
Use test snapshots for Shelly climate (#140582) 2025-03-14 11:15:38 +01:00
Maciej Bieniek
fa57d57215
Fix Shelly diagnostics for devices without WebSocket Outbound support (#140501)
* Don't assume that `ws` is always in config

* Fix device
2025-03-13 20:58:09 +02:00
Simone Chemelli
03aff0d662
Use CONF_* const in Shelly tests (#140189) 2025-03-09 13:07:20 +01:00
J. Nick Koston
d9d47f7203
Migrate shelly Bluetooth scanner to use correct MAC address (#140180) 2025-03-09 13:28:56 +02:00
Simone Chemelli
99b5adaef1
Cleanup add_to_hass method in Shelly tests (part 1) (#140075) 2025-03-07 23:04:49 +01:00
Simone Chemelli
366c5c3f10
Improve unique_id tests for Shelly block devices (#139778)
* Improve unique_id tests for Shelly block devices

* type test

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2025-03-04 14:03:38 -10:00
Simone Chemelli
13918f07d8
Switch cleanup for Shelly (part 2) (#138922)
* Switch cleanup for Shelly (part 2)

* apply review comment

* Update tests/components/shelly/test_climate.py

Co-authored-by: Maciej Bieniek <bieniu@users.noreply.github.com>

* apply review comments

---------

Co-authored-by: Maciej Bieniek <bieniu@users.noreply.github.com>
2025-03-01 22:39:19 +01:00
Maciej Bieniek
7bc0c1b912
Bump aioshelly to version 13.0.0 (#139294)
* Bump aioshelly to version 13.0.0

* MODEL_BLU_GATEWAY_GEN3 -> MODEL_BLU_GATEWAY_G3
2025-02-25 23:52:44 +02:00
Shay Levy
fb5af9acd0
Fix Shelly mock initialization for sleepy RPC device in tests (#139003) 2025-02-21 20:52:10 +02:00
Shay Levy
800f680bd5
Fix Shelly model name for xmod devices (#138984) 2025-02-21 09:53:43 -06:00
Simone Chemelli
901011de7b
Use xmod model info for Shelly XMOD devices (#137013) 2025-02-19 22:47:23 +01:00
J. Nick Koston
46599a4ac4
Bump habluetooth to 3.22.0 (#138812) 2025-02-18 23:50:11 -06:00
J. Nick Koston
8ae52cdc4c
Fix shelly not being able to be setup from user flow when already discovered (#138807)
raise_on_progress=False was missing in the user flow which
made it impossible to configure a shelly by IP when there
was an active discovery because the flow would abort
2025-02-18 22:05:05 +02:00
Erik Montnemery
4b34d1bbb5
Merge config subentry feature branch to dev (#136121)
* Reapply "Add support for subentries to config entries" (#133470) (#136061)

* Reapply "Add support for subentries to config entries" (#133470)

This reverts commit ecb3bf79f32a2e25d141ff467e5958826ed9fc3a.

* Update test snapshot

* Add config subentry support to device registry (#128157)

* Add config subentry support to device registry

* Apply suggestions from code review

* Update syrupy serializer

* Update snapshots

* Address review comments

* Allow a device to be connected to no or a single subentry of a config entry

* Update snapshots

* Revert "Allow a device to be connected to no or a single subentry of a config entry"

This reverts commit ec6f613151cb4a806b7961033c004b71b76510c2.

* Update test snapshots

* Bump release version in comments

* Rename config_subentries to config_entries_subentries

* Add config subentry support to entity registry (#128155)

* Add config subentry support to entity registry

* Update syrupy serializer

* Update snapshots

* Update snapshots

* Accept suggested changes

* Clean registries when removing subentry (#136671)

* Clean up registries when removing subentry

* Update tests

* Clean up subentries from deleted devices when removing config entry (#136669)

* Clean up subentries from deleted devices when removing config entry

* Move

* Add config subentry support to entity platform (#128161)

* Add config subentry support to entity platform

* Rename subentry_id to config_subentry_id

* Store subentry type in subentry (#136687)

* Add reconfigure support to config subentries (#133353)

* Add reconfigure support to config subentries

* Update test

* Minor adjustment

* Rename supported_subentry_flows to supported_subentry_types

* Address review comments

* Add subentry support to kitchen sink (#136755)

* Add subentry support to kitchen sink

* Add subentry reconfigure support to kitchen_sink

* Update kitchen_sink tests with subentry type stored in config entry

* Update kitchen_sink

* Update kitchen_sink

* Adjust kitchen sink tests

* Fix hassfest

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Improve docstrings and strings.json

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2025-02-10 16:40:07 +01:00
Maciej Bieniek
6ff733b225
Set the device class for the Shelly virtual sensor (#137068)
* Map sensor role to the device class

* Add test

* Fix docstring
2025-02-07 17:36:26 +02:00
Maciej Bieniek
aa6fa3cdad
Don't use the current temperature from Shelly BLU TRV as a state for External Temperature number entity (#137658)
Introduce RpcBluTrvExtTempNumber for External Temperature entity
2025-02-07 16:32:28 +01:00
Wouter
6fa87da5bd
Add Shelly script events entities (#135979)
* When an event is received from a script component on a shelly device, this event is send to the hass event bus

* Event emitted from a script will be send to the corresponding event entity

* Added tests for the shelly script event

* The event entity for script are now hidden by default

* Forgot to enable script event entities by default for the test

* Made serveral improvement for the shelly script event entity
- Added device name to event entity
- The event entity is now only created when a script has any event types
- The test for this entity now uses snapshots

* Shelly script event entities will not be create for the BLE scanning script and will now be automatically removed when the script no longer exsists

* Changed variable name to avoid confusion with _id

* Removed old const from first implementation and removed _script_event_listeners and used _event_listeners instead to listen for script events
2025-02-03 22:41:39 +02:00
Shay Levy
2682f4a323
Add tests for Shelly Flood gen4 (#137246) 2025-02-03 17:34:02 +02:00
Maciej Bieniek
ea92523af4
Bump aioshelly to 12.3.2 (#136486)
* Bump aioshelly

* Add timeout parameter for call_rpc

* Increase timeout for BLU TRV

* Log timeout

* Update test

* Use const in test

* Coverage
2025-01-27 18:06:03 +01:00
Maciej Bieniek
5f67461c26
Provide beta release note for Shelly RPC devices (#136154)
* Return beta release note for Shelly RPC devices

* Cleaning

* Fix test

* Move release note check
2025-01-22 21:00:42 +02:00
Maciej Bieniek
57b17472d7
Clean up entity registry imports in Shelly tests (#136159) 2025-01-21 11:47:15 +02:00
Maciej Bieniek
11d44e608b
Add additional entities for Shelly BLU TRV (#135244)
* Add valve position sensor

* Add valve position and external sensor temperature numbers

* Fix method name

* Better name

* Add remove condition

* Add calibration binary sensor

* Add battery and signal strength sensors

* Remove condition from ShellyRpcEntity

* Typo

* Add get_entity_class helper

* Add tests

* Use snapshots in tests
2025-01-21 00:11:20 +02:00
epenet
64500e837f
Use new ServiceInfo location in component tests (part 1) (#136057) 2025-01-20 13:09:34 +01:00
J. Nick Koston
2e5e2c50dd
Ensure Shelly cleanups Bluetooth scanner data upon removal (#135472)
* Add bluetooth API to remove scanners that are no longer used

- Cleanup the advertisment history right away when a scanner is removed

In the future we will do some additional cleanup

* coverage

* finish tests

* Ensure Shelly cleanups Bluetooth scanner data upon removal

needs https://github.com/home-assistant/core/pull/135408
2025-01-12 22:41:21 -05:00
Simone Chemelli
6e1a13f878
Add support for Shelly BLU TRV (#128439)
* feat: add support for Shelly BLU TRV

* chore: apply some fixes

* make BLUTRV a separate device

* apply review comment

* review comments and small optimization

* add HVACMode.OFF

* a couple of fixes

* 2 more fixes

* better approach

* cleanup

* small optimization

* remove cooling as not supported by firmware

* tweaks

* humidity and entity name

* fix naming

* allign async_set_hvac_mode

* align settings

* restore temp

* fix

* remove OFF

* cleanup

* hvac_mode

* add tests

* typo

* more tests

* bump aioshelly
2025-01-09 21:28:36 +01:00
Maciej Bieniek
e43f72c452
Add support for xvoltage sensor for Shelly Plus UNI (#134261)
* Add support for xvoltage sensor

* Cleaning
2025-01-03 15:27:47 +01:00
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