Thermostat webthing for arduino

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?

1 Like

It seams the thermostat coding for arduino is a dark zone.
At least, maybe someone can share a link where I can find a thermostat coding example.
:grinning:

Problem solved by myself.
Now my thermostat webthing is working and looking like this:

2 Likes

Is this a native thermostat webthing?
What was wrong with your code?

1 Like

It’s not a native thermostat webthing.
More specific it’s an emulated thermostat that fits my needs. As you can see there’s no target temperature, but that can be achieved with a level property for example.
A native thermostat should look like bellow (image from the web) with an orange target temps square: