Internet of Things (IoT) systems may be deployed to monitor spatially distributed quantities of interests (QoIs), such as noise or pollution levels. This paper considers a fog-based IoT network, in which active IoT devices transmit measurements of the monitored QoIs to the local edge node (EN), while the ENs are connected to a cloud processor via limited-capacity fronthaul links. While the conventional approach uses preambles as metadata for reserving communication resources, here we consider assigning preambles directly to measurement levels across all devices. The resulting Type-Based Multiple Access (TBMA) protocol enables the efficient remote detection of the QoIs, rather than of the individual payloads. The performance of both edge and cloud-based detection or hypothesis testing is evaluated in terms of error exponents. Cloud-based hypothesis testing is shown theoretically and via numerical results to be advantageous when the intercell interference power and the fronthaul capacity are sufficiently large.