Closed wagemakersjpmaa closed 1 week ago
The only thing that changed is that you now have to send an empty post data body with the get-like syntax.
Since your curl command is working, this is more a question for the ninja2/HomeAssistant script wizzards....
If you look at my HomeAssistant integration you will see that the post requests used there still work in >=3.6.0
If you find a solution I'll be happy to update it in the repository...
Describe the bug Using this code for posting the current via ESPHOME is no longer working:. I use this code up to v3.5.1: interval:
interval: 4sec then:
http_request.post: url: !lambda |- std::string url; float current_l1 = (id(power_delivered_l1).state - id(returned_l1).state) / id(voltage_l1).state 1000; float current_l2 = (id(power_delivered_l2).state - id(returned_l2).state) / id(voltage_l2).state 1000; float current_l3 = (id(power_delivered_l3).state - id(returned_l3).state) / id(voltage_l3).state * 1000;
I assume this has to do with the changed POST command. I changed it to: interval:
interval: 4sec then:
http_request.post: url: !lambda |- std::string url; float current_l1 = (id(power_delivered_l1).state - id(returned_l1).state) / id(voltage_l1).state 1000; float current_l2 = (id(power_delivered_l2).state - id(returned_l2).state) / id(voltage_l2).state 1000; float current_l3 = (id(power_delivered_l3).state - id(returned_l3).state) / id(voltage_l3).state * 1000;
headers: Content-Type: application/x-www-form-urlencoded body: !lambda |- std::string body; body.append("L1="); body.append(std::to_string(rounded_current_l1)); body.append("&L2="); body.append(std::to_string(rounded_current_l2)); body.append("&L3="); body.append(std::to_string(rounded_current_l3)); return body.c_str();
Upload your config {"version":"v3.6.1","serialnr":6766,"mode":"SOLAR","mode_id":2,"car_connected":true,"wifi":{"status":"WL_CONNECTED","ssid":"IOT","rssi":-51,"bssid":"18:E8:29:CD:F3:3B"},"evse":{"temp":34,"temp_max":65,"connected":true,"access":true,"mode":2,"loadbl":0,"pwm":1024,"solar_stop_timer":0,"state":"Charging Stopped - Waiting for Solar","state_id":9,"error":"None","error_id":0,"rfid":"Not Installed"},"settings":{"charge_current":0,"override_current":0,"current_min":6,"current_max":25,"current_main":25,"current_max_circuit":25,"current_max_sum_mains":600,"solar_max_import":0,"solar_start_current":24,"solar_stop_time":5,"enable_C2":"Not present","modem":"Not present","mains_meter":"API","starttime":0,"stoptime":0,"repeat":0},"mqtt":{"host":"192.168.1.201","port":1883,"topic_prefix":"SmartEVSE-6766","username":"mqtt","password_set":true,"status":"Connected"},"home_battery":{"current":0,"last_update":0},"ev_meter":{"description":"Eastron3P","address":14,"import_active_power":0,"total_kwh":1662.699951,"charged_kwh":0,"currents":{"TOTAL":0,"L1":0,"L2":0,"L3":0},"import_active_energy":1662.699951,"export_active_energy":0},"mains_meter":{"import_active_energy":0,"export_active_energy":0},"phase_currents":{"TOTAL":480,"L1":160,"L2":160,"L3":160,"last_data_update":1717682273,"original_data":{"TOTAL":480,"L1":160,"L2":160,"L3":160}},"backlight":{"timer":120,"status":"ON"}} Upload a debug log
To Reproduce Steps to reproduce the behavior: POST via ESP home
Expected behavior Posted currents via API. When I post by hand I get curl -X POST "http://192.168.4.138/currents?L1=160&L2=160&L3=160" -d ''
{"original":{"L":160,"":160,"SMART":160},"L":160,"":160,"SMART":160,"TOTAL":480}