Skip to content

push MQTT settings via API #3129

Description

@Esc4pe

What happened?

Was actually trying to figure out why mqtt does not reconnect when my mqtt server becomes unavailable like during a server reboot. Did not find the reason yet but this popped up when I built a workaround:

GET /api/mqtt/config returns a JSON document that cannot be POSTed back unchanged using the documented API when mqtt_root_ca_cert is populated. The form parser fails with 1002 No values found! because the data parameter becomes too large. This happens even when mqtt_tls is false.

To Reproduce Bug

curl http://IP_OF_DTU/api/mqtt/config
-H "Authorization: Basic XXXXXXX" > mqtt.json

curl -i -X POST http://IP_OF_DTU/api/mqtt/config
-H "Authorization: Basic XXXXXXX"
-H "Content-Type: application/json"
--data-binary @mqtt.json

leads to:
{"type":"warning","message":"No values found!","code":1002}%

Expected Behavior

{"type":"success","message":"Settings saved!","code":1001}%

Install Method

Pre-Compiled binary from GitHub releases

What git-hash/version of OpenDTU?

f972685

What firmware variant (PIO Environment)?

generic_esp32s3_usb

Relevant log/trace output

Anything else?

this is in the onbattery fork, but that should not have any impact I think

Please confirm the following

  • I believe this issue is a bug that affects all users of OpenDTU, not something specific to my installation.
  • I have already searched for relevant existing issues and discussions before opening this report.
  • I have updated the title field above with a concise description.
  • I have double checked that my inverter does not contain a W in the model name (like HMS-xxxW) as they are not supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions