Changes sensor parsing if blocks to a switch statement using case