Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Installed but failing on startup - RPi 3 #397

Open
sidharthb0 opened this issue Sep 10, 2018 · 30 comments
Open

Installed but failing on startup - RPi 3 #397

sidharthb0 opened this issue Sep 10, 2018 · 30 comments

Comments

@sidharthb0
Copy link

Hey there!

I managed to bypass all errors and got Airsonos finally installed on my Raspberry Pi 3.

Although when I run it, it fails with TypeError: Cannot read property 'forEach' of null

I've tried a few of the suggestions provided in other threads but to no avail. I also do not currently have any BOOST or BRIDGE devices on my network (although I see logicalDevice.js mentions ignoring them)

My current set up is 2 Play:1 Speakers and a Connect:Amp

Really hoping someone can help me sort this out!

LOG

pi@raspberrypi:~ $ airsonos

*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister
Searching for Sonos devices on network...

/usr/local/lib/node_modules/airsonos/node_modules/sonos/lib/logicalDevice.js:84
devices.forEach(function(device) {
^

TypeError: Cannot read property 'forEach' of null
at /usr/local/lib/node_modules/airsonos/node_modules/sonos/lib/logicalDevice.js:84:16
at /usr/local/lib/node_modules/airsonos/node_modules/sonos/lib/sonos.js:719:7
at Parser. (/usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/xml2js/lib/xml2js.js:255:20)
at emitOne (events.js:77:13)
at Parser.emit (events.js:169:7)
at Object.saxParser.onclosetag (/usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/xml2js/lib/xml2js.js:225:24)
at emit (/usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/xml2js/node_modules/sax/lib/sax.js:615:33)
at emitNode (/usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/xml2js/node_modules/sax/lib/sax.js:620:3)
at closeTag (/usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/xml2js/node_modules/sax/lib/sax.js:861:5)
at Object.write (/usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/xml2js/node_modules/sax/lib/sax.js:1293:29)
at Parser.exports.Parser.Parser.parseString (/usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/xml2js/lib/xml2js.js:273:29)
at Parser.parseString (/usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/xml2js/lib/xml2js.js:6:61)
at Object.exports.parseString (/usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/xml2js/lib/xml2js.js:296:19)
at Request._callback (/usr/local/lib/node_modules/airsonos/node_modules/sonos/lib/sonos.js:702:12)
at Request.self.callback (/usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/request/request.js:129:22)
at emitTwo (events.js:87:13)

@doner005
Copy link

I'm having the same exact issue trying to run AirSonos on Mac. Hopefully someone can find a solution for this.

@DJBenson
Copy link

Same issue on Raspberry Pi 3 - it was working but stopped recently.

@ksho
Copy link

ksho commented Sep 27, 2018

Can reproduce on macOS 10.13.6 -- was working last week 🤷🏼‍♂️

@ddmoh
Copy link

ddmoh commented Sep 28, 2018

Same here. Doesn't work on macOS 10.13.6 anymore. Didn't use in a while tho'.

@rafale77
Copy link

rafale77 commented Sep 28, 2018

This seems to be an error coming from a sonos firmware upgrade. I cannot start my instance either on ubuntu.
It looks to me from the logs that airsonos can no longer find the speakers.

@rafale77
Copy link

One more comment, Airsonos as I noticed is no longer needed with airplay2. The bridging is done directly into the sonos without the need of airsonos if you have a sonos which supports airplay2.

https://blog.sonos.com/en/airplay2-coming/

@ksho
Copy link

ksho commented Sep 28, 2018

@rafale77 I'm still waiting to pickup an airplay2 compatible sonos. It sounds like only one AP2 sonos is needed on your network to make all speakers AP2 compatible?

@rafale77
Copy link

@ksho indeed, only one is needed in your network but it needs to be the group leader. If you play through it, it works. If you are trying to play through only one speaker, it needs to be one of the newer ones.

@max-mathieu
Copy link

max-mathieu commented Oct 4, 2018

As far as I can see the issue is because getTopology has been deprecated, as reflected in the sonos package: bencevans/node-sonos@7b7164d
I can try to submit a PR but it does not look like this repo here is still maintained

@tmelot2
Copy link

tmelot2 commented Oct 9, 2018

I am also having the same issue. Definitely interested in figuring this out so I can keep using airsonos!

@DJBenson
Copy link

DJBenson commented Oct 9, 2018

I tried pulling the latest version of node-sonos into the mix, and whilst the error message did change, it seems that there is something in airsonos (lib/airsonos.js) which also needs updating. It is calling a method which I don't think exists in the node-sonos library (probably due to the change to getTopology mentioned above).

I also tried pulling one of the forks which are still updated but they don't appear to have been fixed yet.

@vkoi81
Copy link

vkoi81 commented Oct 10, 2018

This is definitely broken since one of the latest Sonos updates.
I guess Sonos trying to force everyone to buy their latest speakers.

@DJBenson
Copy link

DJBenson commented Oct 10, 2018

This is definitely broken since one of the latest Sonos updates.
I guess Sonos trying to force everyone to buy their latest speakers.

I don't think that's the case at all. Sonos have a very good reputation for supporting "legacy" devices for a long time. For example they only recently stopped supporting the CR100 hardware controller which was released 13 years ago and stopped being manufactured almost a decade ago - that's above and beyond what many manufacturers will support these days.

This is likely as a result of a change in the API which hasn't been reflected in airsonos (which of course is because this project appears to be abandoned).

@vkoi81
Copy link

vkoi81 commented Oct 10, 2018

This was definitely a great project when it was alive.

I remember reading something a while back where Sonos said in an interview that they were aware of some “workarounds” for airplay support but were not yet ready to address those “workarounds”.

I just thought that now they decided to close up the holes so to speak.

You’re probably right though, might just need an api update to get this working again.

@DJBenson
Copy link

Interestingly, there is a project (https://github.com/ebaauw/homebridge-zp/tree/AirTunes) which is an interface betwen homebridge (the open source implementation of Apple's HomeKit) which in the beta version exposes AirTunes receivers for each speaker - that is still working - so perhaps there is something from that projects code which can be ported across into airsonos?

Alternatively, you could just switch to using homebridge + homebridge-sp to allow you to continue using AirPlay with non-AirPlay Sonos speakers, even if you don't need the HomeKit integration.

@DJBenson
Copy link

Here's what happens if you delete the sonos directory from airsonos/node_modules and then reinstall the latest version with npm install git://github.com/bencevans/node-sonos.git:

pi@homekithub:~/airsonos/bin $ node index.js
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister>
Searching for Sonos devices on network...

**/home/pi/airsonos/bin/airsonos.js:67
      return Promise.promisify(sonos.LogicalDevice.search);
                                                   ^

TypeError: Cannot read property 'search' of undefined**
    at AirSonos.get (/home/pi/airsonos/bin/airsonos.js:67:52)
    at AirSonos.start (/home/pi/airsonos/bin/airsonos.js:24:19)
    at Object.<anonymous> (/home/pi/airsonos/bin/index.js:32:12)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3

@DJBenson
Copy link

sonos.LogicalDevice.search doesn't exist in the latest version of node-sonos - the new method is called DeviceDiscovery but I cannot work out how to incorporate that into airsonos.

@doner005
Copy link

Here’s my solution. I ditched this project and use this. https://sonoair.mihosoft.eu/

I downloaded the installer from their website and it worked right away.

@vkoi81
Copy link

vkoi81 commented Oct 17, 2018

Here's what happens if you delete the sonos directory from airsonos/node_modules and then reinstall the latest version with npm install git://github.com/bencevans/node-sonos.git:

pi@homekithub:~/airsonos/bin $ node index.js
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister>
Searching for Sonos devices on network...

**/home/pi/airsonos/bin/airsonos.js:67
      return Promise.promisify(sonos.LogicalDevice.search);
                                                   ^

TypeError: Cannot read property 'search' of undefined**
    at AirSonos.get (/home/pi/airsonos/bin/airsonos.js:67:52)
    at AirSonos.start (/home/pi/airsonos/bin/airsonos.js:24:19)
    at Object.<anonymous> (/home/pi/airsonos/bin/index.js:32:12)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3

I just started using AirConnect and it's working fine. Have you tried it?

@ricosuave0922
Copy link

same problem here. hope someone can come up with a fix

@vkoi81
Copy link

vkoi81 commented Nov 9, 2018

I think this project is abandoned. Have you tried airconnect?

@ricosuave0922
Copy link

I just did. Got it all setup and working. Now to figure out how to uninstall Airsonos.

@jasonmarziani
Copy link

@ricosuave0922 npm uninstall -g airsonos

@eeston
Copy link

eeston commented May 15, 2019

Has this repo been abandoned?
I have a working version and I want to know if I should PR or just start a new project?

@DJBenson
Copy link

Has this repo been abandoned?
I have a working version and I want to know if I should PR or just start a new project?

I’d be a happy recipient of a working version.

@eeston
Copy link

eeston commented May 27, 2019

On holiday at the moment. Will push my fork up next week

@eeston
Copy link

eeston commented Jun 5, 2019

@DJBenson give this a spin and let me know how you get on...
https://github.com/johneas10/airsonos

It's turned into a bit of a mish-mash of various fixes on various forks, none of which I could get to work on their own. Hopefully now that they're all on one repo, it should make things a little easier to maintain. I've also implemented NicerCast and NodeTunes to make development a little smoother.

At the moment it's pretty limited but it seems to run fine with a single play:1 multiple play:1s (if they are grouped) setups. They're the only devices I can test on at the moment. Volume is also a little flakey.

Still very much a work in progress, and I will probably refactor a lot of it over the coming weeks. Hopefully I can get it running pretty well. If anyone has other devices to test with, I would appreciate some feedback.

@DJBenson
Copy link

DJBenson commented Jun 5, 2019

Hi @johneas10, thanks for the share.

I've replaced my broken install with your fork and it seems to work well. I'm running it on a Raspberry Pi 3 using wired ethernet and have 3xSonos:1's (non Alexa) a Sonos Connect:Amp and a Sonos Boost (not sure the latter makes any difference).

I've streamed from iTunes Music Library on my iPhone (running iOS 13 Beta 1...I've clearly got a thing for experimental/unstable software...) and no problems. There is a lag of about 2-3 seconds between starting streaming and/or changing tracks but that might be environmental or just a consequence of using this type of solution.

EDIT: I've also streamed from Apple Music on my Apple TV 4K with similar results.

I've played around with the volume slider as you mentioned it might be flaky but I can't spot anything obvious, what kind of flakiness did you have on your side? It seems to control the volume well, smoothly (both in terms of the slider in the app, response time from Sonos and no audio distortion of any kind).

I'm so thrilled to have this back up and running. I was using a plugin for HomeBridge which had an experinental AirTunes feature but for some reason the developer removed it so when I updated the plugin I lost the AirPlay functionality.

Well done fixing this, even if it is currently held together with string and stickytape, I've subscribed to your repo so will watch for updates and feel free to give me a shout if you need anything testing.

@eeston
Copy link

eeston commented Jun 5, 2019

Thanks @DJBenson.

I have the same lag. I actually thought it was an issue with my wifi as it's really really bad. Good to know though...I can do a bit of tinkering to see if I can get it sped up a little bit. No idea where to start with it at the moment but I'm sure I'll learn as I go.
The volume just seemed a little out of sync at times....maybe that's how it always was?? I've never had this installed so not sure what it was like before.

Glad it's working well for you though. If you have any issues, drop me a ticket on the repo 👍

@DJBenson
Copy link

DJBenson commented Jun 5, 2019

I've been running it for quite some time in various guises as each Sonos update seemed to break things until one of the most recent updates which killed it. The lag has always been there, I guess it's understandable given the conversion that's going on by the devices not being able to "speak pure AirPlay" as it were.

Thanks again, very happy to have AirPlay back on my Sonos kit again.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests