first draft with API for sensors and proper json encoding