Added sensor type caching and improved sensor data insertion to use the auto incremented id