Feasibility Q - hit an HTTP end point, interpret the returned JSON to turn/on/off an output

  • Hi,
    I have a use case with a solar inverter + homebrew arduino which presents the Inverter control variables as an HTTP conversation.

    e.g. To ask the inverter for current solar generation and battery levels I might send: http://solis.local/R?a=33057.2,33139
    33057.2 and 33139 are specific registers being requested.


    The response will be JSON list thus: {"data":[254,62]}

    Meaning 254 watts and 62%

    Ideally if I could do this in a shelly script then I could drive intellegent mains switching outputs depending on various power generation scenarios. Shelly would loop periodically making the above call and deciding how to change ouputs depending on the result- perhaps turning something on when the batteries are full, or when solar is above a certain level.

    Has anyone worked with an HTTP conv like the above before - can you give me some hints please?


    My original plan was a wemosD1 arduino (or similar) for the comms part with an off the shelf mains relay - however just been introduced to the shelly line of products which might already have the right combination of hardware/software.

    Many thanks;

  • here's an example how to monitor a remote shelly which also replies with a JSON-Response, so basically this should be very similar use case.

    shelly-script-examples/monitor_remote_consumption.js at main · shelly-tools/shelly-script-examples
    Shelly mJS Scripting examples. Contribute to shelly-tools/shelly-script-examples development by creating an account on GitHub.
    github.com

    >100 Shellies, darunter so gut wie alles was der Hersteller produziert hat. ;)
    :!: ich beantworte grundsätzlich keine Fragen per persönlicher Nachricht:!:

  • Feedback - this worked really well;

    I bought a Shelly 1 Plus and setup to talk to my custom solar inverter as in the top post.

    This code, as an initial starting point, works great- polls the HTTP end point every 5 minutes and switches accordingly.

    Very nice component - saved me building one from scratch! :)
    Thank you for the help above.

    (Looks like it needs a specific IP address and cannot resolve MDNS)