UniFi UI allows people to create device names with blanks - of course these don't end up as valid hostnames. This is a very simplistic fix that replaces blanks with underscores. It allows for piggyback processing of the devices.
Writing the check_mk section no longer gives the desired results. See https://checkmk.com/de/werk/13705