companion icon indicating copy to clipboard operation
companion copied to clipboard

Bonjour device suggestions

Open Julusian opened this issue 1 year ago • 4 comments

Is this a feature relevant to companion itself, and not a module?

  • [X] I believe this to be a feature for companion, not a module

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the feature

Building on #2087

For any devices which are announced via bonjour, it could be nice to have a tab in the ui which does auto discovery with 'one click' to setup as an instance.

It should be done such that it doesnt need to run any module code, but I expect that to be possible by adding some properties to the metadata.json file of the module.

Perhaps something like:

{
  "bonjour": {
    "service": {
      "type": "blackmagic",
      "protocol": "udp",
    },
    "config": {
      "useHostname": false, // whether to use the `something.local` address or the ip address
      "hostField": "host", // the name of the config field to fill in with the address
      "portField": "port" // the name of the config field to fill in with the port
    }
  }
}

Usecases

No response

Julusian avatar Aug 07 '22 16:08 Julusian

Yeah, I looked at this a year or so ago. Something like this is what I expected was needed for a core mdns discovery system. I didn't get far enough in terms of collecting mdns packets in order to ensure we covered the appropriate parameters and parsing to pass these through.

krocheck avatar Aug 07 '22 17:08 krocheck

If we limit it to bonjour and not direct mdns, then that simplifies things. Some example output from https://www.npmjs.com/package/bonjour-service

[
  {
    addresses: [ '10.0.0.1' ],
    rawTxt: [
      <Buffer 74 78 74 76 65 72 73 3d 31>,
      <Buffer 6e 61 6d 65 3d 42 6c 61 63 6b 6d 61 67 69 63 20 41 54 45 4d 20 32 20 4d 2f 45 20 43 6f 6e 73 74 65 6c 6c 61 74 69 6f 6e 20 48 44>,
      <Buffer 63 6c 61 73 73 3d 41 74 65 6d 53 77 69 74 63 68 65 72>,
      <Buffer 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 3d 30 2e 30>,
      <Buffer 72 65 6c 65 61 73 65 20 76 65 72 73 69 6f 6e 3d 38 2e 37>,
      <Buffer 64 65 76 69 63 65 20 76 65 72 73 69 6f 6e 3d 32 35 36>,
      <Buffer 75 6e 69 71 75 65 20 69 64 3d 35 33 61 66 39 63 33 39 30 35 36 30 34 38 35 65 38 64 65 61 36 63 38 37 37 65 33 63 33 62 63 38>,
      <Buffer 69 6e 74 65 72 6e 61 6c 20 76 65 72 73 69 6f 6e 3d 31 37 66 35 38 33 63 32>
    ],
    txt: {
      txtvers: '1',
      name: 'Blackmagic ATEM 2 M/E Constellation HD',
      class: 'AtemSwitcher',
      'protocol version': '0.0',
      'release version': '8.7',
      'device version': '256',
      'unique id': '53af9c390560485e8dea6c877e3c3bc8',
      'internal version': '17f583c2'
    },
    name: 'ATEM 2 M/E Constellation HD',
    fqdn: 'ATEM 2 M/E Constellation HD._blackmagic._tcp.local',
    host: 'ATEM-HDC-7c2e0da607d4.local',
    referer: { address: '10.0.0.1', family: 'IPv4', port: 5353, size: 386 },
    port: 9910,
    type: 'blackmagic',
    protocol: 'tcp',
    subtypes: []
  }
]

{
  addresses: [ '10.0.0.1' ],
  rawTxt: [
    <Buffer 69 64 3d 35 45 42 43 35 35 43 39 31 36 46 38 35 31 36 45 41 35 45 44 45 34 44 45 46 42 30 32 33 31 34 46>,
    <Buffer 55 44 53>,
    <Buffer 43 47 53>
  ],
  txt: {
    id: '5EBC55C916F8516EA5EDE4DEFB02314F',
    UDS: undefined,
    CGS: undefined
  },
  name: '5581117e-aa7c-37d8-f385-822e198526b8',
  fqdn: '5581117e-aa7c-37d8-f385-822e198526b8._googlezone._tcp.local',
  host: '5581117e-aa7c-37d8-f385-822e198526b8.local',
  referer: { address: '10.0.0.1', family: 'IPv4', port: 5353, size: 214 },
  port: 10001,
  type: 'googlezone',
  protocol: 'tcp',
  subtypes: []
}
 {
  addresses: [ '10.0.0.1' ],
  rawTxt: [
    <Buffer 56 45 52 53 49 4f 4e 3d 31 2e 30>,
    <Buffer 43 50 61 74 68 3d 2f 73 70 6f 74 69 66 79 7a 63>
  ],
  txt: { VERSION: '1.0', CPath: '/spotifyzc' },
  name: 'sonos000E58AF704A',
  fqdn: 'sonos000E58AF704A._spotify-connect._tcp.local',
  host: 'sonos000E58AF704A.local',
  referer: { address: '10.0.0.1', family: 'IPv4', port: 5353, size: 708 },
  port: 1400,
  type: 'spotify-connect',
  protocol: 'tcp',
  subtypes: []
}

If we want to go with mdns instead of bonjour, that does add more complexity to our code, and to figuring out how to combine the data in a sane way to modules.

Julusian avatar Aug 07 '22 17:08 Julusian

Just stubbled across this 'issue' I've implemented bonjour in the ecamm-live module. Pretty straightforward but would be nice to put into the core instead of each module

JeffreyDavidsz avatar Aug 08 '22 19:08 JeffreyDavidsz

For others finding this, it's been much simplified as per this note:

          This is possible in 3.2 (current beta builds)

https://github.com/bitfocus/companion-module-base/wiki/Bonjour-device-discovery

Originally posted by @Julusian in https://github.com/bitfocus/companion/issues/2087#issuecomment-1764212355

Hopefully when a critical mass has gathered for that, it will be worth creating the suggested devices dialogue (if that point hasn't been hit already)...

peternewman avatar Mar 17 '24 00:03 peternewman