We propose a sensornet programming model based on declarative spatio-temporal constraints on events only, not sensors. Where previous approaches conflate events and sensors because they are often colocated, a focus on events allows programmers to specify their intent more directly, and better supports remote sensing devices such as cameras, microphones, and rangefinders. In our model, complex events are specified as aggregations of events in time or space, without regard to sensor locations or communication paths. New techniques are required to aggregate events based on these constraints without knowledge of nearby nodes. We present a decentralized, scalable event detection framework that allows for efficient in-network aggregation without coupling events and sensors. First, we describe a SQL-style declarative language with spatio-temporal constraints between events that can be used to express complex events. Next, we show how these complex events can be assembled efficiently. The dis...