[APP] Bluesound [needs other developer]

Thanks,

Now is working as expected.
Great job again for your effort on doing this app.

Best regards.

I must get back to you to make a correction :slight_smile:
Now the stop trigger is not working.

I saw in your code that you check for the “stop” state to update the status to Homey.ManagerFlow.getCard(‘trigger’, ‘start_playing’) and Homey.ManagerFlow.getCard(‘trigger’, ‘stop_playing’) and so on.
Bluesound (BluOS) has 3 options (actually more - stream, connecting etc.) to the state check: play, pause and stop (those are for our purpose ). Stop is generated when there is no playlist loaded (is empty) and pause/play when there is something in the playlist.
So maybe you must check by “play” state and generate the status in the app.

Best regards.

Ok. I don’t own a Bluesound device myself. So I can’t check these kind of things. If I understand correctly when the state changes to play it should trigger the start_playing trigger and on any other state change it should trigger the stop_playing trigger?

Yes, you can:
If state play then trigger is playing…
And if state !== play then trigger is stoping…

v1.3.6 - 2020-06-25

Another fix for issue with start / stop playing trigger cards.

Hi Phuturist,

After my question in the (NL) questions section here I did some further checking and was triggered by Hunteru’s post dated 24/6.

My issue is that the triggers for ‘start playing’ and stop playing’ do not work for streaming radio and the optical input, where they do work for playing from NAS and TIDAL. Homey does recognise the player is active as the icon changes into the ‘playing’ icon, it’s just the flow which is not activated.

Am I correct in assuming there is no workaround for me as user, and would require you to include triggers for ‘start/stop streaming’, ‘start/stop optical input’ etc.?

Alternatively, for my use case and if available in the programming, it would also be an option to:

  • use the hibernation status as trigger (player goes into hibernation after 15 minutes of no use)
  • use the status of the 12V trigger output (active until 15 minutes after use and used to control the connected amplifier)

Hope you can have a look as I really appreciate the app. I’m more than happy to test anything, but have very little knowledge of programming.

Thanks in advance and regards,
Gertjan

Sorry, was on vacation and missed this message.

The start / stop playing trigger card is determined by that value state from the result of http://ipbluesound:port/Status. The triggercard is currently triggered when it changes to play or stream while the condition card just checks if the state is not pause. I’ll change the triggercard accordingly hoping it wont have any side effects and start triggering the card to often. I cant test any of this since I dont own a Bluesound device.

I have updated the app but also updated it to SDK3. This requires Homey firmware 5.x which is currently in experimental phase. I’m looking for people who use the Bluesound app and already have firmware 5.x installed which can test this test version of the app.

v3.0.0 - 2020-08-06

  • Updated to SDK3 (require Homey firmware 5.x)
  • Fixed an issue with the start/stop playing trigger card
1 Like

Thanks for your fast action! Unfortunately I can not test with version 5 as two of the apps controlling most of my devices are listed as ‘not yet available’.
So I’ll have to await the official release and will provide feedback as soon as possible.

KR,
Gertjan.

Hi Jelger,

I have installed 5.0 and your sdk3 version but the device is not available. I will try to run the app via Cli. Maybe the logging will tell us more…

Logging:

SyntaxError: Unexpected token ‘=>’
at wrapSafe (internal/modules/cjs/loader.js:1072:16)
at Module._compile (internal/modules/cjs/loader.js:1122:27)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at Module.homeyRequire [as require] (/opt/homey-client/node_modules/homey-apps-sdk-v3/index.js:11:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object. (/app.js:4:14)
at Module._compile (internal/modules/cjs/loader.js:1158:30)

— INFO: com.bluesound has been killed —

Thanx. The error seems to originate outside my code though which makes it hard to troubleshoot. I’ll look into it though and see if I can come up with a fix.

Just to be sure, you are also running Homey firmware 5.x?

Yes i am! Rc22 at the moment

I have updated the test version to 3.0.1 which hopefully fixes the issue. Could you test again?

Yes it does! Will test the start/stop some later. Thnx so far!

Made some testflows with notifications:
1 powernode stops and 1 powernode start.
When i stop or start the powernode i get the same notification: powernode stops

Edit: made another two testflows, both with the trigger stops playing. In the first flows in the ‘and’ section is playing then notification: powernode starts playing. In the second flow in the 'and section is not play then notification stops playing.
Not how it should, but it is a workaround.
Looks like only the stops playing trigger is working.

Another thing: in the ‘then’ section there are two cards to pick with: ‘is playing’. I had to pick the second to make it work.

I hope to have fixed the start/stop playing trigger card once and for all. Could you check again. I have also removed one of the duplicate condition cards for is (not) playing. That might break some flows for some people but cleans up the code and the flows can be fixed easily. Could you test again.

Start still doesn’t work. Maybe just change stop trigger in start/stop trigger. People can then ad an condition card in the And section with is or is not playing. Problem solved!

I cant as these triggercard are built in based on the speaker_playing capability (and I dont want too, I want to get it right). So help me out here. The only thing I can do it to determine when I need to set the speaker_playing capability to true or false. The code looks like this:

// capability speaker_playing
if (result.state !== "pause" && !this.getCapabilityValue('speaker_playing')) {
  this.setCapabilityValue('speaker_playing', true);
} else if (result.state == "pause" && this.getCapabilityValue('speaker_playing')) {
  this.setCapabilityValue('speaker_playing', false);
}

In human language this says "if the device state (result.state) is not pause and the state of the device in Homey is not playing then set it the speaker_playing capability to playing or if the device state is pause and the state of the device in Homey is set to playing then set it to not playing. My guess is that there are cases where the state of the device is not changed from pause while it’s actually playing something (like radio) and thus it wont change the capability and therefor not trigger the start playing trigger card. I need to find out if this is the case. Could you check this through http://ipbluesound :port/Status and see what the result is when starting and stopping your music.

And thanx for the beers, much appreciated with this heat … :pray:

Your welcome!

Hhm. I do understand you. But even when i cut off the power and restart the Powernode and start play some music, Start playing is not triggered.

You will need to access this URL (replacing the IP and port of your Bluesound device) to see what the status is. I use this output to update the device instance in Homey.

http://ipbluesound:port/Status