Open pierrei opened 6 months ago
The ping also polls the mesh for the current state, so in case the discovery was of a device which just joined the network you would get the state from that immediately.
I'll need to think about if this can be removed entirely without performance impact or if there are other solutions - e.g. a rate limit...
Ah, so that's why! I was guessing it was there for a reason š
One alternative I was thinking was to have manager.add_mesh_device()
return a boolean that would be true if the device was actually added and false if it is in the registry already. I guess in this case it would ping only when true - that should also solve it.
Related to https://github.com/thomasloven/hass-plejd/issues/66.
It seems that doing a ping when a new device is discovered causes flooding of Bluetooth traffic. Not sure if this happens to everyone but for me I get quite a lot of "discovered" events, even from Bluetooth devices that are not Plejd. Every time this happens it triggers a ping, which in turn discovers more devices.
I added some logging in the
_discovered
function and this is a sample of what I see in my HA logs:I don't know why the ping was added in the first place, but I've removed it and has been running flawlessly on my HA for weeks now.