"the firmware needs to be able to read the hardware version"
This will cover the PLC hardware version. But it doesn't address the hardware configuration of the overall system. Particularly, wiring and component revisions outside of the controller itself. PLC firmware can be controlled automatically. But not so the ladder logic, which may be the 'software' of concern to the OP.