Skip to content

Commit

Permalink
fix: Pause all wont fail on first error
Browse files Browse the repository at this point in the history
  • Loading branch information
svrooij committed Jan 20, 2023
1 parent 208b8b2 commit be04226
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "sonos2mqtt",
"version": "0.0.0-development",
"description": "A smarthome bridge between your sonos system and a mqtt server.",
"description": "Control and monitor Sonos speakers through MQTT",
"main": "lib/index.js",
"license": "MIT",
"author": "Stephan van Rooij <github@svrooij.nl> (https://svrooij.nl)",
"author": "Stephan van Rooij <sonos2mqtt@svrooij.io> (https://svrooij.io)",
"bin": {
"sonos2mqtt": "lib/index.js"
},
Expand All @@ -18,12 +18,13 @@
"scripts": {
"build": "tsc",
"help": "node ./lib/index.js --help",
"lint-fix": "eslint ./src/*.ts --fix",
"lint": "eslint ./src/*.ts",
"lint:fix": "eslint ./src/*.ts --fix",
"serve-docs": "docker-compose -f ./docs/docker-compose.yml up jekyll",
"test": "eslint ./src/*.ts"
"test": "npm run lint"
},
"dependencies": {
"@svrooij/sonos": "^2.6.0-beta.2",
"@svrooij/sonos": "^2.6.0-beta.3",
"mqtt": "4.3.7",
"serilogger": "^0.4.1",
"yalm": "4.1.0",
Expand Down
6 changes: 5 additions & 1 deletion src/sonos-to-mqtt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ export class SonosToMqtt {
return this.sonosManager.PlayTTS(payload);

case 'pauseall':
return Promise.all(this.sonosManager.Devices.map(d => d.Pause()));
return Promise.all(this.sonosManager.Devices
.filter(d => d.Coordinator.Uuid === d.Uuid)
.map(d => d.Pause().catch(err =>{
this.log.warn('Device %s emitted an error %o', d.Uuid, err);
})));

case 'listalarm': // This typ-o is still there for backward compatibility
case 'listalarms':
Expand Down

0 comments on commit be04226

Please sign in to comment.