Since each section of the office had its own central switch that would switch the water in the pipes that flowed to the FCUs, this had to be controllable from the backend server as well. Using a latching relay configuration, it was possible to both switch between heating and cooling configurations, as well as have a memory element that could be read out by the node:

This system was assembled on a single board that was used to replace the original manual switch, using the following module to control it:

#include "base_module.h" class SwitchModule {    static String publishTopic; public:    static bool initialize();    static bool start();    static bool shutdown();    static void commandCallback(String message); };

Its implementation is as follows: ...

Get Hands-On Embedded Programming with C++17 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.