Routine: Reboot Modem Monthly 1st Monday of each month

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