WebThingsIO / thing-url-adapter

Proxy adapter for Web Thing API endpoints
Mozilla Public License 2.0
22 stars 18 forks source link

Remove devices removes them until restart #19

Closed hobinjk closed 6 years ago

hobinjk commented 6 years ago

loadThing is only called on advertisement which doesn't happen that often so my first approach didn't work. This will require a bit more work than anticipated (or just duplicated devices storage come to think of it)

mrstegeman commented 6 years ago

Yeah, we need to restart the mDNS and Eddystone searches in startPairing() and add any devices we don't already (or no longer) know about.

mrstegeman commented 6 years ago

Or yes, duplicate the device list and copy the deleted ones back in on startPairing().

hobinjk commented 6 years ago

Restarting the searches sounds like the better approach even if it is more work

hobinjk commented 6 years ago

Although it won't handle the case I ran into which is that the thing description doesn't change but the device is no longer present

hobinjk commented 6 years ago

(but that can be worked around too)

hobinjk commented 6 years ago

Unfortunately restarting the searches doesn't work (at least for dnssd). dnssd does provide a list() function that would work to regenerate the devices list. Eddystone doesn't provide a similar function but restarting the search may work for it. Given that both of these workarounds are convoluted and library-specific I'm just going to go with the duplicate devices list.