Commit Graph

91 Commits (rc)

Author SHA1 Message Date
Shay Levy 0cff7cbccd
Remove stale Shelly BLU TRV devices (#145994)
* Remove stale Shelly BLU TRV devices

* Add test

* Remove config entry from device
2025-06-11 16:50:11 +00:00
Maciej Bieniek 7f4cc99a3e
Use sub-devices for Shelly multi-channel devices (#144100)
* Shelly RPC sub-devices

* Better varaible name

* Add get_rpc_device_info helper

* Revert channel name changes

* Use get_rpc_device_info

* Add get_rpc_device_info helper

* Use get_block_device_info

* Use helpers in the button platform

* Fix channel name and roller mode for block devices

* Fix EM3 gen1

* Fix channel name for RPC devices

* Revert test changes

* Fix/improve test_block_get_block_channel_name

* Fix test_get_rpc_channel_name_multiple_components

* Fix tests

* Fix tests

* Fix tests

* Use key instead of index to generate sub-device identifier

* Improve logic for Pro RGBWW PM

* Split channels for em1

* Better channel name

* Cleaning

* has_entity_name is True

* Add get_block_sub_device_name() function

* Improve block functions

* Add get_rpc_sub_device_name() function

* Remove _attr_name

* Remove name for button with device class

* Fix names of virtual components

* Better Input name

* Fix get_rpc_channel_name()

* Fix names for Inputs

* get_rpc_channel_name() improvement

* Better variable name

* Clean RPC functions

* Fix input_name type

* Fix test

* Fix entity_ids for Blu Trv

* Fix get_block_channel_name()

* Fix for Blu Trv, once again

* Revert name for reboot button

* Fix button tests

* Fix tests

* Fix coordinator tests

* Fix tests for cover platform

* Fix tests for event platform

* Fix entity_ids in init tests

* Fix get_block_channel_name() for lights

* Fix tests for light platform

* Fix test for logbook

* Update snapshots for number platform

* Fix tests for sensor platform

* Fix tests for switch platform

* Fix tests for utils

* Uncomment

* Fix tests for flood

* Fix Valve entity name

* Fix climate tests

* Fix test for diagnostics

* Fix tests for init

* Remove old snapshots

* Add tests for 2PM Gen3

* Add comment

* More tests

* Cleaning

* Clean fixtures

* Update tests

* Anonymize coordinates in fixtures

* Split Pro 3EM entities into sub-devices

* Make sub-device names more unique

* 3EM (gen1) does not support sub-devices

* Coverage

* Rename "device temperature" sensor to the "relay temperature"

* Update tests after rebase

* Support sub-devices for 3EM (gen1)

* Mark has-entity-name rule as done 🎉

* Rename `relay temperature` to `temperature`
2025-05-26 10:47:22 +02:00
Maciej Bieniek fa1dc75517
Add repair flow for Shelly BLE scanner with unsupported firmware (#143850) 2025-04-30 15:43:07 +02:00
Maciej Bieniek ae3925118c
Do not allow to enable BT scanner for Shelly Gen4 device with Zigbee enabled (#143824)
* Bluetooth is not supported when Zigbee is enabled

* Update tests

* Format
2025-04-29 11:12:34 +03:00
Maciej Bieniek f1b3b0c155
Refactor tests for Shelly config flow (#143517)
* Add mock_setup_entry

* Add mock_setup

* Improve test_form_gen1_custom_port

* Improve test_form_errors_get_info

* Improve test_form_errors_test_connection

* Improve test_reconfigure_with_exception

* Improve test_form_auth_errors_test_connection_gen1

* Improve test_form_auth_errors_test_connection_gen2

* Cleaning

* Upate quality scale

* Always use result variable

* Remove unnecessary async_block_till_done
2025-04-26 13:00:45 +03:00
Maciej Bieniek 06a2de4d1c
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-08 20:53:44 -10: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
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
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
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
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
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 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
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
Simone Chemelli 99a65d3098
Fix update platform for Shelly gen1 devices (#124798) 2024-09-20 15:57:32 +02: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
Shay Levy d2cc25cee6
Prevent connecting to a Shelly device that is already connected (#122105) 2024-07-18 15:27:03 -05: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 3df3e6d081
Use service_calls fixture in shelly tests (#120991) 2024-07-02 10:36:50 +02: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
epenet 08eb8232e5
Fix namespace-import pylint warning in shelly tests (#119349) 2024-06-11 08:08:47 +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
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 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
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
Shay Levy 63275d61a5
Add Shelly RGB/RGBW profiles support (#113808)
* Add Shelly RGB/RGBW profiles support

* Update homeassistant/components/shelly/light.py

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>

* Use walrus in rgbw_key_ids

* Use walrus in light_key_ids

---------

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
2024-03-21 21:04:50 +02:00
Marc Mueller 7d6251ca08
Add empty line after module docstring [tests q-s] (#112711) 2024-03-08 14:47:22 +01:00
Shay Levy c690a9df83
Fix Shelly RPC RSSI sensor removal (#111035) 2024-02-20 21:05:59 -06:00
Simone Chemelli 538ef7764e
Move Shelly thermostat check to status endpoint (#110543)
* Move Shelly thermostat check to status endpoint

* fix key path
2024-02-14 16:36:42 +01:00
Maciej Bieniek 2bd64dba6b
Add `removal_condition` for Shelly analog input sensors (#110331)
* Add remove condition for analog input sensors

* xpercent key is not present in the payload if it has not been configured

---------

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-02-12 20:13:11 +01:00
Maciej Bieniek 8de038527f
Improve type annotation in Shelly tests (#110361)
Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-02-12 10:23:55 -06:00
Maciej Bieniek 4f277b9509
Add pulse counter sensors for Shelly (#110248)
* Add pulse counter sensors to Shelly

* Add a unit for the pulse counter

* Fix removal condition

* xtotal key is not present in the payload if it has not been configured

* Update test

---------

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-02-12 09:42:38 +01:00
Maciej Bieniek b5b09446a1
Add analog input value sensor for Shelly (#109312)
Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-02-07 10:22:00 -06:00
Maciej Bieniek d0384480f5
Test unique IDs for Shelly entities (#109879)
Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
2024-02-07 10:18:00 -06:00
Erik Montnemery aea81a180c
Fix Shelly white light test (#109855) 2024-02-07 15:39:49 +01:00
Simone Chemelli 6174aa4e59
Remove Shelly RSSI sensor if Wi-FI is not configured (#108390)
* Remove Shelly RSSI sensor if Wi-FI is not configured

* fix tests
2024-01-30 21:18:54 +01:00
Simone Chemelli 075dab250e
Code quality for Shelly tests (#109054)
* Code quality for Shelly tests

* clean-up
2024-01-29 16:02:51 +01:00
Maciej Bieniek 35b733fa2c
Bump `aioshelly` to version 7.0.0 (#105384)
* Remove get_rpc_device_sleep_period() function

* Bump aioshelly version to 7.0.0

* Remove firmware compatibility check from BLE scanner

* Remove firmware compatibility check from light transition

* Update default fw ver

* Use LightEntityFeature in tests
2023-12-09 17:12:05 +02:00
Maciej Bieniek b7bf1e9f3f
Make Shelly Wall Display thermostat implementation compatible with firmware 1.2.5 (#104812) 2023-11-30 17:26:07 +01:00
Maciej Bieniek 14387cf94b
Remove Shelly Wall Display switch entity only if the relay is used as the thermostat actuator (#104506) 2023-11-26 14:46:29 +01:00