How come the altitude calculation is wrong? Is my sensor broken?
No, your sensor is likely just fine. The altitude calculation depends on knowing the barometric pressure at sea level
If you do not set the correct sea level pressure for your location FOR THE CURRENT DAY it will not be able to calculate the altitude accurately
Barometric pressure at sea level changes daily based on the weather!