There is an example for your use case https://docs.platformio.org/en/latest/scripting/examples/custom_program_name.html