@PolarLava, thanks for the heads-up and the detailed info, I’ve pushed an update after tests on version 2021.3.4
@ed0zer there’s been some more changes again to HA that’s now spitting out deprecation warnings:
Testing configuration at /config
WARNING:homeassistant.components.media_player.const:MEDIA_TYPE_MUSIC was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaType.MUSIC instead, please report it to the author of the 'foobar' custom integration
WARNING:homeassistant.components.media_player.const:SUPPORT_VOLUME_STEP was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaPlayerEntityFeature.VOLUME_STEP instead, please report it to the author of the 'foobar' custom integration
WARNING:homeassistant.components.media_player.const:SUPPORT_TURN_ON was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaPlayerEntityFeature.TURN_ON instead, please report it to the author of the 'foobar' custom integration
WARNING:homeassistant.components.media_player.const:SUPPORT_TURN_OFF was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaPlayerEntityFeature.TURN_OFF instead, please report it to the author of the 'foobar' custom integration
WARNING:homeassistant.components.media_player.const:SUPPORT_STOP was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaPlayerEntityFeature.STOP instead, please report it to the author of the 'foobar' custom integration
WARNING:homeassistant.components.media_player.const:SUPPORT_SELECT_SOURCE was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaPlayerEntityFeature.SELECT_SOURCE instead, please report it to the author of the 'foobar' custom integration
WARNING:homeassistant.components.media_player.const:SUPPORT_SEEK was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaPlayerEntityFeature.SEEK instead, please report it to the author of the 'foobar' custom integration
WARNING:homeassistant.components.media_player.const:SUPPORT_VOLUME_SET was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaPlayerEntityFeature.VOLUME_SET instead, please report it to the author of the 'foobar' custom integration
WARNING:homeassistant.components.media_player.const:SUPPORT_VOLUME_MUTE was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaPlayerEntityFeature.VOLUME_MUTE instead, please report it to the author of the 'foobar' custom integration
WARNING:homeassistant.components.media_player.const:SUPPORT_PLAY was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaPlayerEntityFeature.PLAY instead, please report it to the author of the 'foobar' custom integration
WARNING:homeassistant.components.media_player.const:SUPPORT_PREVIOUS_TRACK was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaPlayerEntityFeature.PREVIOUS_TRACK instead, please report it to the author of the 'foobar' custom integration
WARNING:homeassistant.components.media_player.const:SUPPORT_NEXT_TRACK was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaPlayerEntityFeature.NEXT_TRACK instead, please report it to the author of the 'foobar' custom integration
WARNING:homeassistant.components.media_player.const:SUPPORT_PAUSE was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaPlayerEntityFeature.PAUSE instead, please report it to the author of the 'foobar' custom integration
WARNING:homeassistant.components.media_player.const:SUPPORT_SHUFFLE_SET was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaPlayerEntityFeature.SHUFFLE_SET instead, please report it to the author of the 'foobar' custom integration
For the most part it’s just dropping the “SUPPORT_” prefixes on the constants in media_player.py. In the case of MEDIA_TYPE_MUSIC, changing it to “MUSIC” as it recommends results in a warning…
Testing configuration at /config
Incorrect config
General Warnings:
- Platform error 'media_player' from integration 'foobar' - cannot import name 'MUSIC' from 'homeassistant.components.media_player.const' (/usr/src/homeassistant/homeassistant/components/media_player/const.py)
Successful config (partial)
General Warnings:
So just going back to “MEDIA_TYPE_MUSIC” you get the deprecation warning (twice?) as well as the error…
Testing configuration at /config
WARNING:homeassistant.components.media_player.const:MEDIA_TYPE_MUSIC was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaType.MUSIC instead, please report it to the author of the 'foobar' custom integration
WARNING:homeassistant.components.media_player.const:MEDIA_TYPE_MUSIC was used from foobar, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaType.MUSIC instead, please report it to the author of the 'foobar' custom integration
Incorrect config
General Warnings:
- Platform error 'media_player' from integration 'foobar' - cannot import name 'VOLUME_STEP' from 'homeassistant.components.media_player.const' (/usr/src/homeassistant/homeassistant/components/media_player/const.py)
Successful config (partial)
General Warnings:
I don’t find an obvious easy change for this one and got tired of trying to figure it out!
I just discovered this integration, that could solve a problem I have, but it seems like it isn’t working at all anymore. Did you get it working after your last message in the thread?
I’m not currently using it, but I did get it working. I had to edit the file to replace all of the noted issues. As I recall it was all pretty straight forward other than one of them. I’ll have to see if I still have it installed with the edits.
OK, here’s the edits to /config/custom_components/foobar/media_player.py
--- media_player.py.orig 2024-11-23 12:05:08.039903468 -0500
+++ media_player.py 2024-11-23 14:11:43.857255668 -0500
@@ -15,9 +15,9 @@
PLATFORM_SCHEMA, MediaPlayerEntity)
from homeassistant.components.media_player.const import (
- MEDIA_TYPE_MUSIC, SUPPORT_VOLUME_STEP, SUPPORT_TURN_ON, SUPPORT_TURN_OFF,
- SUPPORT_STOP, SUPPORT_SELECT_SOURCE, SUPPORT_SEEK, SUPPORT_VOLUME_SET, SUPPORT_VOLUME_MUTE,
- SUPPORT_PLAY, SUPPORT_PREVIOUS_TRACK, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, SUPPORT_SHUFFLE_SET)
+ MUSIC, VOLUME_STEP, TURN_ON, TURN_OFF,
+ STOP, SELECT_SOURCE, SEEK, VOLUME_SET, VOLUME_MUTE,
+ PLAY, PREVIOUS_TRACK, NEXT_TRACK, PAUSE, SHUFFLE_SET)
from homeassistant.const import (
CONF_NAME, CONF_HOST, CONF_PORT, CONF_USERNAME,
@@ -38,10 +38,10 @@
CONF_TURN_OFF_ACTION = 'turn_off_action'
SUPPORT_FOOBAR_PLAYER = \
- SUPPORT_PAUSE | SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE | \
- SUPPORT_PLAY | SUPPORT_NEXT_TRACK | SUPPORT_PREVIOUS_TRACK | \
- SUPPORT_STOP | SUPPORT_SEEK | SUPPORT_SHUFFLE_SET | \
- SUPPORT_VOLUME_STEP | SUPPORT_SELECT_SOURCE
+ PAUSE | VOLUME_SET | VOLUME_MUTE | \
+ PLAY | NEXT_TRACK | PREVIOUS_TRACK | \
+ STOP | SEEK | SHUFFLE_SET | \
+ VOLUME_STEP | SELECT_SOURCE
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_HOST): cv.string,
@@ -172,7 +172,7 @@
@property
def media_content_type(self):
"""Content type of current playing media."""
- return MEDIA_TYPE_MUSIC
+ return MUSIC
@property
def media_title(self):
@@ -194,9 +194,9 @@
"""Flag media player features that are supported."""
supported_features = SUPPORT_FOOBAR_PLAYER
if self._turn_on_action is not None:
- supported_features |= SUPPORT_TURN_ON
+ supported_features |= TURN_ON
if self._turn_off_action is not None:
- supported_features |= SUPPORT_TURN_OFF
+ supported_features |= TURN_OFF
return supported_features
Thank you very much! I will try to get that working tonight!
Unfortunately something else probably has changed:
Platform error 'media_player' from integration 'foobar' - cannot import name 'MUSIC' from 'homeassistant.components.media_player.const' (/usr/src/homeassistant/homeassistant/components/media_player/const.py)
Apologies for the late response, I was not aware this was still being used.
Unfortunately I have not used the integration for a while now and I cannot find the time to review it since I am a student in a different country these days.
However, I should have more free time starting April this year and hope make this working again.
I’ll install it and try it to see something else broke it further since it was working for me previously. That will have to wait until the weekend or after as I moved that PC to my other house.
I’m using it from time to time and was planning to fix (or even rework it to be able to configure it in UI) anyway, will try to create a PR later today
You can use this file as a drop-in replacement for custom_components/foobar/media_player.py
for now. It appears changes I want to make to it would require more time
Thank you, both of you! @talmuth Unfortunately I can’t get it to work, it doesn’t see that Foobar is running. Maybe I have a wrong setup in configuration or in Foobar itself? This is the section of configuration.yaml:
media_player:
- platform: foobar
name: Tors pute
host: 192.168.2.1
port: 8889
(This is the pillow speaker in my pillow - I have tinnitus and need sound there to sleep, and the non-standard port is because I have 12 of these running on different zones) But I only get this:
It works when connecting to that address with a browser from the Pi that’s running Hass:
I have been to Hydrogenaudio/Bitbucket and downloaded the file foo_httpcontrol_0_97_30.fb2k-component, so I belive that is the latest versin. Is there anything else I may have overlooked? This shows the versions of plug-ins in Foobar. Foobar itself is 2.24.1, 32 bit version.
Check home-assistant logs, you might also have antivirus/firewall on your windows machine blocking it, or even in foobar itself - try curl http://192.168.2.1:8889
from you home-assistant host to check if it is actually accessible
Thanks, but no other antivirus/firewall on my Windows Serve 2022 than the built-in, and that does not affect the internal network. As I said above I can connect with a browser on the Pi running Hass, so it’s not that, as this confirms:
curl http://192.168.2.1:8889
<html><title>Installed templates</title><body style="background-color:light gray; font-family:sans-serif; font-size:1em;"><p>Installed templates:</p><ul><li><a href="/default/">default</a></li><li><a href="/mastiff/index.html">mastiff</a></li></ul><p><a href="https://hydrogenaud.io/index.php/topic,62218.0.html">Get templates!</a></p></body></html>
But maybe this means something? I’m not sure if it’s a problem with the HTML setup in Foobar.
That keeps going and going, up to 27 times now.
Yeah, this is something in the response from your foobar that integration doesn’t know how to handle. Would need to be able to reproduce it.
Can you dump the HTML content of http://192.168.2.1:8889/pyfoobar2k
?