I’ve been trying to set up a POST request from an item using the HTTP binding in OpenHAB 3.4, but it’s not working as expected. Let me walk you through my setup and what I’ve observed so far.
Setup Details:
I’m using the HTTP binding to interact with an EVCC instance running on the same host. My goal is to trigger vehicle recognition on EVCC. Here’s how my HTTP thing is configured:
plaintext
UID: http:url:evcc
label: HTTP-evcc
thingTypeUID: http:url
configuration:
authMode: BASIC
ignoreSSLErrors: false
baseURL: http://localhost:7070/api
delay: 0
ignoreSSLError: true
stateMethod: GET
refresh: 5
commandMethod: POST
contentType: text/plain
timeout: 3000
bufferSize: 4096
Channels Configuration:
I have two channels set up:
VehicleOn_0
(WRITEONLY mode) to trigger vehicle recognition.Zielenergie_0
(READWRITE mode) to set the target energy.
Observations:
When I update the Zielenergie_0
item, everything works perfectly. The HTTP binding sends a POST request, and EVCC updates the target energy accordingly. However, when I try to update the VehicleOn_0
item, there’s no POST request being sent. The logs only show that the item’s state has changed, but no request is initiated.
Logs for Zielenergie_0
:
plaintext
2023-01-03 12:37:15.222 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘evcc_EinfahrtZielenergy’ received command 1
2023-01-03 12:37:15.224 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘evcc_EinfahrtZielenergy’ predicted to become 1
2023-01-03 12:37:15.243 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘evcc_EinfahrtZielenergy’ changed from 0 to 1
…
2023-01-03 12:37:15.302 [TRACE] [nding.http.internal.HttpThingHandler] - Sending to ‘http://localhost:7070/api/loadpoints/0/targetenergy/1’: Method = {POST}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.46.v20220331, Content-Type: text/plain}, Content = {1}
2023-01-03 12:37:15.317 [TRACE] [p.internal.http.HttpResponseListener] - Received from ‘http://localhost:7070/api/loadpoints/0/targetenergy/1’: Code = {200}, Headers = {Content-Encoding: gzip, Content-Type: application/json; charset=UTF-8, Vary: Accept-Encoding, Date: Tue, 03 Jan 2023 11:37:15 GMT, Content-Length: 37}, Content = {“result”:1}
Logs for VehicleOn_0
:
When I update the VehicleOn_0
item, there’s no indication that the HTTP binding is attempting to send a POST request. The logs only show the state change without any further action:
plaintext
2023-01-03 12:38:05.507 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘evcc_EinfahrtErkanntesAuto’ received command 1
2023-01-03 12:38:05.510 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘evcc_EinfahrtErkanntesAuto’ predicted to become 1
2023-01-03 12:38:05.513 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘evcc_EinfahrtErkanntesAuto’ changed from 0 to 1
…
2023-01-03 12:38:08.131 [TRACE] [ttp.internal.http.RefreshingUrlCache] - Requesting refresh (retry=false) from ‘http://localhost:7070/api/state’ with timeout 3000ms
…
What I’ve Tried So Far:
- Checked Logs: The logs for
VehicleOn_0
don’t show any attempt to send a POST request, which is puzzling since the channel is configured similarly toZielenergie_0
. - Verified Configuration: I’ve double-checked the channel configurations to ensure there are no typos or misconfigurations.
- Enabled TRACE Logging: I enabled TRACE logging for the HTTP binding to get more detailed logs, but it still doesn’t show any activity for
VehicleOn_0
.
Possible Issues:
- Permissions or API Limitations: The EVCC API might not support the specific endpoint or method required for vehicle recognition. However, I’ve confirmed that the endpoint exists and works when accessed directly.
- Channel Mode Configuration: The
VehicleOn_0
channel is set to WRITEONLY, which should work for sending commands. But perhaps there’s an issue with how the binding handles WRITEONLY channels. - Binding Compatibility: Could there be a bug in the HTTP binding for OpenHAB 3.4 that affects certain configurations?
Next Steps:
- Test with a Different Item: I’ll try linking a different item to
VehicleOn_0
to see if the issue persists. - Check EVCC API Response: I’ll monitor the EVCC API logs to see if it receives any requests when
VehicleOn_0
is updated. - Consult Documentation and Community: I’ll review the HTTP binding documentation and reach out to the OpenHAB community forums for insights.
If anyone has encountered a similar issue or has suggestions, I’d greatly appreciate your input! Let’s figure this out together.