ChriD / node-raumkernel

A nodeJs lib for controlling the raumfeld multiroom system
MIT License
17 stars 7 forks source link

"leaveStandby" promise too fast? #36

Closed Alex9779 closed 6 years ago

Alex9779 commented 6 years ago

I want to have a device to play a playlist. That works fine also assigning it to a new zone if it has non yet works. But I have a problem if the device is in standby. I used the "leaveStandby" function with the promise and when that succeeds I Ioad the playlist. But it seems to be a bit too fast for the device. I leaves standby but does not load the playlist. If I debug that stuff it works because just that second I wait to execute the playlist load seems to be enough but in normal is does not. So I could add some "waitTimeout" function which is called when the promise from "leaveStandby" executes and wait for one second and the load the playlist. I just wanted to ask if there is something you can do in the kernel because all other promises I use just work out and the next thing is done when the previous one finished but in this case...

ChriD commented 6 years ago

The problem with those actions (most of the upnp actions and actions which trigger some state change on the host) is, that i do not get a reply when it is really done, You only get "Ok i got the upnp message and its ok". For this case a few methods do have the _confirm parameter which will listen the upnp protocol or the host until the device changed the status to the desired one and the kernel is aware of it. (e.g. loadPlaylist, loadUri, connectRoomToZone, ...) For the leaveStandby action i do not have implemented this. I think i can implement this if the standby State (PowerState) is a key on the renderer itself (which it should be on the renderer itself, on the zone renderer its a subkey of the room data... )

ChriD commented 6 years ago

@Alex9779 i have updated the kernel. Now the leaveStandy does have the ability to "_confirm" the status on the renderer. I had to update the trigger manager to allow multiple values (ACTIVE and IDLE) for the PowerState. Please note that this does NOT work for VirtualRenderers. On virtual renderers the PowerState is within the roomObject and the trigger manager can't handle this right now. If you need this too, give me some info.

You may update the kenel and check if your problem is gone. I am not sure if this will solve your issue because i think the renderer itself will go out of standby if you load a playlist on the virtual zone renderer. So i am not sure why you want to get it out of the standby state manually

Alex9779 commented 6 years ago

Ok will try it...

To you last comment, I am using a virtual renderer to load the playlist but the device remains in standby. That is the manual standby not the automatic one. If it is in automatic standby then it wakes up when loading a playlist...

Alex9779 commented 6 years ago

Ok info :D I need this on the virtual renderer too where you call leaveStandby with the roomUdn...

ChriD commented 6 years ago

Voila! I did not do very much testing on this update. Hope it doesn't crash the whole kernel ;-)

Alex9779 commented 6 years ago

Cool! Tried it and it is working for me...