I would like to update my DateTime item via REST with linux collected datetime.
I have the following item:
DateTime Last_Correct_Data_Receive_Time "last received data: [%1$td-%1$tm-%1$tY %1$tH:%1$tM]"
and I tried to update date and time from the script using the following curl:
curl -s -X PUT -H "Content-Type: text/plain" -d "27-11-2018 10:22" "http://192.168.1.23:8080/rest/items/Last_Correct_Data_Receive_Time/state"
{"error":{"message":"State could not be parsed: 27-11-2018 10:22","http-code":400}}
Anyone have an idea of what type of data/format should I send to have it updated?
by the way: another way to achieve the same result (get linux system time in a DateTime Item in OH2) would be to install the NTP binding. You would need to install a NTP daemon on the linux box if you want to pull the local time (or use a public NTP server just to get the time info into OH2)
I use my linux box as a NTP server for all my LAN devices and sync this daemon with an external public NTP server.
edit: You have a different use case… it seems that you are using a script to transmit data to OH2 via REST API and you want to add a timestamp upon successful delivery… forget the NTP then
yes. I had a different purpose. I simply collect data from my Viessmann heating and update over rest api. The script was failing multiple times for different reasons, so I wanted to indicate when actually I’ve got the correct data and when the failure could happen
Thanks for help anyway. Perhaps I’ll need your script later on as well
Even if this post is already older…
Under OH3 you can also update a DateTime item with EPOCH time format.
Before I found this post here, I had figured that out.