ChriD / node-raumserver

A nodejs module/server to control the raumfeld multiroomsystem via HTTP-Requests
58 stars 14 forks source link

Media Renderer for id 'Buero' not found #78

Open mrumpf opened 5 years ago

mrumpf commented 5 years ago

In the syslog I have the following startup phase:

Feb  6 22:59:29 openhab systemd[1]: Started Raumserver.
Feb  6 22:59:31 openhab node[23467]: #033[32minfo#033[39m: [Raumserver] Welcome to raumserver v0.1.8 (raumkernel v1.2.22)
Feb  6 22:59:31 openhab node[23467]: #033[32minfo#033[39m: [Raumserver] eth0 192.168.178.58
Feb  6 22:59:32 openhab node[23467]: #033[32minfo#033[39m: [Raumkernel] Found raumfeld host on: 192.168.178.47
Feb  6 22:59:32 openhab node[23467]: #033[32minfo#033[39m: [DeviceManager] Media renderer added: [LG] webOS TV OLED55B7D (uuid:0822ea7d-1a7d-95e3-d6f0-38e768305805)
Feb  6 22:59:32 openhab node[23467]: #033[32minfo#033[39m: [DeviceManager] Raumfeld Media renderer added: Speaker Bad #3 (uuid:363b6b7c-de1e-4b0d-ab4c-fd900e4ad46f)
Feb  6 22:59:32 openhab node[23467]: #033[32minfo#033[39m: [DeviceManager] Raumfeld Media renderer added: Speaker Kueche (uuid:ed8a7552-5ace-4d55-9f06-07a2632d84a2)
Feb  6 22:59:32 openhab node[23467]: #033[32minfo#033[39m: [DeviceManager] Raumfeld Media renderer added: Connector Buero (uuid:5ab32b25-6ff4-40ee-b5a7-b1ca99c52a61)
Feb  6 22:59:32 openhab node[23467]: #033[32minfo#033[39m: [DeviceManager] Virtual media renderer added: Bad (uuid:00000000-0584-979c-0000-00000584979c)
Feb  6 22:59:33 openhab node[23467]: #033[32minfo#033[39m: [DeviceManager] Raumfeld media server added: Raumfeld MediaServer (uuid:82e26afd-501b-4757-a7d7-c29d96924edb)
Feb  6 22:59:33 openhab node[23467]: #033[32minfo#033[39m: [DeviceManager] Virtual media renderer added: Kueche (uuid:b62f8ca9-03fb-4e2a-b5eb-fb4b811e1904)
Feb  6 22:59:33 openhab node[23467]: #033[31merror#033[39m: [Request.getRendererState] Media Renderer for id 'Buero' not found
Feb  6 22:59:33 openhab node[23467]: #033[31merror#033[39m: [Raumserver] Request was rejected:  errorMessage=Error: Media Renderer for id 'Buero' not found, errorData=null

The message "Error: Media Renderer for id 'Buero' not found, errorData=null" did not show up before I did a reset of the Raumfeld Connector device.

When I ask the raumserver for all renderers, I get one with name "Buero": http://raumserver:8082/raumserver/data/getRendererState?listAll=true

{"InstanceID":0,"AVTransportURIMetaData":"","CurrentTrackDuration":"NOT_IMPLEMENTED","PowerState":"AUTOMATIC_STANDBY","AVTransportURI":"","CurrentPlayMode":"NORMAL","TransportState":"NO_MEDIA_PRESENT","OwnsAudioResource":"0","CurrentTransportActions":"","TransportStatus":"OK","LowDB":"0.000000","Mute":"0","MidDB":"0.000000","Volume":"80","HighDB":"0.000000","rooms":[{"name":"Buero","udn":"uuid:633d347e-d207-4ad7-b456-3f258fabbd51","powerState":"AUTOMATIC_STANDBY","renderer":[{"udn":"uuid:5ab32b25-6ff4-40ee-b5a7-b1ca99c52a61","name":"Connector Buero"}]}],"udn":"uuid:5ab32b25-6ff4-40ee-b5a7-b1ca99c52a61","mediaItem":null,"friendlyName":"Connector Buero","host":"192.168.178.47","manufacturer":"Lautsprecher Teufel GmbH","modelNumber":"2"}

Even during startup the renderer was found by Raumserver:

[DeviceManager] Raumfeld Media renderer added: Connector Buero (uuid:5ab32b25-6ff4-40ee-b5a7-b1ca99c52a61)

Why is the request /raumserver/data/getRendererState?id=Buero leading to this error?

ChriD commented 5 years ago

In your case there is no renderer with name "Buero" untill you create a zone from the "Connector Buero" renderer

