Recent technological advances have enabled the creation of networks of sensor devices. These devices are typically equipped with basic computational and communication capabilities. Systems based on these devices can deduce high-level, meaningful information about the environment that may be useful to applications. Due to their scale, distributed nature, and the limited resources available to sensor devices, these systems are inherently complex. Shielding applications from this complexity is a challenging problem. To address this challenge, I present a middleware called SPS (State-based Publish/Subscribe). It is based on a combination of a State-Centric data model and a Publish/Subscribe (Pub/Sub) communication paradigm. I argue that a state-centric data model allows applications to specify environmental situations of interest in a more natural way than existing solutions. In addition, Pub/Sub enables scalable many-to-many communication between sensors, actuators, and applications.