add support for timestamp http URL variable

- certain devices require a current date/time in their HTTP request
  (Warema shades)
This commit is contained in:
Rainer Burgstaller
2017-12-11 08:30:33 +01:00
parent 71c4447d25
commit 800f5ec2aa
2 changed files with 6 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
public class TimeDecode {
private static final Logger log = LoggerFactory.getLogger(TimeDecode.class);
private static final String TIME_FORMAT = "${time.format(";
private static final String TIMESTAMP = "${timestamp}";
private static final String TIME_FORMAT_CLOSE = ")}";
/*
@@ -38,6 +39,10 @@ public class TimeDecode {
log.warn("Could not format current time: " + timeFormatDescriptor, e);
}
}
if (request.contains(TIMESTAMP)) {
request = request.replace(TIMESTAMP, String.valueOf(System.currentTimeMillis()));
notDone = true;
}
}
return request;
}