You have to keep in mind that raumfeld creates "virtual" renderers on which the main actions happen. "Virtual" renderes are zones. You do have "Bad" and "Kuche" as Virtual renderers but not "Buero"

So the solution for you would be to create a zone from the "Connector Buero" renderer. /The zone was killed as you restartet you renderer) This can be done manually be the app or you use the "createZone" request before you call "getRendereState"

mrumpf commented 5 years ago

Hm, I just reinstalled the firmware to the Connector and reset the Android app. Then I added the Connector Buero (which became the host) and added the 2 Raumfeld S speakers again (Bad & Kueche). Now Buero and Kueche work, but Bad is not working anymore: "Media Renderer for id 'Bad' not found, errorData=null". I did not create a Zone after adding the Connector Buero again, neither for Kueche nor Buero. I will reset the 2 Speaker One S to see whether this helps. Maybe I do not understand the relationship between media renderer and virtual renderer yet, when they are created and which of them is required by the raumserver.

I also tried to create a zone from a room: /raumserver/controller/createZone?id=Buero /raumserver/controller/createZone?id=Bad /raumserver/controller/createZone?id=Kueche But that did not bring the Bad renderer back.

ChriD commented 5 years ago

You do not need to reset any speakers! I think you have to understand the "virtual renderers" first. Thats no invention from the raumserver, that was invented by the Teufel/Raumfeld System.

A virtual renderer represents a "Zone". In a Zone there can be one or more renderers. Imaging you add all rooms /room renderers into one zone. Then Raumfeld will create one virtual renderer which consists of all media-renderers. If you now play something on the virtual renderer, its played on all media-renderers which was added to the zone.

Raumfeld does not play anything on a media-renderer, it always needs a virtual renderer (zone) In your case its a 1 to 1 relation. You have one virtual renderer for one media-renderer.

You can create virtual renderers by using the "createZone". So in fact /raumserver/controller/createZone?id=Bad&confirm=true should create a virtual renderer for the "Bad" Media Renderer and then you should be able to use it.

mrumpf commented 5 years ago

Thanks for the clarification! /raumserver/controller/createZone?id=Bad&confirm=true led to this error:

Feb  7 10:13:26 openhab node[23467]: #033[31merror#033[39m: [Request.createZone] Exception thrown:  message=ConnectRoomToZone trigger was not triggered in a valid time!, stack=Error: ConnectRoomToZone trigger was not triggered in a valid time!
Feb  7 10:13:26 openhab node[23467]:     at Timeout._onTimeout (/home/raumfeld/node_modules/node-raumkernel/lib/lib.manager.zoneManager.js:566:37)
Feb  7 10:13:26 openhab node[23467]:     at ontimeout (timers.js:436:11)
Feb  7 10:13:26 openhab node[23467]:     at tryOnTimeout (timers.js:300:5)
Feb  7 10:13:26 openhab node[23467]:     at listOnTimeout (timers.js:263:5)
Feb  7 10:13:26 openhab node[23467]:     at Timer.processTimers (timers.js:223:10)
Feb  7 10:13:26 openhab node[23467]: #033[31merror#033[39m: [Request.createZone] Some renderers had exceptions:  message=ConnectRoomToZone trigger was not triggered in a valid time!, stack=Error: ConnectRoomToZone trigger was not triggered in a valid time!
Feb  7 10:13:26 openhab node[23467]:     at Timeout._onTimeout (/home/raumfeld/node_modules/node-raumkernel/lib/lib.manager.zoneManager.js:566:37)
Feb  7 10:13:26 openhab node[23467]:     at ontimeout (timers.js:436:11)
Feb  7 10:13:26 openhab node[23467]:     at tryOnTimeout (timers.js:300:5)
Feb  7 10:13:26 openhab node[23467]:     at listOnTimeout (timers.js:263:5)
Feb  7 10:13:26 openhab node[23467]:     at Timer.processTimers (timers.js:223:10)
Feb  7 10:13:26 openhab node[23467]: #033[31merror#033[39m: [Raumserver] Request was rejected:  errorMessage=Error: ConnectRoomToZone trigger was not triggered in a valid time!, errorData=null
Feb  7 10:13:26 openhab node[23467]: #033[31merror#033[39m: [Request.getRendererState] Media Renderer for id 'Bad' not found
Feb  7 10:13:26 openhab node[23467]: #033[31merror#033[39m: [Raumserver] Request was rejected:  errorMessage=Error: Media Renderer for id 'Bad' not found, errorData=null
Feb  7 10:13:34 openhab node[23467]: #033[31merror#033[39m: [Request.getRendererState] Media Renderer for id 'Bad' not found
Feb  7 10:13:34 openhab node[23467]: #033[31merror#033[39m: [Raumserver] Request was rejected:  errorMessage=Error: Media Renderer for id 'Bad' not found, errorData=null
Feb  7 10:13:42 openhab node[23467]: #033[31merror#033[39m: [Request.getRendererState] Media Renderer for id 'Bad' not found
Feb  7 10:13:42 openhab node[23467]: #033[31merror#033[39m: [Raumserver] Request was rejected:  errorMessage=Error: Media Renderer for id 'Bad' not found, errorData=null
Feb  7 10:13:42 openhab node[23467]: #033[31merror#033[39m: [Request.createZone] Exception thrown:  message=ConnectRoomToZone trigger was not triggered in a valid time!, stack=Error: ConnectRoomToZone trigger was not triggered in a valid time!
Feb  7 10:13:42 openhab node[23467]:     at Timeout._onTimeout (/home/raumfeld/node_modules/node-raumkernel/lib/lib.manager.zoneManager.js:566:37)
Feb  7 10:13:42 openhab node[23467]:     at ontimeout (timers.js:436:11)
Feb  7 10:13:42 openhab node[23467]:     at tryOnTimeout (timers.js:300:5)
Feb  7 10:13:42 openhab node[23467]:     at listOnTimeout (timers.js:263:5)
Feb  7 10:13:42 openhab node[23467]:     at Timer.processTimers (timers.js:223:10)
Feb  7 10:13:42 openhab node[23467]: #033[31merror#033[39m: [Request.createZone] Some renderers had exceptions:  message=ConnectRoomToZone trigger was not triggered in a valid time!, stack=Error: ConnectRoomToZone trigger was not triggered in a valid time!
Feb  7 10:13:42 openhab node[23467]:     at Timeout._onTimeout (/home/raumfeld/node_modules/node-raumkernel/lib/lib.manager.zoneManager.js:566:37)
Feb  7 10:13:42 openhab node[23467]:     at ontimeout (timers.js:436:11)
Feb  7 10:13:42 openhab node[23467]:     at tryOnTimeout (timers.js:300:5)
Feb  7 10:13:42 openhab node[23467]:     at listOnTimeout (timers.js:263:5)
Feb  7 10:13:42 openhab node[23467]:     at Timer.processTimers (timers.js:223:10)

