I have OpenHAB 2.5 installed in a QNAP NAS (from here). It’s a brand new installation, I am new to OH2, and also new to domotic. My house has several devices that can be managed by OH2 through existing bindings.
I would like to manage my Ecoforest pellet stove as well. The problem is that I did not find any binding to do it, so I’m evaluating the possibility to develop something. I can login to the QNAP using putty and give curl -k -X commands to either check the stove status, or start/stop/change parameters, but I don’t know how to do it in OH.
For example, to change the desired room temperature:
curl -k -X POST -d "idOperacion=1019&temperatura=20.0" "https://userid:pw@10.100.10.200:8000/recepcion_datos_4.cgi"
To check status:
curl -k -X POST -d "idOperacion=1002" "https://userid:pw@10.100.10.200:8000/recepcion_datos_4.cgi"
returns several parameters that need to be parsed:
Note the -k parameter. I have to use it to disable trusted certificate checking.
Is it possible to integrate this stove in OH2 ? How ? I would like to have a working sample for a device that operates in a similar way so that I can change it for my case.
Before starting this thread I’ve tried the HTTP binding. Unfortunately some examples are obsolete (http://weather.yahooapis.com no longer exists), there are no examples to parse the status info collected with the POST method and last, but not the least, when I’ve tried this binding to issue a change temperature command it failed because the certificate could not be trusted (and I don’t know how to bypass this check). So I felt completly lost.
Furthermore I don’t know if this binding is the correct one to use for this purpose.
Here is a simple setup to manage an Ecoforest pellet stove. Requires exec and RegEx add-on’s. Can be easily expanded to support more functions and other Ecoforest models.
Tested in OH2 and OH3 with the Cordoba model.
Replace <userid>:<password>@<ip> with your own data.
ecoforest.things
//
// Stove
//
// "%2$s" will be replace by the input channel command, this makes it possible to use one command line with different arguments.
Thing exec:command:MyEcoComm "Stove command" [command="curl -s -k -X POST -d \"%2$s\" https://<userid>:<password>@<ip>:8000/recepcion_datos_4.cgi", interval=0, autorun=true]
Thing exec:command:MyEcoStat "Stove state" [command="curl -s -k -X POST -d \"idOperacion=1002\" https://<userid>:<password>@<ip>:8000/recepcion_datos_4.cgi", interval=60, transform="REGEX(.*estado=(.*?).consi.*)"]
Thing exec:command:MyEcoTemp "Stove ambient temperature" [command="curl -s -k -X POST -d \"idOperacion=1002\" https://<userid>:<password>@<ip>:8000/recepcion_datos_4.cgi", interval=60, transform="REGEX(.*temperatura=(.*?).temper.*)"]
exec.whitelist
# For security reasons all commands that are used by the exec binding or transformation need to be whitelisted.
# Every command needs to be listed on a separate line below.
curl -s -k -X POST -d "%2$s" https://<userid>:<password>@<ip>:8000/recepcion_datos_4.cgi
curl -s -k -X POST -d "idOperacion=1002" https://<userid>:<password>@<ip>:8000/recepcion_datos_4.cgi
rule "Stove switch on"
when
Item GF_LivingDining_Stove changed to ON
then
if (GF_LivingDining_Stove_Stat.state == "0"){
GF_LivingDining_Stove_Args.sendCommand("idOperacion=1013&on_off=1")
}
end
rule "Stove switch off"
when
Item GF_LivingDining_Stove changed from ON to OFF
then
if (GF_LivingDining_Stove_Stat.state == "7"){
GF_LivingDining_Stove_Args.sendCommand("idOperacion=1013&on_off=0")
}
end
rule "Update stove status"
when
Item GF_LivingDining_Stove_Stat changed
then
// Stove can also be managed by other tools, let's update OpenHAB accordingly
if (GF_LivingDining_Stove_Stat.state == "0" && GF_LivingDining_Stove.state != OFF){
// Stove has been switched off
GF_LivingDining_Stove.sendCommand(OFF)
} else if (GF_LivingDining_Stove_Stat.state == "7" && GF_LivingDining_Stove.state != ON){
// Stove has been switched on
GF_LivingDining_Stove.sendCommand(ON)
}
end