Hi everyone,
I try to configure charging of the battery from grid, which requires the following http command:
curl --location 'https://192.168.178.78/lala.cgi' \
--header 'Content-Type: application/json' \
--data '{
"ENERGY": {
"SAFE_CHARGE_FORCE": "u8_01"
}
}'
Now there are several options:
- create switch item without channel connection and trigger http post action in a rule
.items
Switch SenecHome_Battery_Charging "Charge battery from grid"
.rules
rule "Charge battery from grid"
when
Item SenecHome_Batterie_Laden received command ON
then
val url = "https://192.168.178.78/lala.cgi"
val content = '{"ENERGY":{"SAFE_CHARGE_FORCE": "u8_01"}}'
sendHttpPostRequest(url, "application/json", content)
end
This does not work, because I get the following error:
2023-11-29 12:01:58.722 [ERROR] [enhab.core.model.script.actions.HTTP] - Fatal transport error: java.util.concurrent.ExecutionException: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
The certificate of the senec is not valid / self signed or something similar. I am not really familiar with it.
next try:
2. configure a http switch thing
tried:
.things:
Thing http:url:senec_batt_charge "Senec Home Battery charging" [
baseUrl="https://192.168.178.78/lala.cgi",
commandMethod="POST",
contentType="application/json",
ignoreSSLErrors=true ]
{
Channels:
Type switch : Charge_Battery "Charge battery from grid" [
commandTransformation="MAP:senec_batt.map",
stateContent="",
mode="WRITEONLY"
]
}
senec_batt.map:
ON: {"ENERGY": {"SAFE_CHARGE_FORCE": "u8_01"}}
OFF: {"ENERGY": {"SAFE_CHARGE_PROHIBIT": "u8_01"}}
Actually, I could not find any configuration example for a switch on the www.
My apporach didn’t work, log tells:
Thing 'http:url:senec_batt_charge' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_CONFIGURATION_PENDING): {baseURL=Der Parameter wird benötigt.}
sorry for German
Next try could be adding a new switch channel to the senec-home binding. But that would cost me a lot of time - I have absolutely no experience with binding development.
Someone can help me to get one of the first two solutions running?
My system: OH 4.1.0 M3