I tried it willa ll 3 rooms and fails with the same error.

ChriD commented 5 years ago

Hmm.. But you can play on those rooms/renderers via the Raumfeld App? The error tells that the "createZone" does not get any response from the raumfels host...

mrumpf commented 5 years ago

Since I reset the Connector Büro, I did not restart the raumserver service. After doing that, the createZone worked on all 3 devices!

{
requestUrl: "/raumserver/controller/createZone?id=Kueche&confirm=true",
action: "createZone",
error: false,
msg: "",
data: {
context: "zone",
type: "zoneCreated",
data: {
roomUDN: "uuid:9dd7d460-3902-401b-957d-2963b4b76c3c"
},
oneShot: true,
udn: "uuid:ffffffff-d68e-534b-ffff-ffffd68e534b"
}
}

And also the Error "Media Renderer for id 'xyz' not found" went away. Thanks! 👍

This indicates an issue with the Raumserver not being able to re-establish the connection to the host. Maybe this should be done automatically by some kind of heartbeat. When the connection times out, the discovery during startup should be re-run.

And, if the system is not creating virtual renderers automatically, shouldn't the raumserver do that upon startup? Without those virtual renderers it is not possible to play anything on those devices.

ChriD commented 5 years ago

This indicates an issue with the Raumserver not being able to re-establish the connection to the host. Maybe this should be done automatically by some kind of heartbeat. When the connection times out, the discovery during startup should be re-run.

node-raumserver (in fact node-raumkernel) does reconnect automatically. This works well in my network. Maybe it has something to do how the raumfeld hist is found. There are 2 possibilities. One is via bonjour and the other is via SSDP. Not sure where the problem may reside. There is also a "ping" to a webservice on the host. When the ping is failing, a reconnection is tried. If your raumfeld host has a fixed ip you may set this ip in the raumserver config as a workaround.

And, if the system is not creating virtual renderers automatically, shouldn't the raumserver do that upon startup? Without those virtual renderers it is not possible to play anything on those devices.

If you reboot the node-raumserver the existing zones would be destroyed. Not sure if this is the best idea. It may be ok if we'd say we only create zones for rooms which are unassigned. But raumfeld/teufel doesn't do it by themself (why do they even have unassigned rooms?), so i think there may be a reason why they do so. But i may add a seeting which may handle this