Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] HTTP POST endpoints for solar charge controller data and DPL mode #252

Closed
Yoeky opened this issue Jun 2, 2023 · 9 comments
Closed
Labels
contribution needed Will not be worked on unless contributed from outside of hoylabs enhancement New feature or request

Comments

@Yoeky
Copy link

Yoeky commented Jun 2, 2023

Is your feature request related to a problem? Please describe.

For non-Victron users, it would be really helpful if there was a way to somehow inject the MPPT charger live data into
OpenDTU-OnBattery every few seconds in order to be able to use solar passthrough.

I would also love to be able to remotely (via web API) configure and turn the dynamic power inverter on/off, so I could have Home Assistant turn it off and manually set the power limit on the inverter for a few hours for whatever reasons (or change settings from time to time based on the weather forecast)...

Describe the solution you'd like

for the MPPT data: an API call that could easily be made by some esphome or Home Assistant installation would be great. I assume the only relevant values needed would be "V" and "I" as shown by /api/vedirectlivedata/status, so if a new API POST call would allow only to update those two fields, the whole existing logic would "just work" like it does with Victrons. Is that assumption correct?

for the dynamic power limiter, the api call to /api/powerlimiter/status should just be writable

Describe alternatives you've considered

No response

Additional context

No response

@Yoeky Yoeky added the enhancement New feature or request label Jun 2, 2023
@helgeerbe
Copy link
Collaborator

helgeerbe commented Jun 5, 2023

Hi @Yoeky ,

there is a PR #232 pending, that would enable/disable solar pass through via mqtt. Maybe this would be helpfull for you.

At the moment I don't have any plans to implement a remote interface for MPPTs. If someone is going to implement this, I would support the integration. But if the chargers are remote, you could also do the power limiting remote. There are several activities ongoing, implementing this.

@schlimmchen
Copy link
Member

configure and turn the dynamic power inverter on/off, so I could have Home Assistant turn it off and manually set the power limit on the inverter for a few hours

You can disable the DPL using the mode switch (MQTT), see the Wiki. HomeAssistant knows this switch. You can then set a limit on the inverter using MQTT/HomeAssistant.

For non-Victron users, it would be really helpful if there was a way to somehow inject the MPPT charger live data

That would be done in #457 using MQTT.

Is there something else that you are asking for which is not covered by the DPL mode switch and the MQTT solar power input?

@Yoeky
Copy link
Author

Yoeky commented Apr 15, 2024

For non-Victron users, it would be really helpful if there was a way to somehow inject the MPPT charger live data

That would be done in #457 using MQTT.

Is there something else that you are asking for which is not covered by the DPL mode switch and the MQTT solar power input?

I think that should work. I have Renogy MPPTs and get their data in home assistant (using esphome), ideally I could just push those values to opendtu directly from my esphome once the interface exists.

although, after thinking about this another few minutes: Ideally I could do this via HTTP (API) directly from my esphome. That would make the whole solution independent from the MQTT broker and more stable in case the home assistant server is down...

@schlimmchen
Copy link
Member

Yeah, I tried setting up my smart switches this way as well, so I would not need a broker. Turns out the user experience is much better with MQTT, as HTTP requires a lot of back and forth, while MQTT is made for such environments and is very lightweight.

@schlimmchen
Copy link
Member

  • We do allow disabling the DPL using MQTT already.
  • Disabling the DPL using HTTP is doable: Request the current config, patch the JSON to only disable the DPL keeping the other settings as they are, and POST'ing that patched JSON to apply the settings.
  • We have [Request] Get value for PV power via MQTT #457 and that will eventually be available.
  • We may implement some kind of HTTP(S)+JSON solar charge provider in the future, although nobody asked for it yet. However, implementing a POST endpoint for that and defining an API is tedious and less flexible. I don't support adding POST endpoints to "connect" to peripherals. That would be a new scheme of talking to peripherals, and I maintain that MQTT is the better option.

@AndreasBoehm Would you like to keep this open? I tend to close it because I think that such a paradigm shift (POST'ing to OpenDTU-OnBattery suddenly becomes a thing) is not the right choice for OpenDTU in general.

@schlimmchen schlimmchen changed the title adding POST on web api calls for /api/vedirectlivedata/status and api calls to configure and turn the dynamic power limiter on/off [Request] HTTP POST endpoints for solar charge controller data and DPL mode Dec 1, 2024
@schlimmchen schlimmchen added the contribution needed Will not be worked on unless contributed from outside of hoylabs label Dec 1, 2024
@AndreasBoehm
Copy link
Member

I agree that we should not add POST endpoints to inject data into OpenDTU.

In my opinion we can close this.

@schlimmchen schlimmchen closed this as not planned Won't fix, can't repro, duplicate, stale Dec 4, 2024
@stefan123t
Copy link

stefan123t commented Dec 4, 2024

While I agree that it would require to have a separate REST API for ODOB which you would have to support then.

I would like to point out that there already are a small set of endpoints upstream,
e.g. at least for APL ActivePowerLimit /api/limit/config and Power Start/Stop/Restart /api/power/config.

See the official documentation on POST Information here:
https://www.opendtu.solar/firmware/web_api/#post-information

image

expand OpenAPI for APL and Power Details

  /api/limit/config:
    post:
      tags:
        - Inverter
      responses:
        "200":
          description: "OK"
      security:
        - BasicAuth: []
  /api/limit/status:
    get:
      tags:
        - Inverter
      responses:
        "200":
          description: "OK"
          content:
            application/json:
              schema:
                type: object
                properties: 
                  inverter-serial:
                    type: string
                    properties:
                      limit_relative: 
                        type: integer
                      max_power:
                        type: integer
                      limit_set_status:
                        type: string
                example:
                    114173212345:
                      limit_relative: 100
                      max_power: 600
                      limit_set_status: Ok
...
  /api/power/config:
    post:
      tags:
        - Inverter
      responses:
        "200":
          description: "OK"
      security:
        - BasicAuth: []
  /api/power/status:
    get:
      tags:
        - Inverter 
      responses:
        "200":
          description: "OK"
          content:
            application/json:
              schema:
                type: object
                properties: 
                  inverter-serial:
                    type: string
                    properties:
                      power_set_status: 
                        type: string
                example:
                    114173212345:
                      power_set_status: Ok

image

I have documented the REST API upstream using a OpenAPI/Swagger file.
See tbnobody#378 (comment)

There is also a version for ODOB if you want to use it for the ODOB changes to the upstream endpoints.

@schlimmchen
Copy link
Member

Hmmmmmm, I don't think that's quite on the nose. You see, those endpoints/APIs are already there because they are part of the web UI. And the web UI API is not stable, see the docs:

image

Adding an endpoint to receive POST data from/for a peripheral is a completely different beast.

Copy link

github-actions bot commented Jan 4, 2025

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
contribution needed Will not be worked on unless contributed from outside of hoylabs enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants