diff --git a/README.md b/README.md index 56d5179..05013d2 100644 --- a/README.md +++ b/README.md @@ -378,7 +378,7 @@ Headers can be added as well using a Json construct [{"name":"header type name", Another option that is detected by the bridge is to use UDP or TCP direct calls such as `udp://:/` to send a UDP request. TCP calls are handled the same way as `tcp://:/`. If your data for the UDP or TCP request is formatted as "0x00F009B9" lexical hex format, the bridge will convert the data into a binary stream to send. -You can also use the value replacement constructs within these statements. Such as using the expressions "${time.format(Java time format string)}" for inserting a date/time stamp, ${intensity.percent} or ${intensity.percent.hex} for 0-100 or ${intensity.decimal_percent} for 0.00-1.00 or ${intensity.byte} or ${intensity.byte.hex} for 0-255 for straight pass through of the value or items that require special calculated values using ${intensity.math()} i.e. "${intensity.math(X/4)}" or "${intensity.math(X/4).hex}". See Value Passing Controls Below. +You can also use the value replacement constructs within these statements. Such as using the expressions "${time.format(Java time format string)}" for inserting a date/time stamp, "${timestamp}" for inserting a pure timestamp (milliseconds from 1.1.1970), ${intensity.percent} or ${intensity.percent.hex} for 0-100 or ${intensity.decimal_percent} for 0.00-1.00 or ${intensity.byte} or ${intensity.byte.hex} for 0-255 for straight pass through of the value or items that require special calculated values using ${intensity.math()} i.e. "${intensity.math(X/4)}" or "${intensity.math(X/4).hex}". See Value Passing Controls Below. Examples: ``` diff --git a/src/main/java/com/bwssystems/HABridge/hue/TimeDecode.java b/src/main/java/com/bwssystems/HABridge/hue/TimeDecode.java index 62343f7..2c1a329 100644 --- a/src/main/java/com/bwssystems/HABridge/hue/TimeDecode.java +++ b/src/main/java/com/bwssystems/HABridge/hue/TimeDecode.java @@ -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; }