Drupal 11 and LED Lights: Building a REST-Controlled Lighting Interface
Hash Bang Code dives into a fascinating Drupal 11 project that blends IoT and web development: controlling a Pimoroni Plasma 2350 W LED light strip through a custom REST service. The project involved creating a Drupal module with a colour selection form that stores hex values using the state service, and exposes the selected colour via a REST endpoint. Form abuse is mitigated using Drupal’s flood service, and the REST response is kept dynamic by using ModifiedResourceResponse to avoid caching for anonymous users.
On the hardware side, the Plasma 2350 W runs a MicroPython script that polls the Drupal endpoint every 20 seconds, parses the colour from JSON, and updates the LED strip accordingly. All of this is publicly accessible—the colour-changing form lives at /plasma/set-colour, and anyone can try changing the LED colour remotely. With plans to expand into brightness and pattern control, this project offers a hands-on example of how Drupal’s flexibility can extend far beyond websites into physical, interactive systems.


