For example, I created a led flashing app via firebase over internet. I want the app to be able to control only the device it's paired with (esp8266 etc). No need to make one app for each device.
..... what are you using to communicate with the device Rustem? WiFi? Bluetooth?
You will need to identify the device via an ID. If using Bluetooth, your App can list all compatible devices in the vicinity and you can choose the specific device of interest.