Hi guys,
RoPieee uses the Roon API to interact with Roon for those users that have the touchscreen connected. Recently I’m getting reports of strange behavior and I’ve been searching in my extension. And I’m seeing some things that I can’t explain. I really hope this is just me being very stupid, but I think the extension is not behaving like it should be wrt pairing functionality.
To make it easier to discuss this I took the example from Roon’s github page. One change: for (my) clarity’s sake I’ve put what’s happening in the ‘on_pair’ callback in a separate function.
If I run the extension with a single core everything is working as expected. As soon as I introduce another core thinks do not work as I expect.
So here’s the scenario:
- start the extension with 1 running core
- enable the extension
- core_paired is being called
- start playing some content
- extension shows continuous updates
- start a second core
- enable the extension
- pair the extension
And here the confusion starts. Upon pairing the extension on the second core I would expect first that the ‘core_paired’ function is called and obviously the ‘core_unpaired’ is being called from the first core.
But nothing of that is happening. So what you see is that the core is being paired to the second core, but information is coming still from the first core!
So either I don’t understand how the pairing functionality is working… or something is broken. Would love some feedback on this!
// vim:ft=javascript:ts=3:sw=3:sts=3:et
"use strict";
var core;
var transport;
var RoonApi = require("node-roon-api"),
RoonApiStatus = require("node-roon-api-status"),
RoonApiTransport = require("node-roon-api-transport");
var roon = new RoonApi({
extension_id: 'com.elvis.test',
display_name: "Elvis's First Roon API Test",
display_version: "1.0.0",
publisher: 'Elvis Presley',
email: 'elvis@presley.com',
website: 'https://github.com/elvispresley/roon-extension-test',
core_paired: function(_core) {
console.log("CORE_PAIRED: " + _core.display_name);
core = _core;
transport = core.services.RoonApiTransport;
transport.subscribe_zones(subscribe_zones);
},
core_unpaired: function(_core) {
console.log("CORE_UNPAIRED: " +_core.core_id,
_core.display_name,
_core.display_version,
"-",
"LOST");
}
});
var svc_status = new RoonApiStatus(roon);
roon.init_services({
required_services: [ RoonApiTransport ],
provided_services: [ svc_status ],
});
svc_status.set_status("All is good", false);
roon.start_discovery();
// let's see what Roon got for us
function subscribe_zones(cmd, data) {
console.log(core.core_id,
core.display_name,
core.display_version,
"-",
cmd,
JSON.stringify(data, null, ' '));
}
Regards Harry