Upload to the correct sensor

Fixes #369

Also improves reporting in preparation for #345

Moves away from using object metadata and instead uses plain maps to
pass around metadata.

Fixes for authentication issues as well.

Not updating devices and sensors at the moment.