I need to install new wifi thermostat but I don't have the C wire. There are G, W, Y and R wires attached to my old thermostat. There is also one blue wire not connected on the wall.
Home Improvement Stack Exchange is a question and answer site for contractors and serious DIYers. It only takes a minute to sign up.Sign up to join this community
The blue one attached to the terminal labelled "Comm" in your first picture is your C wire (C stands for "common").
So in your last picture, just screw that blue wire into the C terminal and you're good to go.
On another note, also make sure that you followed the wiring instructions included with your new thermostat - don't just match up the colors assuming it will work. And double check that you wired it correctly according to the instructions for your HVAC system type (heat pump, furnace, etc), and set it up accordingly in the software as well.