We have micro-farm within in our backyard. We used SkySpark to skip rainy days.

  • If it rained from the time the script runs to yesterday around 2.5 ~ 5.5 hours
    • Skip the current day
  • If it rained from the time the script runs to yesterday around 6 hours
    • Skip two days

We are using Sedona Ontrol Device for this application.

Step-by-step guide

Welcome to IOT with SkySpark

  1. Create a sedona connection to your device. Make sure manifests are download in etc/sedona/manifest folder.
  2. Create a point and add the following records. (Note when mapping select BooleanWritable in sedona device)
    1. schedulable=8
    2. [email protected]

  3. Create a schedule called Lawn Watering Schedule
    1. Go back to the point and select the schedule created.
    2. Create Schedule event and make it false all the time and set the priority to latest.
    3. Create a schedule for the watering in the morning and at night. (I am learning requirements now.) 
      1. Morning watering make it 1 hour.
      2. Evening watering make it 30 mins.
    4. Map the calendar item into the Schedule and make it highest priority.
  4. Create a calendar.
    1. Create an event in calendar with weekdays selection.
  5. Create 3 axon functions that are copied below.
  6. Run the job with the following axon code in 4am everyday.


(callRec) => do
  //0: unknown
  //1: clear
  //2: partlyCloudy
  //3: cloudy
  //4: showers
  //5: rain
  //6: thunderstorms
  //7: ice
  //8: flurries
  //9: snow 
//rainyDay: readAll(weatherCond).hisRead(yesterday)
weatherRec: readAll(weatherCond and weatherRef->dis=="Manchaca, TX")

//calendarRec: readAll(calendar and dis=="Rainy Days")
calendarRec: readAll(callRec)

 //add parameters dates
rainyPeriods: weatherRec.hisRead(yesterday()..today()).hisFindPeriods(v => v == 5 or v == 6)
totalDur: rainyPeriods.foldCol("v0", sum) 
//calendar:ver:"2.0" dis,val,weekdays "NonWaterDay","false","" (Str)
//ver:"2.0" dis,val,weekdays "NonWaterDay","false",""
//ver:"2.0" dis,val,weekdays "NonWaterDay","false","mon"
//ver:"2.0" dis,val,weekdays "NonWaterDay","false","mon,tue"

getToday : today().weekday()
findDatesOffTomorrow : (getToday).toDateStr()
findDatesOffFollowing : (getToday+1).toDateStr()
axonBase : "ver:\"2.0\"\ndis,val,weekdays\n\"NonWaterDay\",\"false\",\""
close : "\""
   if (totalDur == null or totalDur == 0 ) 
       return calendarStr : axonBase+close  
   if (totalDur > 2.5 and totalDur < 5.5 ) 
      //Write another axon call for finding the dates in str.  
   return calendarStr : axonBase+findDatesOffTomorrow+close  
   if (totalDur >= 5.5 ) 
    return calendarStr : axonBase+findDatesOffTomorrow+","+findDatesOffFollowing+close


(calendarRec ) => do
   calendarStr : calendarRec.calendarAxonStr()

    calendarRec.each rec => diff(rec, {calendar :  calendarStr }).commit

(dateNum) => do
   if (dateNum==0)
      return  returnDateStr:"sun"
    else if  (dateNum==1)
      return   returnDateStr:"mon"
        else if  (dateNum==2)
      return   returnDateStr:"tue"
        else if  (dateNum==3)
       return   returnDateStr:"wed"
            else if  (dateNum==4)
        return   returnDateStr:"thu"
                else if  (dateNum==5)
        return  returnDateStr:"fri"
                    else   (dateNum==6)
        return   returnDateStr:"sat"  







Help us improve this topic by commenting below.