OpenSprinkler Forums OpenSprinkler Unified Firmware Import and Export settings via api

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #61741

    dun4cheap
    Participant

    Is there a way to import and export all settings via api without having to make multiple calls? I have 19+ controllers and I would like to be able backup my settings quicklyt without having to log in to each controller.

    I could not find anything in the api.

    Thanks,

    #61766

    Ray
    Keymaster

    Yes, you can use the /ja API. It dumps all options to a json string which is basically what the app does when exporting. Here is an example:
    http://demo.opensprinkler.com/ja?pw=opendoor
    so you can do http://x.x.x.x/ja?pw=your_password_md5_hashed

    #61769

    dun4cheap
    Participant

    Ray, can I then re-import it via api or save it as a bin file and use the webif to import it?

    #61777

    Ray
    Keymaster

    That’s a good question, I don’t think importing is as simple as a one line command as exporting. Samer probably knows a better way, but your best bet is to use the app / UI to import the settings.

    #62800

    ideasman69
    Participant

    I’m curious about this too… i had been taking a nightly backup of the nvm.dat file (along with other config files) which has always worked when rebuilding the raspberry pi but as I found out last night – nvm.dat isn’t used on the latest release.

    ideally if we could run a command that simulates the same result as the GUI Export Configuration, that would be awesome

    #62805

    Ray
    Keymaster

    From firmware 2.1.9, the original nvm.dat has been split into individual data files (integer options, string options, programs, station data etc.). This makes it possible to expand each separately without being constrained into a single file. Previously nvm.dat is designed to match the exact format of ATmega1284’s EEPROM, which is only 4K in size. So every time we want to expand something, like the number of programs, some other data size has to reduce to make room for this. Now they are all in their own files stored in SD card or flash memory, so it’s no longer constrained by the 4K size.

    At the moment, the best way is to export configurations from time to time. If you use script, you can simply export configurations by issuing a:
    http://x.x.x.x/ja?pw=yyy
    where x.x.x.x is your controller’s IP address, yyy is the MD5 checsum of your password. This will return all settings in one json, and that’s essentially what the UI does.

    Then use the UI to import — there is currently no API support for importing all configurations at once, but the UI will read the file (i.e. the output of /ja) and parse it into individual commands (/co, /cp, /cn etc.) and send those to the controller. In the future I agree that we can add an API, something like /ca to allow importing all settings through one command.

    #62830

    ideasman69
    Participant

    Perfect, thanks Ray!

    just added this to my nightly backup script:
    wget 'http://127.0.0.1:8080/ja?pw=xxx' -O /mnt/backup/ospi_settings.json

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

OpenSprinkler Forums OpenSprinkler Unified Firmware Import and Export settings via api