updated library to handle switches and sensors