SIP irrigation diagnostics

This flow can be used as a diagnostic tool for testing SIP irrigation control software and for use in developing flows that work with SIP.

[{"id":"670198850d14a2cf","type":"tab","label":"SIP diagnostics","disabled":false,"info":"","env":[]},{"id":"6258e7bcc69d2e16","type":"debug","z":"670198850d14a2cf","name":"gv var","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":610,"y":200,"wires":[]},{"id":"3f914e7b3e5983d2","type":"http request","z":"670198850d14a2cf","name":"","method":"GET","ret":"txt","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":450,"y":200,"wires":[["6258e7bcc69d2e16"]]},{"id":"77e85444f2d4b688","type":"inject","z":"670198850d14a2cf","name":"GET gv var","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"gv\":\"rs\"}","payloadType":"json","x":110,"y":200,"wires":[["27a85c99fc93c556"]],"info":"### Use SIP get to read SIP settings and status \r\nThis example flow can be used as a handy tool for observing SIP's settings and status information while the software is running.  \r\nThere are 2 groups of data that can be read from SIP.  \r\n**\"sd\"** values are from SIP's Settings Dictionary. \r\n**\"gv\"** values are global variables that hold status information.  \r\nThe **[gv_reference](https://github.com/Dan-in-CA/SIP/blob/P3-only/gv_reference.txt)** file in the SIP folder lists the sd and gv variables.\r\n\r\n### Reading SIP sd values:  \r\nUse the JSON option and a JavaScript object with the following format.  \r\n**{\"sd\":\"wl\"}**  \r\nThe **\"sd\"** property name selects values from SIP's **S**ettings **D**ictionary.  \r\nThe **\"wl\"** property value, shown in the example, selects the \"water level\" setting.\r\n\r\n### Reading SIP gv values:  \r\n**{\"gv\": \"cputemp\"}**  \r\nThe **\"gv\"** property name selects values from SIP's gv group of status information.  \r\nThe **\"cputemp\"** property value, shown in the example, will return the temperature from the Raspberry Pi's internal CPU temperature sensor.\r\n\r\n"},{"id":"6f47f80ed72ab9a9","type":"debug","z":"670198850d14a2cf","name":"sd var","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":610,"y":260,"wires":[]},{"id":"96a6317d56cb0fa4","type":"http request","z":"670198850d14a2cf","name":"","method":"GET","ret":"txt","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":450,"y":260,"wires":[["6f47f80ed72ab9a9"]]},{"id":"e3edebde86c7a62c","type":"inject","z":"670198850d14a2cf","name":"GET sd var","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"sd\":\"wl\"}","payloadType":"json","x":110,"y":260,"wires":[["456465b1ed8296d9"]],"info":"### Use SIP get to read SIP settings and status \r\nThis example flow can be used as a handy tool for observing SIP's settings and status information while the software is running.  \r\nThere are 2 groups of data that can be read from SIP.  \r\n**\"sd\"** values are from SIP's Settings Dictionary. \r\n**\"gv\"** values are global variables that hold status information.  \r\nThe **[gv_reference](https://github.com/Dan-in-CA/SIP/blob/P3-only/gv_reference.txt)** file in the SIP folder lists the sd and gv variables.\r\n\r\n### Reading SIP sd values:  \r\nUse the JSON option and a JavaScript object with the following format.  \r\n**{\"sd\":\"wl\"}**  \r\nThe **\"sd\"** property name selects values from SIP's **S**ettings **D**ictionary.  \r\nThe **\"wl\"** property value, shown in the example, selects the \"water level\" setting.\r\n\r\n### Reading SIP gv values:  \r\n**{\"gv\": \"cputemp\"}**  \r\nThe **\"gv\"** property name selects values from SIP's gv group of status information.  \r\nThe **\"cputemp\"** property value, shown in the example, will return the temperature from the Raspberry Pi's internal CPU temperature sensor.\r\n\r\n"},{"id":"50152d12557050c1","type":"http response","z":"670198850d14a2cf","name":"","statusCode":"200","headers":{"content-type":"application/json"},"x":260,"y":400,"wires":[]},{"id":"ad2fddacf3b02973","type":"http in","z":"670198850d14a2cf","name":"/node-red in","url":"/node-red","method":"post","upload":false,"swaggerDoc":"","x":90,"y":440,"wires":[["50152d12557050c1","960e4d1327c51b9f"]]},{"id":"960e4d1327c51b9f","type":"debug","z":"670198850d14a2cf","name":"From SiP","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":260,"y":440,"wires":[]},{"id":"bc54c4bb0295d68e","type":"comment","z":"670198850d14a2cf","name":"From SIP","info":"","x":80,"y":400,"wires":[]},{"id":"a845f9828d16d0c2","type":"inject","z":"670198850d14a2cf","name":"init","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":80,"wires":[["2640c34e21563478"]]},{"id":"27a85c99fc93c556","type":"function","z":"670198850d14a2cf","name":"Add url","func":"msg.url = flow.get(\"target\");\nreturn(msg);","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":280,"y":200,"wires":[["3f914e7b3e5983d2"]]},{"id":"456465b1ed8296d9","type":"function","z":"670198850d14a2cf","name":"Add url","func":"msg.url = flow.get(\"target\");\nreturn (msg);","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":280,"y":260,"wires":[["96a6317d56cb0fa4"]]},{"id":"b0d77fa7e0f4da70","type":"comment","z":"670198850d14a2cf","name":"To SIP","info":"Use these flows to read SIP control \nvariables or to set a variable in the \nSIP settings dictionary (sd).\n\nSee the gv_reference.pdf on the SIP \ndocumentation wiki for a list of \nvariables with a description of each.\n\nhttps://github.com/Dan-in-CA/SIP/wiki/gv_reference.pdf\n\nDouble-click to open the inject node of \nthe flow to change the variable. ","x":70,"y":160,"wires":[]},{"id":"52f041a7e09d55d3","type":"comment","z":"670198850d14a2cf","name":"README","info":"At startup this flow saves the SIP URL \nto a flow variable named \"target\" for \nuse by other flows on this tab.\n\nIf node-red is running on the same raspi \nas SIP, the default \"localhost\" \nshould work.\n\nIf node-red is running on different \ndevice on your network, change \n\"localhost\" in the \"Set SIP URL\" node \nto the URL of SIP.\nFor example \"192.168.1.123\".\nBe sure to include the quotes.","x":80,"y":40,"wires":[]},{"id":"7301dd543f4ae2e7","type":"inject","z":"670198850d14a2cf","name":"SET sd var","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"sd\":\"wl\", \"val\":90}","payloadType":"json","x":100,"y":320,"wires":[["f7f9615c2a741a84"]],"info":"## **SIP set** is used to change SIP settings or turn stations on or off.  \r\n\r\n### To change a SIP **sd** setting:  \r\nUse the JSON option with a JavaScript object of the following form:  \r\n**{\"sd\":\"wl\", \"val\": 50, \"save\": 0}**  \r\n**\"sd\"** refers to the SIP **Settings Dictionary**.  See the **[gv_reference.txt](https://github.com/Dan-in-CA/SIP/blob/P3-only/gv_reference.txt)** file in the SIP folder for a list of settings.  \r\n**\"wl\"** is the setting to be changed, The water level (\"wl\") setting is shown in the example above.  \r\n**\"val\"** is the new value the setting should have.  \r\n**\"save\"** (optioinal) controls if the setting will be saved to the **settings.json** file in the **SIP/data** folder.  \r\nIf \"save\" is **0** (default) or if \"save\" is not used, the setting will only be changed in memory and will not survive a software re-start or system reboot.  \r\nIf \"save is **1** the setting will persist.  \r\n\r\n### To change a SIP **gv** setting:  \r\n**{\"gv\":\"use_gpio_pins\", \"val\": 1}**  \r\n**\"gv\"** values are SIP variables that contain status and control data. They are also listed in **[gv_reference.txt](https://github.com/Dan-in-CA/SIP/blob/P3-only/gv_reference.txt)**.  \r\nyou can use the **SIP get** example flow to see the format of a \"gv\" value of interest.  \r\n\"gv\" values are not stored in a file and only kept in memory.\r\n\r\n### To turn one or more stations on or off:  \r\n**{\"sn\":[1,2], \"set\": 1, \"req mm\":1}**  \r\nThe required property name can be **\"sn\"** or **\"station\"**. Either will work.  \r\nThe property value is an array of one or more station numbers seperated by commas.  \r\nif **\"set\"** is **1** the station(s) will be turned on.  If \"set\" is **0** the station(s) will be turned off.   \r\n**\"req mm\"** (optional) means \"Require manual mode\". if it is **1** (default) or if \"req mm\" is not used, SIP must be Manual mode for this to work.  \r\nif \"req mm\" is **0** stations will be turned on or off even if SIP is not in Manual mode and other stations are running.\r\n\r\n### To start a Run-once program:  \r\n**{\"ro\": [[2, 5], [3, 5], [5, 5]], \"preempt\":1}**  \r\nThe required property name can be **\"ro\"** or **\"run once\"**. Either will work.  \r\nThe property value is an array of 2 element sub-arrays (note the double [[ and ]] at the start and end). Each 2 element inner array contains a station number and the time in seconds for it to run.  \r\nIn the example shown above the first inner array **[2,5]** has station 2 running for 5 seconds  \r\n**\"preempt\"** (optional) controls if a program that is already running will be ended (preempted) when the run once program starts.  If \"preeempt\" is **1** (default) or if \"preempt\" is not used, any running program will be ended.  \r\nIf \"preempt\" is **0**, the run once program will be run allong with the already running program."},{"id":"2cc8996137facd9a","type":"http request","z":"670198850d14a2cf","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"credentials":{},"x":430,"y":320,"wires":[[]]},{"id":"f7f9615c2a741a84","type":"function","z":"670198850d14a2cf","name":"Add url","func":"msg.url = flow.get(\"target\");\nreturn (msg);","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":260,"y":320,"wires":[["2cc8996137facd9a"]]},{"id":"2640c34e21563478","type":"function","z":"670198850d14a2cf","name":"Set SIP URL","func":"let sip_url = \"localhost\";\nsip_url += \"/jsin\";\nflow.set(\"target\", sip_url);\nmsg.payload = flow.get(\"target\");\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":250,"y":80,"wires":[["90d512de9bf522c3"]]},{"id":"90d512de9bf522c3","type":"debug","z":"670198850d14a2cf","name":"SIP URL","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":420,"y":80,"wires":[]}]

Flow Info

Created 7 months, 1 week ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • comment (x3)
  • debug (x4)
  • function (x4)
  • http in (x1)
  • http request (x3)
  • http response (x1)
  • inject (x4)
Other
  • tab (x1)

Tags

  • SIP-irrication
  • Sprinkler-control
  • Irrigation-control
  • Irrigation
  • Water-saving
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option