I’m currently developing an integration for the Libratone Zipp, which is a Wi-Fi speaker.
After a lot of digging, I finally cracked the code and found how to send/receive from it. I made a python library (python_libratone_zipp) in order to communicate with it and it works well with my integrated command line tool (CLI.py).
I’m now trying to build a simple home assistant integration! So far I can send commands like play, pause, … but I wasn’t able to get information from the speaker to me.
I know that my library need to listen to those ports: 3333/udp and 7778/udp in order to receive status message and this seems the blocking point.
How can I tell Home Assistant to forward those 2 ports, both when I use devcontainer but also in a “normal” instance?
I did some search, but I found no luck to find something to help me
Thanks a lot for your help!
I tried to use your integration, but sadly it doesn’t work in my setup (VM). There seems to be an issue regarding communication to ZIPP:
021-06-22 06:36:41 WARNING (SyncWorker_5) [LibratoneZipp] Socket error: [Errno 98] Address in use
2021-06-22 06:36:41 WARNING (SyncWorker_6) [LibratoneZipp] Address-related error: [Errno -2] Name does not resolve
2021-06-22 06:36:41 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up libratone_zipp platform for media_player
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/libratone_zipp/media_player.py", line 66, in setup_platform
zipp_client = LibratoneZipp(host)
File "/usr/local/lib/python3.8/site-packages/python_libratone_zipp/LibratoneZipp.py", line 215, in __init__
self._listening_notification_socket, self._listening_notification_thread = self._get_new_socket(receive_port=_UDP_NOTIFICATION_RECEIVE_PORT, trigger_port=_UDP_CONTROL_PORT, ack_port=_UDP_NOTIFICATION_SEND_PORT)
TypeError: cannot unpack non-iterable NoneType object
My log is also full of these entries:
2021-06-22 06:59:13 WARNING (MainThread) [homeassistant.components.http.forwarded] A request from a reverse proxy was received from 172.30.33.5, but your HTTP integration is not set-up for reverse proxies; This request will be blocked in Home Assistant 2021.7 unless you configure your HTTP integration to allow this header
NGINX is running as Addon - could this be the root-cause?
I also use a VM so it should work fine … but I don’t use NGINX.
The log indicated that it’s stopped during _get_new_socket function, which is responsible to set up a thread to manage incoming message and then bind to 3333/udp. If it can’t, then this function will fail and will fail the integration (I know, it’s not nice).
So I think indeed using NGINX is conflicting as somehow it prevent the python module to bind to the socket … Do you think you can disable it to try? I do not have much experience in NGINX unfortunately
Do you have also the log of the integration? I think there should be a least one info message “Listening incoming Zipp messages on 3333”
Thanks for your fast response!
I will try and deactivate NGINX when im back at home.
n00b question: where can i find the log of the integration itself?
At least I already got rid of the reverse proxy error with http config:
You need first to configure the integration to be a bit more “verbose”. According to the logger integration, this could be done with the following in your configuration.yaml
logger:
default: info
and then you can grab the result using the Terminal addon and filter it:
$ cat ./config/home-assistant.log | grep LibratoneZipp
2021-06-23 08:27:48 INFO [LibratoneZipp] Listening incoming Zipp messages on 3333
2021-06-23 08:27:48 INFO [LibratoneZipp] Listening incoming Zipp messages on 7778
2021-06-23 08:27:48 INFO (Zipp_keepalive) [LibratoneZipp] Keep-alive thread started.
And last but not least, maybe it would be better to continue this discussion as an issue in Github?
Keep me informed!
This is what I was able to find in the logs - regardless wether NGINX is active or not.
2021-07-13 14:48:09 WARNING (SyncWorker_4) [LibratoneZipp] Address-related error: [Errno -2] Name does not resolve
2021-07-13 14:48:10 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up libratone_zipp platform for media_player
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/libratone_zipp/media_player.py", line 66, in setup_platform
zipp_client = LibratoneZipp(host)
File "/usr/local/lib/python3.9/site-packages/python_libratone_zipp/LibratoneZipp.py", line 215, in __init__
self._listening_notification_socket, self._listening_notification_thread = self._get_new_socket(receive_port=_UDP_NOTIFICATION_RECEIVE_PORT, trigger_port=_UDP_CONTROL_PORT, ack_port=_UDP_NOTIFICATION_SEND_PORT)
TypeError: cannot unpack non-iterable NoneType object
I also added the Libratone IP addresses to http config- with no effect:
The only idea that I have is that you’re using multiple speakers, and the 2nd integration cannot start as the 1st one already “took” the 2 network port needed to control Zipp.
I’ve registered an issue in my python module but it’s unlikely I’ll fix it soon as it’s quite a rework
So maybe you can try with only one speaker, if you have multiples ones?
Otherwise I really don’t know NGINX and how it could interfere with the listening UDP thread