Commit Graph

35 Commits (033064f83217e920000c8d3b6521f7511a1d3c69)

Author SHA1 Message Date
Markus Jacobsen 2054988790
Add Bang & Olufsen button Event entities (#127550)
* Add button events

* Remove unused common keys
Rename Preset to Favourite

* Add event testing

* Add check for Beoconnect Core

* Rename device controls

* Add test for Beoconnect core event entity creation

* Fix config entry type

* Add a type checking check before assertion

* Add icon translations

* Remove useless defined icons

* Remove base event class

* Update homeassistant/components/bang_olufsen/event.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

---------

Co-authored-by: Josef Zweck <josef@zweck.dev>
2024-12-31 21:55:24 +01:00
Erik Montnemery ecb3bf79f3
Revert "Add support for subentries to config entries" (#133470)
Revert "Add support for subentries to config entries (#117355)"

This reverts commit ad15786115.
2024-12-18 13:51:05 +01:00
Erik Montnemery ad15786115
Add support for subentries to config entries (#117355)
* Add support for subentries to config entries

* Improve error handling and test coverage

* Include subentry_id in subentry containers

* Auto-generate subentry_id and add optional unique_id

* Tweak

* Update tests

* Fix stale docstring

* Address review comments

* Typing tweaks

* Add methods to ConfigEntries to add and remove subentry

* Improve ConfigSubentryData typed dict

* Update test snapshots

* Adjust tests

* Fix unique_id logic

* Allow multiple subentries with None unique_id

* Add number of subentries to config entry JSON representation

* Add subentry translation support

* Allow integrations to implement multiple subentry flows

* Update translations schema

* Adjust exception text

* Change subentry flow init step to user

* Prevent creating a subentry with colliding unique_id

* Update tests

* Address review comments

* Remove duplicaetd unique_id collision check

* Remove change from the future

* Improve test coverage

* Add default value for unique_id
2024-12-12 20:16:18 +01:00
Markus Jacobsen d4546c94b0
Add beolink_join source_id parameter to Bang & Olufsen (#132377)
* Add source as parameter to beolink join service

* Add beolink join source and responses

* Improve comment
Add translation

* Remove result from beolink join custom action

* Cleanup

* Use options selector instead of string for source ID
Fix test docstring

* Update options

* Use translation dict for source ids
Add input validation
Add tests for invalid sources
Improve source id description

* Use list instead of translation dict
Remove platform prefixes
Add test for Beolink Converter source

* Fix source_id naming and order
2024-12-10 11:01:12 -06:00
Markus Jacobsen a97eeaf189
Add Bang & Olufsen diagnostics (#131538)
* Add diagnostics

* Add tests for diagnostics

* Add media_player diagnostics

* Use media_player entity's state instead of registryentry

* Update tests

* Reorganize code
Remove context from media_player state

* Fix dict being read only
Simplify naming
Update test snapshot

* Update test snapshot
2024-11-26 20:56:36 -05:00
Markus Jacobsen f04c50c59e
Fix Bang & Olufsen WebSocket debug log and test (#131671)
* Fix test and debug message

* Reorder dict order
2024-11-26 20:48:46 -05:00
Markus Jacobsen ad19c5f9c1
Remove Bang & Olufsen static icon (#131528) 2024-11-26 09:23:08 +01:00
Markus Jacobsen 31b505828b
Simplify Bang & Olufsen source determination (#130072) 2024-11-09 17:13:07 +01:00
Markus Jacobsen e3dfa84d65
Bang & Olufsen add beolink grouping (#113438)
* Add Beolink custom services
Add support for media player grouping via beolink
Give media player entity name

* Fix progress not being set to None as Beolink listener
Revert naming changes

* Update API
simplify Beolink attributes

* Improve beolink custom services

* Fix Beolink expandable source check
Add unexpand return value
Set entity name on initialization

* Handle entity naming as intended

* Fix "null" Beolink self friendly name

* Add regex service input validation
Add all_discovered to beolink_expand service
Improve beolink_expand response

* Add service icons

* Fix merge
Remove unnecessary assignment

* Remove invalid typing
Update response typing for updated API

* Revert to old typed response dict method
Remove mypy ignore line
Fix jid possibly used before assignment

* Re add debugging logging

* Fix coroutine
Fix formatting

* Remove unnecessary update control

* Make tests pass
Fix remote leader media position bug
Improve remote leader BangOlufsenSource comparison

* Fix naming and add callback decorators

* Move regex service check to variable
Suppress KeyError
Update tests

* Re-add hass running check

* Improve comments, naming and type hinting

* Remove old temporary fix

* Convert logged warning to raised exception for invalid media_player
Simplify code using walrus operator

* Fix test for invalid media_player grouping

* Improve method naming

* Improve _beolink_sources explanation

* Improve _beolink_sources explanation

* Fix tests

* Remove service responses
Fix and add tests

* Change service to action where applicable

* Show playback progress for listeners

* Fix testing

* Remove useless initialization

* Fix allstandby name

* Fix various casts with assertions
Fix comment placement
Fix group leader group_members rebase error
Replace entity_id method call with attribute

* Add syrupy snapshots for Beolink tests, checking entity states
Use test JIDs 3 and 4 instead of 2 and 3 to avoid invalid attributes in testing

* Add sections for fields using Beolink JIDs directly

* Fix typo

* FIx rebase mistake

* Sort actions alphabetically
2024-11-08 12:06:29 +01:00
Markus Jacobsen f6f89bd807
Update Bang & Olufsen source list as availability changes (#129910) 2024-11-06 11:52:00 +01:00
Markus Jacobsen 40b561ea69
Add shuffle media controls to Bang & Olufsen (#129325) 2024-10-28 13:39:49 +01:00
Markus Jacobsen 6c365fffde
Add media seek for sources other than Deezer for Bang & Olufsen (#128661)
* Add seeking for sources other than Deezer

* Add is_seekable attribute to fallback sources and BangOlufsenSource
Add testing

* Update comment

* Use support flags instead of raising errors when seeking on incompatible source
2024-10-25 23:34:39 +02:00
Markus Jacobsen 66ca424d3a
Add repeat media controls to Bang & Olufsen (#128170)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-10-25 20:10:08 +02:00
epenet 5a0e47be48
Use runtime_data in bang_olufsen (#129037) 2024-10-23 18:21:25 +02:00
Markus Jacobsen 9037421a85
Bump mozart-api to 4.1.1.116.0 (#128573)
Bump API
Fix testing
2024-10-17 22:05:28 -04:00
Markus Jacobsen bb29c7a02f
Add sound modes to Bang & Olufsen devices (#121209)
* Add sound mode functionality

* Fix naming

* Change unique sound mode symbol

* Add testing for sound modes

* Add test typing

* Use constants for service call parameters

* Add state assertions

* Remove invalid decorator

* Add valid sound mode check

* Add test for invalid sound mode
2024-09-25 15:58:24 +02:00
Markus Jacobsen a8648b7cdc
Add Bang & Olufsen media_player grouping (#123020)
* Add Beolink custom services
Add support for media player grouping via beolink
Give media player entity name

* Fix progress not being set to None as Beolink listener
Revert naming changes

* Update API
simplify Beolink attributes

* Improve beolink custom services

* Fix Beolink expandable source check
Add unexpand return value
Set entity name on initialization

* Handle entity naming as intended

* Fix "null" Beolink self friendly name

* Add regex service input validation
Add all_discovered to beolink_expand service
Improve beolink_expand response

* Add service icons

* Fix merge
Remove unnecessary assignment

* Remove invalid typing
Update response typing for updated API

* Revert to old typed response dict method
Remove mypy ignore line
Fix jid possibly used before assignment

* Re add debugging logging

* Fix coroutine
Fix formatting

* Remove unnecessary update control

* Make tests pass
Fix remote leader media position bug
Improve remote leader BangOlufsenSource comparison

* Fix naming and add callback decorators

* Move regex service check to variable
Suppress KeyError
Update tests

* Re-add hass running check

* Improve comments, naming and type hinting

* Remove old temporary fix

* Convert logged warning to raised exception for invalid media_player
Simplify code using walrus operator

* Fix test for invalid media_player grouping

* Improve method naming

* Improve _beolink_sources explanation

* Improve _beolink_sources explanation

* Add initial media_player grouping

* Convert custom service methods to media_player methods
Fix testing

* Remove beolink JID extra state attribute

* Modify custom services to only work as expected for media_player grouping
Fix tests

* Remove unused dispatch

* Remove wrong comment

* Remove commented out code

* Add config entry mock typing

* Fix beolink listener playback progress
Fix formatting
Add and use get_serial_number_from_jid function

* Fix testing

* Clarify beolink WebSocket notifications

* Further clarify beolink WebSocket notifications

* Convert notification value to enum value

* Improve comments for touch to join

* Fix None being cast to str if leader is not in HA

* Add error messages to devices in Beolink session and not Home Assistant
Rework _get_beolink_jid

* Replace redundant function call

* Show friendly name for unavailable remote leader instead of JID

* Update homeassistant/components/bang_olufsen/media_player.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Remove unneeded typing

* Rework _get_beolink_jid entity check
Clarify invalid entity error message

* Remove redundant "entity" from string

* Fix invalid typing
fix state assertions

* Fix raised error type

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-09-16 12:16:15 +02:00
Markus Jacobsen 3ea4c3b8bf
Fix malformed response in Bang & Olufsen testing (#125658)
Fix malformed SoftwareUpdateStatus object
2024-09-10 15:36:25 +02:00
Markus Jacobsen 31aef86c0f
Add various assertions to Bang & Olufsen testing (#125429)
Add various assertions
2024-09-08 12:22:21 +02:00
Markus Jacobsen 943b96e7a1
Fix Bang & Olufsen testing typing (#125427)
* Fix test parameter typed as callable instead of context manager

* Add missing AsyncMock typing
2024-09-08 12:18:32 +02:00
Markus Jacobsen 741add0666
Replace strings with constants in Bang & Olufsen testing (#125423)
Replace strings with constants in service calls
2024-09-06 18:09:43 +02:00
Markus Jacobsen 5dc03752ca
Add type hinting to Bang & Olufsen test (#124423) 2024-08-24 12:59:08 +02:00
Markus Jacobsen 890c6e97fd
Add Bang & Olufsen websocket testing (#123075)
* Add websocket.py testing
Convert media_player testing dispatch events to the proper websocket events

* Fix WebSocket testing by using callbacks

* Add typing

* Add caplog checking
Check dispatch events directly
Check event bus directly
Avoid using internals

* Fix event and / dispatch callbacks not necessarily being checked

* Remove unnecessary caplog log level handling
2024-08-22 16:31:15 +02:00
Markus Jacobsen 2337c3ff69
Improve Bang olufsen test typing and parameter order (#124419)
* Add proper media_player typing to tests

* Add proper typing to init tests

* Add proper typing to config_flow tests

* Fix order of parameters of tests

* Add more typing
Reorder parameters
2024-08-22 15:49:42 +02:00
Markus Jacobsen d86b816491
Convert Bang & Olufsen testing logging patches to caplog (#124366)
* Convert logging patches to caplog

* Remove unnecessary caplog log level handling
2024-08-21 17:11:01 +02:00
Markus Jacobsen 20c4f84a4e
Fix incorrect Bang & Olufsen MDNS announcements (#122782) 2024-07-29 22:04:54 +02:00
Markus Jacobsen 45843a3112
Add Bang & Olufsen media_player testing (#120580) 2024-07-08 22:19:02 +02:00
Markus Jacobsen 1962759953
Add Bang olufsen init testing (#119834) 2024-06-21 07:35:38 +01:00
Marc Mueller 279483ddb0
Import Generator from typing_extensions (2) (#118989) 2024-06-06 17:24:22 +02:00
Joost Lekkerkerker 9b41e3d124
Use is in enum comparison in config flow tests A-E (#114669) 2024-04-02 11:22:05 -10: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
Marc Mueller aa16a9d707
Add empty line after module docstring (3) (#112750) 2024-03-08 20:38:34 +01:00
Marc Mueller 38adfbf1a3
Add empty line after module docstring [tests a-e] (#112708) 2024-03-08 08:50:25 -05:00
Joost Lekkerkerker c1d45f63f5
Fix Bang and olufsen naming (#111344)
* Fix Bang and olufsen naming

* Fix

* Fix tests

* Fix tests
2024-03-07 20:15:52 +01:00
Markus Jacobsen 1d7e0e7fe4
Add bang_olufsen integration (#93462)
* Add bangolufsen integration

* add untested files to .coveragerc

* Simplify integration to media_player platform

* Remove missing files from .coveragerc

* Add beolink_set_relative_volume custom service
Tweaks

* Remove custom services
Remove grouping as it was dependent on custom services

* Update API to 3.2.1.150.0
Reduce and optimize code with feedback from joostlek
Tweaks

* Updated testing

* Remove unused options schema

* Fix bugfix setting wrong state

* Fix wrong initial state

* Bump API

* Fix Beosound Level not reconnecting properly

* Remove unused constant

* Fix wrong variable checked to determine source

* Update integration with feedback from emontnemery

* Update integration with feedback from emontnemery

* Remove unused code

* Move API client into dataclass
Fix not all config_flow exceptions caught
Tweaks

* Add Bang & Olufsen brand

* Revert "Add Bang & Olufsen brand"

This reverts commit 57b2722078.

* Remove volume options from setup
Simplify device checks
rename integration to bang_olufsen
update tests to pass
Update API

* Remove _device from base
Add _device to websocket

* Move SW version device update to websocket
Sort websocket variables

* Add WebSocket connection test

* Remove unused constants

* Remove confirmation form
Make discovered devices get added to Home Assistant immediately
Fix device not being available on mdns discovery
Change config flow aborts to forms with error

* Update tests for new config_flow
Add missing api_exception test

* Restrict manual and discovered IP addresses to IPv4

* Re-add confirmation step for zeroconf discovery
Improve error messages
Move exception mapping dict to module level

* Enable remote control WebSocket listener

* Update tests
2024-01-24 12:00:51 +01:00