private String generateIrrigationUrl(IrrigationRequest request) {
    long valve1 = 0;
    long valve2 = 0;
    long valve3 = 0;
    long valve4 = 0;
    long valve5 = 0;
    long valve6 = 0;
    long valve7 = 0;
    long valve8 = 0;

    for (Zone z : request.getZones().keySet()) {
      // EtherRain8 takes minutes by default, convert from seconds.
      if (z.getId().matches("1")) {
        valve1 = request.getZones().get(z) / 60;
      } else if (z.getId().matches("2")) {
        valve2 = request.getZones().get(z) / 60;
      } else if (z.getId().matches("3")) {
        valve3 = request.getZones().get(z) / 60;
      } else if (z.getId().matches("4")) {
        valve4 = request.getZones().get(z) / 60;
      } else if (z.getId().matches("5")) {
        valve5 = request.getZones().get(z) / 60;
      } else if (z.getId().matches("6")) {
        valve6 = request.getZones().get(z) / 60;
      } else if (z.getId().matches("7")) {
        valve7 = request.getZones().get(z) / 60;
      } else if (z.getId().matches("8")) {
        valve8 = request.getZones().get(z) / 60;
      }
    }

    String startIrrigationUrl = getUrlPrefix() + "/result.cgi?xi=";

    return startIrrigationUrl + "0:" + valve1 + ":" + valve2 + ":" + valve3 + ":" + valve4 + ":"
        + valve5 + ":" + valve6 + ":" + valve7 + ":" + valve8;
  }