OpenSprinkler Forums OpenSprinkler Unified Firmware Feature request: API interface for external sensors

Tagged: 

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

    David
    Participant

    Hey guys,

    what you think about a new API command for external sensor inputs like watermeters, remote rainsensors, own weatherstations, and so on. So, if you want to connect an extra sensor to the software, you can run an smal script on an raspberry. Read the Pin, decode the signal and send it to the API. It would be easy to add some sensors to the opensprinkler.

    just call it cx (command extern)
    – rs (rain sensor, 0 = Off, 1 = on) or for moisture sensors or so…
    – wtc (weather temp celsius, just overwrite the weathertemp)
    – wtf (same as wtc just with fahrenheit)
    – wp (set weather precip in mm)
    – wh (set weather humidity)
    – wmt (watermeter triggerinput (* factor = water use) )
    – wmf (watermeter facor, what each wmt (trig * factor)
    – wll (water level low, 0 = Off, 1 = On water level is low – stop the waterring) or use the rs (rain sensor input)
    – tr (trig relay)
    – and so on

    + some demo scrips in python (Pi, Beagle or ESP) (how to read a pin an send the state to the Opensprinkler)

    just to make the OpenSprinkler more flexible.

    #40167

    Ray
    Keymaster

    Sorry, just noticed that I have not responded to this thread. I think this is a great suggestion. The tricky part is: what does the firmware do with these variables? It can store the variables, but the current design of the firmware make weather query through a script, which obtains the weather data and calculates a simple watering level to return to the firmware. So in a sense the firmware is not aware of any weather data. So to make it compatible with the current design, it’s better to send the variables to a server that can make use of them to calculate a watering level, and either uses the existing OpenSprinkler API (i.e. setting the ‘wl’ variable) to feed the resulting watering level to the firmware, or have the firmware call a script on the server to return the calculated watering level.

    #40169

    David
    Participant

    Hmm, its a little bit tricky.

    Thats an idea to make a small server that stores the sensordate from own weatherstation and simulate the Wunderground API.

    But i think this is little to much for small DIY weatherstations. You need the sensor and a small webserver. If you want to make the sensor to the webserver, you cant use a powersave mode (active all x times).

    There are still two further solutions:

    1) The weatherstation calculate the waterlevel and send it to the OS. easy. it just overwrite the old wl.
    This function exits. Sorry, i just found it now. API call (controller option) “/co?pw=PASSWORD_MD5_Hash&o23=100” to set waterlevel to 100%
    If i set the waterlevel manually. Will the next weathercall overwrite it?

    2) The weatherstation send the sensor data (rain,temp,…) to the OS. The OS calc with the wl adjustemt method the currend waterlevel and update the current value. Need to change the firmware… maybe in later… 😉

    A small fallback routine could check the last manual wl set from the own weatherstation. Is it to old -> go back to Wunderground.

    #40209

    Ray
    Keymaster

    I don’t think it needs to simulate the Wunderground API — if you have your own sensors to collect weather data, you can define the data format in any way suitable, and just modify the weather script accordingly. There is no need to follow the Wunderground API.

    If you use solution 1, you can keep the ‘Weather Adjustment Method’ to ‘Manual’, that way the weather call will not overwrite the ‘wl’ variable, and only your script will be modifying ‘wl’ through the /co command.

    Solution 2 is also fine, but if I were you I would prefer solution 1 as it’s easier to change (does not require modifying the firmware every time you make a change to the weather calculation formula).

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

OpenSprinkler Forums OpenSprinkler Unified Firmware Feature request: API interface for external sensors