I am working, together with other AFOL, to develop various sensors (magnetic, proximity, laser) that enter the dimensions of a 2x4 brick and are powered to 9v.
The sensors implement MQTT communication via WiFi.
The Raspberry Pi 3B + system, with Node-Red and Mosquitto, functions as a message center and control logic between sensors and motors.
This is the proxymity sensor based on Broacom ADPS9960 colors & proximity sensor.
The ESP8266 chip act as WiFi client connected to an MQTT broker (running on Raspeberry) and send MQTT messages when the sensor is activated.