OpenSprinkler Forums OpenSprinkler Unified Firmware 2.3.0(4) API commands. Not able to use commands like cm for manual turn on

Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #79320

    dkebler
    Participant

    I have installed 2.3.3 (that I built and run via docker) on RPI.

    All is working fine.

    I want to control OS either via the API or MQTT.

    The only docs for the API I can find are these.

    https://raysfiles.com/os_compiled_firmware/docs/2.2.0/OSAPI2.2.0(1).pdf

    if I try

    curl https://my.url.net/ja

    it spits back all the system info so I know that the API is working BUT.

    If I try to then control the unit for example trying a manual

    `
    12. Manual Station Run (previously manual override) [Keyword /cm]
    /cm?pw=xxx&sid=xx&en=x&t=xxx&ssta=x
    Parameters:
    ● sid: Station index (starting from 0)
    ● en: Enable bit (1: open the selected station; 0: close the selected station).
    ● t: Timer (in seconds). Acceptable range is 0 to 64800 (18 hours). The timer value must be provided if opening a station.
    ● ssta: shift remaining stations in the same sequential group
    `

    I get a reply but then the station is not turned on. (i.e. the command is ignored)

    curl https://my.url.net/cm?pw=xxx&sid=1&en=1&t=10
    [4] 3583987
    [5] 3583988
    [6] 3583989
    [3] Done curl https://my.url.net/cm?pw=xxx
    [5]- Done sid=1
    [6]+ Done en=1
    $ {“result”:16}

    `

    can someone give me advice on how to get the API to actually run the command thx and where is any updated api docs. And what are the result codes. If only I knew what 16 meant.

    note I am using https as I am using a reverse proxy. I don’t think this is an issue as the jp commands works fine.

    Also if you know how to control OS with MQTT topics then can you provide some info or any documentation on what topic and payload might be the same as say the cm API commmand.

    #79324

    Ray
    Keymaster

    First, could you clarify if the firmware you installed is version 2.3.3? That’s not a firmware that we released (our most recent one is 2.2.0(3)).

    Second, when you send curl command, and the http get link has & sympbols in them, you need to wrap the command in quotes like “http://blah.blah “, otherwise those & would be interpreted differently by command line.

    #79326

    dkebler
    Participant

    Yes .0(3) instead of .3 but my firmware: 2.2.0(4) I built from github clone so maybe that’s why (4) and not latest release (3)

    ah duh that was dumb wrap in quotes and it works. Forgot that curl run from shell needs that for single argument. Also saw all the return codes listed at the beginning of that document so i’m good on that.

    So… is there updated api docs for (3)/(4) or has nothing changed since (1)?

    Also is there an MQTT doc listing topics and payloads for equivalent api calls? e.g can I do cm call via MQTT?

    Thx Keymaster Ray!

    #79333

    Ray
    Keymaster

    Minor revisions (4) and (5) are on Github but they are not officially released/announced. (4) addresses the issue caused by breaking changes in GPIO controls with Raspbian Bookworm; (5) fixed an issue introduced in (4) that only affects OpenSprinkler 3.x and it’s not relevant to OSPi/RPi. So neither of these two versions changes the HTTP API which remains the same with minor revision (3).

    MQTT instructions can be found on our support website:
    https://openthings.freshdesk.com/support/solutions/articles/5000859089-how-to-use-mqtt

    It currently only supports outputting information through MQTT (i.t. MQTT publishing). You cannot yet use MQTT to trigger an action on OpenSprinkler (i.e. MQTT subscription). It’s quite easy to modify the firmware code to implement subscription. The last time we tried to do this, the developers did not agree on the APIs to use so we stalled there (then the pandemic happened and things got slowed down dramatically). So if you want to trigger an action, at the moment you need to either use the HTTP API, or implement MQTT subscription yourself.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums OpenSprinkler Unified Firmware 2.3.0(4) API commands. Not able to use commands like cm for manual turn on