My attempts are as follows.
First attempt was using POST urls like:
http://bedroom-heatpump.lan/climate/bedroom_heatpump/set?fan_mode=AUTO
Unfortunately while esphome gives an http 200 code for that, it doesn’t do anything. Digging in the code we find that anything other than mode and temps aren’t implemented:
: https://esphome.io/api/web__server_8cpp_source.html line 818
void WebServer::handle_climate_request(AsyncWebServerRequest *request, const UrlMatch &match) {
for (auto *obj : App.get_climates()) {
if (obj->get_object_id() != match.id)
continue;
if (request->method() == HTTP_GET) {
std::string data = this->climate_json(obj, DETAIL_STATE);
request->send(200, "application/json", data.c_str());
return;
}
if (match.method != "set") {
request->send(404);
return;
}
auto call = obj->make_call();
if (request->hasParam("mode")) {
String mode = request->getParam("mode")->value();
call.set_mode(mode.c_str());
}
if (request->hasParam("target_temperature_high")) {
String value = request->getParam("target_temperature_high")->value();
optional<float> value_f = parse_number<float>(value.c_str());
if (value_f.has_value())
call.set_target_temperature_high(*value_f);
}
if (request->hasParam("target_temperature_low")) {
String value = request->getParam("target_temperature_low")->value();
optional<float> value_f = parse_number<float>(value.c_str());
if (value_f.has_value())
call.set_target_temperature_low(*value_f);
}
if (request->hasParam("target_temperature")) {
String value = request->getParam("target_temperature")->value();
optional<float> value_f = parse_number<float>(value.c_str());
if (value_f.has_value())
call.set_target_temperature(*value_f);
}
this->schedule_([call]() mutable { call.perform(); });
request->send(200);
return;
}
request->send(404);
}
My next attempt was using a text input as a proxy. Basically use the text input and have lambda process the values submitted through the text input, That ran into the problem of discovering there are no text inputs for Esphome. Inputs that might take a string input like a select process the value and error out before an lambdas get a chance to do magic.
Looked at updating the values through the Native API. Used protbufc to generate the JS files from the api.proto file but they were massive, and I don’t think I’d have much luck shrinking it down, nor porting it to a browser environment. Tried rolling my own, but couldn’t get past the greeting part of the the protocol.
Needless to say a lot of trouble for a big nada, but I learned a lot.
Any other avenues I should look at? Planning to just make surrogate selects that control the other climate controls through lambda, but was hoping for a direct approach.