Coder Social home page Coder Social logo

willholdoway / hifiberry Goto Github PK

View Code? Open in Web Editor NEW
45.0 3.0 11.0 60 KB

This is a custom component to allow control of HifiberryOS devices in Home Assistant using the audiocontrol2 REST API.

License: Creative Commons Zero v1.0 Universal

Python 100.00%
hifiberry home-assistant media-player home-automation hassio hacs python iot internet-of-things

hifiberry's Introduction

HiFiBerry for Home Assistant

beta_badge hacs_badge License: CC0-1.0

The HiFiBerry HA integration allows controlling HifiBerry OS media players from Home Assistant.

This is an end-to-end streaming lightweight OS built by HiFiBerry for their Amp+, DAC+ or Digi+ HAT Raspberry Pi boards compatible with AirPlay, Bluetooth, DLNA, LMS/Squeezebox, MPD, Snapcast, Spotify and Roon music services. This uses the HiFiBerry audiocontrol2 socketio API.

Be aware that this API is disabled by default. In order to use this integration it has to be enabled in the /etc/audiocontrol2.conf on the device, an authtoken will also have to be added:

[webserver]
enable=yes
port=81
socketio_enabled=True
authtoken=[insert_custom_token_here]

Installation

It is recommended this is installed using Home Assistant Community Store (HACS) to ensure your Home Assistant instance can easily be kept up-to-date with the latest changes.

However, to install this manually, copy everything from /custom_components/hifiberry/ to your folder <config directory>/custom_components/hifiberry/.

Configuration

  • Browse to your Home Assistant instance
  • In the sidebar click on Configuration
  • From the configuration menu select: Integrations
  • In the bottom right, click on the Add Integration button
  • From the list, search and select “HiFiBerry
  • Follow the instruction to complete the set up

Installation

None required other than setting a fixed IP for the device running HiFiBerry.

Support

There is no official support for this add-on and is community supported within the Home Assistant HiFiBerry discussion thread.

If you have any proposed changes or bug fixes, please code them and create pull requests for your patches.

See Also

hifiberry's People

Contributors

arfoll avatar chrisazzopardi avatar dgomes avatar malteger avatar rajeevan avatar rob-luke avatar rsnodgrass avatar schnabel avatar willholdoway avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hifiberry's Issues

Failed to set up integration after has 2023.5 update

This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/hifiberry/init.py:31
Integration: HiFiBerry (documentation)
First occurred: 13:38:56 (2 occurrences)
Last logged: 13:49:25

Error setting up entry 192.168.10.42 for hifiberry
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/hifiberry/init.py", line 31, in async_setup_entry
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
AttributeError: 'ConfigEntries' object has no attribute 'async_setup_platforms'

I get this error on the intergration

Regards

custom_component using deprecated features (as per 2025.01)

Hi,

Was checking my HA logs and noted the following message:

