I’m trying to use a REST sensor (calling to an API) to gather data on lake temperatures. The GET request takes a UNIX timestamp, but the data is quantized to the hour – IE: if I send a timestamp for today at 12:00, it returns valid results, but any timestamp not on the hour returns an error.
I can’t figure out how to take time data provided by now() and strip it back to the nearest hour (or otherwise arbitrarily manipulate it, ultimately bouncing it back into UNIX timestamp format for sending to the API.
Anybody have any input?
Thanks!
Justin
First failed attempt:
Thought I could get away with dividing the now() timestamp by 3600 (getting the number of hours) and then round away the decimal. HA doesn’t seem to want to return an integer despite my best efforts.