Device detection - personalised message

Hi. I’ve been hacking around with some python code to create a module that can pick up a known device (via MAC address) and if detected push up a message. Having no Python experience it’s been trial and error. It’s working but only just! Two problems are that when it’s publishing the result it appears to be flicking between the MAC detected message and MAC not detected message. Also when Python is calling the ‘import bluetooth’ line it appears to be conflicting with the Pi’s WIFI (as speeds drop to next to nothing). I’m running a Pi3. Appreciate both of these are not core MagicMirror issues - but just throwing them here if of interest to anyone, or someone can help.