Add upper and lower ts to sensors table.
Store entity_id in history as part of sensor id.