1) Give a description of the problem
I have a web request URL built as a value using an embedded expression using {}.
The value stored in the variable is quite large (it’s epoch time), and when the URL is built using the variable the URL is built with the epoch number in the format “1.516305544632E12” rather than “1516306088582”.
This breaks the get request as the webserver is expecting the full number not a number with a decimal point and E12.
Here is the full entry from the ‘Value’ field in the get request: https://www.energyhive.com/mobile_proxy/getTimeSeries?&fromTime={Epoch_Time_One_Hour_Ago}&toTime={Current_Epoch_time}&aggPeriod=hour&aggFunc=sum&offset=0&token=XXXXXXX
I have deleted my api key in the logs and above and replaced with XXXXXX.
If there is another way I can construct the URL that would be fine.
2) What is the expected behavior?
Inserting the variable in the expression using {} should insert the whole number not the exponent (I think that’s the right term!)
3) What is happening/not happening?
The logic is inserting 1.XXE12 not the number
4) Post a Green Snapshot of the piston
(UPLOAD YOUR IMAGE HERE)
5) Attach any logs (From ST IDE and by turning logging level to Full)
18/01/2018, 21:20:27 +134ms
+0ms ╔Received event [Home].time = 1516310428474 with a delay of -1341ms
+139ms ║RunTime Analysis CS > 15ms > PS > 44ms > PE > 81ms > CE
+141ms ║Runtime (39049 bytes) successfully initialized in 44ms (v0.2.102.20180116) (140ms)
+143ms ║╔Execution stage started
+153ms ║║Cancelling statement #32’s schedules…
+159ms ║║Executed virtual command setVariable (2ms)
+164ms ║║Calculating (integer) 3700 * (integer) 1000 >> (integer) 3700000
+167ms ║║Calculating (decimal) 1.516310427289E12 - (decimal) 3700000.0 >> (decimal) 1.516306727289E12
+171ms ║║Executed virtual command setVariable (2ms)
+178ms ║║Calculating (string) https://www.energyhive.com/mobile_proxy/getTimeSeries?&fromTime= + (string) 1.516306727289E12 >> (string) https://www.energyhive.com/mobile_proxy/getTimeSeries?&fromTime=1.516306727289E12
+181ms ║║Calculating (string) https://www.energyhive.com/mobile_proxy/getTimeSeries?&fromTime=1.516306727289E12 + (string) &toTime= >> (string) https://www.energyhive.com/mobile_proxy/getTimeSeries?&fromTime=1.516306727289E12&toTime=
+183ms ║║Calculating (string) https://www.energyhive.com/mobile_proxy/getTimeSeries?&fromTime=1.516306727289E12&toTime= + (string) 1516310427289 >> (string) https://www.energyhive.com/mobile_proxy/getTimeSeries?&fromTime=1.516306727289E12&toTime=1516310427289
+186ms ║║Calculating (string) https://www.energyhive.com/mobile_proxy/getTimeSeries?&fromTime=1.516306727289E12&toTime=1516310427289 + (string) &aggPeriod=hour&aggFunc=sum&offset=0&token=XXXXXXXXXXX >> (string) https://www.energyhive.com/mobile_proxy/getTimeSeries?&fromTime=1.516306727289E12&toTime=1516310427289&aggPeriod=hour&aggFunc=sum&offset=0&token=XXXXXXXXX
+190ms ║║Sending external web request to: www.energyhive.com/mobile_proxy/getTimeSeries?&fromTime=1.516306727289E12&toTime=1516310427289&aggPeriod=hour&aggFunc=sum&offset=0&token=XXXXXXXXX
+729ms ║║Executed virtual command httpRequest (539ms)
+734ms ║║Executed virtual command parseJson (0ms)
+741ms ║║{“status”:“ok”,“data”:[]}
+742ms ║║Executed virtual command log (2ms)
+748ms ║║Executed virtual command setVariable (2ms)
+752ms ║╚Execution stage complete. (609ms)
+754ms ║Setting up scheduled job for Thu, Jan 18 2018 @ 9:21:28 PM GMT (in 60.587s)
+761ms ╚Event processed successfully (760ms)
18/01/2018, 21:19:27 +753ms
+0ms ╔Starting piston… (v0.2.102.20180116)
+625ms ║╔Subscribing to devices…
+698ms ║╚Finished subscribing (81ms)
+732ms ║Setting up scheduled job for Thu, Jan 18 2018 @ 9:20:28 PM GMT (in 59.993s)
+742ms ╚Piston successfully started (742ms)