Closed ebaauw closed 6 years ago
@ebaauw When I write that, I was looking at this to determine if the passed object was an Accessory ( Platform V2 API ) or a Service ( Accessory API). I realize it could be a little more elegant, but for my plugins it seems to work.
https://github.com/KhaosT/HAP-NodeJS/blob/master/lib/Accessory.js#L237
Ok, this would be a differece between platforms with dynamic accessories vs static accessories. Could we check for either?
Sorry, I cannot help on that, I have only static plugins
Are they recognised as platform or as accessory? For static plugins you would have getServices()
as you don’t have accees to the hap.Accessory
object.
They all have getServices()
Ok, so the platform part is meant only for dynamic platforms.
I want to use a different filename, based on the device unique ID (ZigBee mac address) instead of on the (user changeable!) accessory name. I managed this by setting the accessory.displayName, but now it also shows the history service (007) under the ID. I figured I could create the 007 service myself, and fakegato-history would pick it up: https://github.com/simont77/fakegato-history/blob/8e88a4a24c79b484b1a4acf3a2e7af77256c04ec/fakegato-history.js#L440-L448
However, my platform plugin is recognised as accessory plugin. Shouldn't line 440 check for
getServices()
instead ofgetService()
?https://github.com/nfarina/homebridge/blob/b670ec1036135b0df06094f1738d7c93499c3a39/lib/server.js#L388