i2c was designed for communication between integrated circuits on the same printed circuit board. Think in mm not cm.
Of course people have gotten it to work at a meter and even many meters.
The log message is your clue. It is literally telling you the communication failed. That is most likely because the wiring AND/OR environment it is in is not “good” enough to work.
The nice thing about digital communication is it either works or doesn’t. This sounds good until you are at the edge of working. Then it sometimes works and sometimes doesn’t, which can be incredibly frustrating.
You didn’t include a picture of your setup/wiring so we can’t see what you are nor what you might be missing.
Now i’ve taken down the sensor and will try connecting it using twisted pairs from a Cat 5e ethernet cable. If it still doesn’t work, what is the best way to wire a sensor like this outdoors? Do i need to change the type of sensor?
Outdoors or indoors, the wiring is same. If you post photos that show your wiring/soldering/other connections, logs and answer ALL questions, I’m pretty sure your problem gets solved quickly.