Routine: Reboot Modem Monthly 1st Monday of each month

I am looking for suggestions to make a routine for a Smart plug to reboot my Modem once a month. I would like to use the 1st Monday of every month 1:30 AM. So the day is constant but the date is not. Appreciate everyone’s input, assistance.

Look at the Virtual Calendar driver from Mariano. You can use that in Routines to have things occur on specific dates and/or recur periodically. (EDGE Driver-Mc): Aplicaciones Virtuales Mc (virtual Switch Mirror, Virtual Calendar and virtual Switch Board...)

Thank You, I downloaded the driver and will give it a try.

This can be done using the Rules API.

I can publish the Rule if there is interest.

No need to use a custom driver.

Cloud rule is not working (without a hub).

2 Likes

That’s clever! Using as condition the first seven days of the month so it only triggers the first Monday and not the others.

1 Like

Yes, Thank You would appreciate if you publish the rules and how to access them. This is what I am looking for. I am familiar and comfortable using SmartThings and using stock routines and drivers. Do not have much advanced experience. Would appreciate if you put brief instructions on how to install on my system. What is “API”. I appreciate your response and suggestion.

This example Rules API rule sets the switch to the Off state and after minute to the On state.

Rules API rule:

  {
    "every": {
      "specific": {
        "daysOfWeek": [
          "Mon"
        ],
        "reference": "Midnight",
        "offset": {
          "value": {
            "integer": 90
          },
          "unit": "Minute"
        }
      },
      "actions": [
        {
          "if": {
            "or": [
              {
                "equals": {
                  "left": {
                    "date": {
                      "reference": "Today"
                    }
                  },
                  "right": {
                    "date": {
                      "day": 1
                    }
                  }
                }
              },
              {
                "equals": {
                  "left": {
                    "date": {
                      "reference": "Today"
                    }
                  },
                  "right": {
                    "date": {
                      "day": 2
                    }
                  }
                }
              },
              {
                "equals": {
                  "left": {
                    "date": {
                      "reference": "Today"
                    }
                  },
                  "right": {
                    "date": {
                      "day": 3
                    }
                  }
                }
              },
              {
                "equals": {
                  "left": {
                    "date": {
                      "reference": "Today"
                    }
                  },
                  "right": {
                    "date": {
                      "day": 4
                    }
                  }
                }
              },
              {
                "equals": {
                  "left": {
                    "date": {
                      "reference": "Today"
                    }
                  },
                  "right": {
                    "date": {
                      "day": 5
                    }
                  }
                }
              },
              {
                "equals": {
                  "left": {
                    "date": {
                      "reference": "Today"
                    }
                  },
                  "right": {
                    "date": {
                      "day": 6
                    }
                  }
                }
              },
              {
                "equals": {
                  "left": {
                    "date": {
                      "reference": "Today"
                    }
                  },
                  "right": {
                    "date": {
                      "day": 7
                    }
                  }
                }
              }
            ],
            "then": [
              {
                "command": {
                  "devices": [
                    "-- ID Switch Device --"
                  ],
                  "commands": [
                    {
                      "component": "main",
                      "capability": "switch",
                      "command": "off"
                    }
                  ]
                }
              },
              {
                "sleep": {
                  "duration": {
                    "value": {
                      "integer": 60
                    },
                    "unit": "Second"
                  }
                }
              },
              {
                "command": {
                  "devices": [
                    "-- ID Switch Device --"
                  ],
                  "commands": [
                    {
                      "component": "main",
                      "capability": "switch",
                      "command": "on"
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  }

You have to change switch device ID – ID Switch Device – to your Device ID.
Your Device ID you can find from AWA .

Instructions you can find here:

2 Likes

Thank You, appreciate the info and how to add it. I went on the advanced user’s site which I am familiar with and see where, how to add. Will try it and let you know. Thanks

1 Like

Hi, @Mullica,
@TapioX provided a great example, I checked with the engineering team and they provided an example to define a Rule that will run every X day of the month which in this case would be every 1st.
This is the complete sample of turning on a switch every 1st of the month at 1:30 AM:
The timezone ID can be found in the Advanced Users app in the location’s details. This is to avoid any issues with the wrong time.

{
    "every": {
        "specific": {
        "timeZoneId": "America/Mexico_City",
        "day": 1,
        "reference": "Midnight",
        "offset": {
        "value": {
            "integer": 90
        },
        "unit": "Minute"
        }
    },
        "actions": [
            {
                "command": {
                    "devices": [
                        "deviceId"
                    ],
                    "commands": [{
                        "component": "main",
                        "capability": "switch",
                        "command": "on",
                        "arguments": []
                    }]
                }
            }
        ]
    }
}
1 Like

Thank You, I appreciate your response and follow-up.

It’s also possible to use between

          "if": {
            "between": {
              "value": {
                "date": {
                  "reference": "Today"
                }
              },
              "start": {
                "date": {
                  "day": 1
                }
              },
              "end": {
                "date": {
                  "day": 7
                }
              }
            },