Entity None (<class 'custom_components.hifiberry.media_player.HifiberryMediaPlayer'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <MediaPlayerEntityFeature.PAUSE|VOLUME_SET|VOLUME_MUTE|PREVIOUS_TRACK|NEXT_TRACK|TURN_OFF|VOLUME_STEP|STOP|PLAY: 21821>, please report it to the author of the 'hifiberry' custom integration and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation

Is this something easy to fix?

Cannot add hifiberry device: "Failed to connect"

With the new version released, I can still not add a new integration. Getting this error:

`
Logger: homeassistant
Source: runner.py:96
First occurred: 13:31:24 (1 occurrences)
Last logged: 13:31:24

Error doing job: Unclosed client session
`

logs getting filles with "Updating hifiberry media_player took longer than the scheduled update interval 0:00:02"

Installed via HACS
Not sure why I'm getting these:

home-assistant   | 2021-01-30 18:53:20 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02
home-assistant   | 2021-01-30 19:03:52 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02

home-assistant   | 2021-01-30 22:40:04 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02
home-assistant   | 2021-01-30 22:40:14 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02
home-assistant   | 2021-01-30 22:50:36 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02
home-assistant   | 2021-01-31 01:00:10 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02
home-assistant   | 2021-01-31 01:05:28 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02
home-assistant   | 2021-01-31 01:24:47 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02
home-assistant   | 2021-01-31 01:42:01 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02
home-assistant   | 2021-01-31 01:55:12 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02
home-assistant   | 2021-01-31 03:19:18 WARNING (Thread-7) [pychromecast.socket_client] [Second bedroom TV(192.168.0.150):8009] Heartbeat timeout, resetting connection
home-assistant   | 2021-01-31 03:45:53 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02
home-assistant   | 2021-01-31 06:33:35 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02
home-assistant   | 2021-01-31 06:45:00 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.bedroom_led
home-assistant   | 2021-01-31 06:47:00 WARNING (MainThread) [homeassistant.components.automation.morning_alarm_rollers] morning alarm rollers: Already running
home-assistant   | 2021-01-31 06:47:00 WARNING (MainThread) [homeassistant.components.automation.morning_alarm_bedroom_led_lights] morning alarm bedroom LED lights: Already running
home-assistant   | 2021-01-31 07:22:13 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02
home-assistant   | 2021-01-31 07:30:15 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02

home-assistant   | 2021-01-31 07:49:13 WARNING (MainThread) [homeassistant.components.media_player] Updating hifiberry media_player took longer than the scheduled update interval 0:00:02

Stopped working after latest updated due to audiocontrol2sio

After latest update the component stopped working and throws following error in the log:
Error occurred loading configuration flow for integration hifiberry: No module named 'pyhifiberry.audiocontrol2sio'.
I tried reinstalling it but the problem persists. Can you please take a look or provide a solution on how to fix this error?

Suggestion: Use device name as UID instead of IP address

I just migrated my 3 devices from Balena-Sound to HiFiBerry OS. I can't believe I held out as long as I did as this platform is exactly what I've wanted.

My suggestion is based around two different use-case scenarios. One would be for users that are simply using DHCP for addressing of the HFB. Given that the address is subject to change, it isn't a viable UID.

The second use-case is the one I fall into. I have static addresses assigned for my devices, but I also utilize both wired and wireless. In both Balena-Sound and HiFiBerry OS, the devices seem to connect to wireless even when the wired is connected. This results in the device pulling two IP addresses.

As such, I end up having 6 different devices with single entities for 3 physical units. It would be nice if each unit was tracked as a single device with a data table consisting of the relevant MAC addresses. IP would be populated dynamically via ARP. Then we'd just need the media player entity to track whichever MAC is actively in use for the device.

Please help - I don't know how to add HiFi Berry via HACS

Hello,

I’m using Digi+ card on RPi 0W with HiFiBerryOS 20201213 installed.

I wanted to install this integration via HACS.
Everything went successfuly, but now I’m struggling with configuiring that.

Should I paste HiFiBarry’s IP in the “host” section?
What should I type in authtoken field?

Regards,
Jakub
HifiB

Can't add device

Getting this error:

Logger: custom_components.hifiberry.config_flow
Source: custom_components/hifiberry/config_flow.py:23 
Integration: hifiberry (documentation) 
First occurred: 00:15:29 (3 occurrences) 
Last logged: 00:53:34

Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/hifiberry/config_flow.py", line 69, in async_step_user
    await validate_input(self.hass, user_input)
  File "/config/custom_components/hifiberry/config_flow.py", line 23, in validate_input
    await Audiocontrol2SIO.connect(host=data["host"], port=data["port"])
  File "/usr/local/lib/python3.9/site-packages/pyhifiberry/audiocontrol2sio.py", line 38, in connect
    await sio.connect(f'http://{host}:{port}', wait_timeout=wait_timeout)
TypeError: connect() got an unexpected keyword argument 'wait_timeout'

Error setting up entry for hifiberry due to `AttributeError`

As of yesterday the integration fails to initiate and I'm seeing this in the log:

2023-05-05 13:48:40.837 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.1.110 for hifiberry
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/hifiberry/__init__.py", line 31, in async_setup_entry
    hass.config_entries.async_setup_platforms(entry, PLATFORMS)
AttributeError: 'ConfigEntries' object has no attribute 'async_setup_platforms'

I verified that nothing has changed on the HifiBerry itself, the OS version is on 20230404.

I also verified that /etc/audiocontrol2.conf hasn't changed and that it still has the relevant lines:

[webserver]
enable = yes
port = 81
authtoken={foobar}
socketio_enabled=True

The device plays fine and shows up in Roon as an endpoint as usual. The Roon HA integration also sees the device, so that part is fine. But the "standard" media_player entity provided by this integration is missing, as it fails to initiate.

Anyone else seeing this? Any ideas what I can check?

Integration warning upon start of HomeAssistant

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:103
First occurred: 20:20:18 (1 occurrences)
Last logged: 20:20:18

Detected integration that accessed discovery_info['host'] instead of discovery_info.host; this will fail in version 2022.6. Please report issue to the custom component author for hifiberry using this method at custom_components/hifiberry/config_flow.py, line 61: await self.async_set_unique_id(discovery_info['host'])

PLAY_MEDIA, GROUPING services not available

I'm trying to use the services PLAY_MEDIA and Grouping on my hifiberry speakers, but i see they are not added in the supported services. Also the speakers aren't visible in the media sources list. Is there a fix for this?

Volume Settings sets volume in GUI but not on actual audio output

Heya!

So this may be a weird behavior, and I'm not even sure if it's the cause of this integration or HiFiBerryOS itself, but when I set the Volume via Home Assistant it only updates it on the Web GUI of HiFiBerryOS, but the actual audio output is unaffected by it and stays at the same volume as it was before. If I use the slider on the Web GUI it works without any issues.

That said, if I use the slider on the Web GUI it doesn't update the slider on Home Assistant, so it seems to only be One-Way so far.

Support turn_on/off_action

Hi

I noticed that while media_player.pause works to stop playing music from the Radio source on my HiFiBerry, media_player.start doesn't restart the stream.
Therefore, I want to use media_player.volume_mute (true/false) instead via the turn_on_action and turn_off_action most mediaplayers usually support.

However, it seems that this integration doesn't support these options.
Invalid config for [media_player.hifiberry]: [turn_on_action] is an invalid option for [media_player.hifiberry]. Check: media_player.hifiberry->turn_on_action. (See ?, line ?).

Would you (or someone else) be willing to add support for these options to this integration?

Kr
TGZ

Cannot add integration

I've upgraded to latest version and can't add HifiBerry integration.

Browsing to 'Add Integration', I search for HifiBerry and click it. The list of available integrations reloads, nothing happens.

The log file records:

ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration hifiberry: cannot import name 'FlowResult' from 'homeassistant.data_entry_flow' (/srv/homeassistant/lib/python3.8/site-packages/homeassistant/data_entry_flow.py)

Any help greatly appreciated

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.