I try to implement an arduino thermostat code as a webthing into ESP8266.
My code looks like this:
const char* sensorTypes = {“Thermostat”, nullptr};
ThingDevice heatdevice(“heatdevice”, “Incalzirea centrala”, sensorTypes);
ThingProperty heatpump(“Pump”, “”, BOOLEAN, “BooleanProperty”);
ThingProperty heattemp(“Temperatura”, “”, NUMBER, “TemperatureProperty”);
ThingProperty heattarget(“Temperatura”, “”, NUMBER, “TargetTemperatureProperty”);
ThingProperty heatcooling(“Mod”, “”, STRING, “HeatingCoolingProperty”);void setup()
{
…
ThingPropertyValue tmpvalue = {.integer = 43};
heattemp.setValue(tmpvalue);
heattemp.title = “Whater temp”;
heatdevice.addProperty(&heattemp);ThingPropertyValue targetvalue = {.integer = 60};
heattarget.setValue(targetvalue);
heatdevice.addProperty(&heattarget);ThingPropertyValue modvalue;
modvalue.string = &heating;
heatcooling.setValue(modvalue);
heatdevice.addProperty(&heatcooling);ThingPropertyValue initialOn = {.boolean = false};
heatpump.setValue(initialOn);
heatpump.readOnly = “true”;
heatpump.title = “Pump”;
heatdevice.addProperty(&heatpump);adapter->addDevice(&heatdevice);
adapter->begin();
But my thermostat is looking like this:
Why the target temperature is not displayed. And the pump (a boolean as an on/off property) is not displayed also?
The value of heattemp was initialized with an integer (43), but the webthing is displaying zero. Why?
What’s wrong with my code?