66 Commits

Author SHA1 Message Date
Joost Lekkerkerker
3175c149c6 Add integration_type device to mpd (#159699) 2025-12-25 13:53:20 +01:00
Robert Resch
96f84b2b99 Sort homeassistant json files (#155285) 2025-10-28 10:33:10 +01:00
Erik Montnemery
f83c8de8d3 Update signature of platforms' async_setup_entry (#138201) 2025-02-10 21:08:03 +01:00
epenet
ccdcba97b5 Standardize homeassistant imports in component (l-m) (#136827) 2025-01-29 11:56:40 +01:00
Noah Husby
104151d322 Remove deprecated YAML import from MPD (#134459) 2025-01-02 16:08:33 +01:00
epenet
6b0428774d Standardize import step variable name (part 2) (#124679) 2024-08-27 11:22:35 +02:00
Carlos Gustavo Sarmiento
b392d61391 Update MPD Player to use HOST and PORT to detect duplicate configs (#123410)
* Allow Monetary device_class to accept `Measurement` state_class

* Update MPD Player to use HOST and PORT to detect duplicate configs
2024-08-11 18:50:11 +02:00
Joost Lekkerkerker
ef237a8431 Fix MPD issue creation (#123187) 2024-08-05 15:07:01 +02:00
Joost Lekkerkerker
17172d841c Fix MPD config flow (#121431) 2024-07-07 14:54:29 +02:00
Joost Lekkerkerker
d423dae8ac Fix unknown attribute in MPD (#120657) 2024-06-27 19:41:21 +02:00
Joost Lekkerkerker
7ef1db0549 Fix release in MPD issue (#120545) 2024-06-26 12:52:31 +02:00
epenet
36d8ffa79a Force alias when importing media player PLATFORM_SCHEMA (#120537) 2024-06-26 12:19:04 +02:00
Joost Lekkerkerker
5a0841155e Add unique_id to MPD (#120495) 2024-06-26 09:28:11 +02:00
Joost Lekkerkerker
b26f613d06 Add config flow to MPD (#117907) 2024-06-09 16:01:19 +02:00
Marc Mueller
59a6035d3f Add empty line after module docstring [j-m] (#112700) 2024-03-08 09:01:29 -05:00
Marc Mueller
a9147cf3dd Use builtin TimeoutError [k-n] (#109681) 2024-02-05 12:08:18 +01:00
Cyrille
030b1bc0e8 Upgrade python-mpd2 to v3.1.1 (#108143) 2024-01-16 23:01:01 +01:00
Thijs Putman
360ef894a7 Use non-persistent connection for MPD (#94507)
* Do not use a persistent connection to MPD

In other words, don't rely on the connection management provided by
"python-mpd2". Instead of keeping the connection to MPD open, we
explicitly connect before and disconnect after each command.

There is probably a bit of overhead to this, but as the integration
uses a local-polling approach to begin with, no functionality is lost or
degraded.

This change greatly hardens the MPD integration against both network
issues and problems with the daemon itself. All connection-related
failure modes have effectively been removed.

* Update state retrieval methods

Only "async_get_media_image" attempts to connect, all others are either
called from there, or from the main "async_update" method (see previous
commit) which also attempts to connect.

So, this commit mainly revolves around gracefully handling situations
where no connection is available when trying to retrieve MPD state.

Finally, note the removal of "self._commands". This property is only
used at the start of "_async_get_file_image_response" and was thus
changed into a local variable.

* Update media-player control methods

These all need to explicitly connect to MPD as part of their flow.

* Correct ruff failure (auto-fixed)

* Use "async_timeout.timeout" context manager

* Minor changes

* Replace "async_timeout" with "asyncio.timeout"

* Initialise "self._status" to empty dictionary

Used to be initialised as None, which caused "NoneType is not iterable"
type of issues in case of an unexpected disconnect (at which point
status gets set to None again). Instead of guarding against None
everywhere, using an empty dictionary seemed more prudent...

Furthermore, more cautiously access its members to prevent potential
KeyError-s in similar cases.

* Fix livelock in "async_mute_volume()"

This method doesn't need a connection; it calls into two other methods
that actually connect to MPD – attempting to connect from here resulted
in a livelock.
2023-11-27 18:35:46 +01:00
Ville Skyttä
34b47a2597 Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
epenet
f56bf134d2 Improve browse_media type hints in media player (#90060)
* Improve browse_media type hints in media player

* Adjust components

* Adjust base entity
2023-03-24 21:49:12 -07:00
epenet
4836404288 Improve media_player type hints in integrations (#90029)
Fix some media_player type hints
2023-03-21 11:10:12 +01:00
Erik Montnemery
1d64ba9d34 Sort manifests 6 (#87027) 2023-02-08 20:38:43 +01:00
epenet
6f05a74686 Enforce MediaPlayerEntityFeature (#82462) 2022-11-22 07:15:37 +01:00
epenet
18e30e7c06 Adjust type hints for MediaPlayerEntityFeature (#82258) 2022-11-17 13:58:34 +01:00
epenet
2f8af92735 Use new media player enums [m-o] (#78057) 2022-09-08 22:47:59 +02:00
epenet
6355e682fa Improve entity type hints [m] (#77816) 2022-09-05 10:59:36 +02:00
Erik Montnemery
47d0cc9b09 Update integrations to pass target player when resolving media (#72597) 2022-05-27 09:05:06 -07:00
Fabian Affolter
93b714a978 Remove myself from Music Player Daemon codeowners (#69963) 2022-04-13 16:07:41 +02:00
Paulus Schoutsen
9e5c1e37c0 Not all music are URLs (#69936) 2022-04-12 14:50:07 -07:00
azrdev
afd21e4084 Update python-mpd2 to 3.0.5 (#69304) 2022-04-10 14:16:23 +02:00
epenet
5e2cc2b9b0 Use EntityFeature enum in components (m**) (#69414)
* Use EntityFeature in melcloud

* Use EntityFeature in mystrom

* Use EntityFeature in mysensors

* Use EntityFeature in myq

* Use EntityFeature in mpd

* Use EntityFeature in monoprice

* Use EntityFeature in moehlenhoff_alpha2

* Use EntityFeature in modern_forms

* Use EntityFeature in modbus

* Use EntityFeature in melissa

* Use EntityFeature in mediaroom

* Use EntityFeature in maxcube

* Use EntityFeature in manual_mqtt

* Fix maxcube tests

* Revert "Use EntityFeature in modbus"

This reverts commit 56cf9d900d.

* Revert "Use EntityFeature in myq"

This reverts commit 44a31b1a03.

* Revert "Use EntityFeature in mystrom"

This reverts commit 7260ee0384.

* Revert "Revert "Use EntityFeature in modbus""

This reverts commit 916a612a60.

* Revert "Revert "Use EntityFeature in myq""

This reverts commit a6be42fa17.
2022-04-06 17:33:41 +02:00
yoedf
88780b4c87 Add duration support for streaming in mpd (#66110)
* Add duration support for streaming in mpd

* Change to use 1 line instead of if

* Improve code to be more readable
2022-03-29 11:36:05 +03:00
patagona
e85fb87438 Handle MPD songs with multiple artists (#68759) 2022-03-29 09:10:21 +02:00
Paulus Schoutsen
84c460ce78 Add media source support to mpd (#67565) 2022-03-04 15:44:57 +01:00
patagona
facf22c2dd Correctly handle missing mpd albumart (#66771)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-02-23 18:21:20 +01:00
J. Nick Koston
5b755b74fb Add loggers to integration manifest.json (#65083) 2022-01-28 13:37:53 -08:00
epenet
1519aa202d Add media_player setup type hints [m-x] (#63298)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-03 16:09:34 +01:00
Marc Mueller
be201e3ebe Use assignment expressions 27 (#58188) 2021-10-22 11:29:21 +02:00
Franck Nijhof
f17a5f0db9 Clean up redudant exceptions from handlers (#51741) 2021-06-11 13:29:50 +02:00
Franck Nijhof
055cdc64c0 Add support for IoT class in manifest (#46935) 2021-04-15 10:21:38 +02:00
Franck Nijhof
6932cf9534 Use contextlib.suppress where possible (#48189) 2021-03-23 14:36:43 +01:00
Martin Weinelt
61a987061e Don't log missing mpd artwork inappropriately (#45908)
This can get unnecessarily spammy and doesn't represent an actual
actionable issue.

Fixes: #45235
2021-02-04 08:18:51 -05:00
Klaudiusz Staniek
d4b3cf9c47 Fix the use of muted volume if not previously set in mpd (#45018) 2021-01-16 22:40:59 +01:00
Martin Weinelt
cecb711fe5 Update python-mpd2 to 3.0.3 (#45141)
Fixes: #44931
2021-01-16 20:45:54 +01:00
Martin Weinelt
f8df8b6b19 Add album art support in the mpd component (#44527)
* Add album art support in the mpd component

Uses `readpicture` to retrieve embedded artwork and `albumart` to
acquire cover art located in the media directory.

As the mpd component supports multiple different implementations (think
mopidy, PI MusicBox, etc.) we check for the availability of each command
before using them.

Tested against mpd 0.22.3, which includes support for both.

* fixup! Add album art support in the mpd component
2020-12-26 22:18:28 +01:00
Martin Weinelt
fa69daf5b3 Convert mpd component to use the async MPDClient (#44384)
Upgrades python-mpd2 to 3.0.1.
2020-12-25 21:49:30 +01:00
Crash
8979c4987f Clear mpd source playlist when not playing a playlist (#44164)
Prevents unexpected behavior.
2020-12-13 12:10:51 +01:00
9R
0c9189af0a Add set and check repeat mode to mpd component (#42808)
Co-authored-by: Anders Melchiorsen <amelchio@nogoto.net>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2020-11-10 12:56:04 +01:00
Chris Talkington
30de984827 Check mpd time type before splitting it (#40139) 2020-09-17 16:01:28 +02:00
Chris Talkington
a9cc882394 Improve mpd media position handling (#39390)
* improve mpd media position handling

* Update media_player.py

* Update media_player.py

* Update media_player.py
2020-09-03 12:23:02 -05:00