First, please post code according to the following post and GIF example so we can read it.
That being said, yes you do need to adjust your HomeKit configuration (which is not part of the code you posted). You can set what devices are sent to HomeKit from there.