Parameterized - IoT Confrigurator

The following is intended to illustrate the capabilities of my parameterized IoT configurator with an actual use. I recently wanted to measure the temperature and humidity in my house. I live in the Dominican Republic and like many houses mine is not air-conditioned except for the bedrooms as-needed.

I am interested in the temperature/humidity patterns inside so I can adapt myself and my rooms to maximize comfort and minimize electricity costs.

I used my confirator and library of IoT components to prepare my sensors software and then collect and  analyze my data and ultimately act on that data.  The following steps illustrate the capabilities of my components:

Step 1:
I chose an ESP32 with WiFi and a bunch of memory for my hardware platform, a DHT22 sensor for measuring temperature and humidity and an OLED 64x128 display.  The hardware was cheap. I used a small project box and a 3D printed enclosure for the display.

I then used my parameterized configurator to combine an ESP32 software platform with 3 services: DHT22, OLED display and MQTT. I had previously written those components but this is the first time I combined them. Here is the surprise: I did not write any new code for this project!

I used my configurator to choose software components from my library and it wrote the code. My library components are each 2 files file1 is primarily  the prompts for name value pairs. Each prompt includes the name, default value, regex to validate and descriptive text. That file also contains rules for consumption of resources like pins used that is later used to test for resource conflicts. File2 is the source code with references to name/values.  Thus, the name values and code are used together to produce a working service.  And each service participates with a pub/sub event driven platform.

Here is the first file for my dht22 sensor:

     <namevalue> <DHTPIN>                 <23> 
             <pin number for data from 0 to 99>
     <namevalue> <DHTTYPE>               <DHT22>   
             <Type of DHT; Types defined in DHT library>
     <namevalue> <INSTANCENAMEOUTQUOTED>  <"mqtt"> 
              <\A"[0-9A-Za-z]+"\Z> <Where to send the write event>
     <description> <This DHT22 is a one-wire device for measuring temperature and
                          humidity; the sensor or driver is finicy so there is some 
                         error recovery included.>
    <resource> <DHTPIN>  <\A[0123456789]\Z|\A[0123456789][0123456789]\Z> <PIN$0>                                       <exclusive>

Here is the DHT22 sensor code:

//===== DHT22 Sensor Implements:
//          constructor
//          event listener
//      (vdd)=(data)=(NC)=(Gnd) 
#include "DHTesp.h"
DHTesp dht; 
    CLASSNAME() {    
        queueEvent(2, INSTANCENAMEQUOTED,0, INSTANCENAMEQUOTED, "read", "");

Read more »