What is the formatting for a Restful date sensor?

what is the date device_class expected formatting? I keep seeing ISO8061 but as best i can tell i’m conforming but still getting errors

Config:

- platform: rest
  resource: http://get-timestamp.com
  name: Last Quest
  device_class: date
  value_template: "{{ value_json }}"

This endpoint returns:

"2023-01-06T20:09:36Z"

The result is an error in my log:
sensor.last_timestamp rendered invalid date 2023-01-06T20:09:36Z

Thats not json if thats literally what it returns, removing the device class line, do you get the value you expect in that entity ?

other options to explore are the function strptime
or the filter custom_timestamp

How is it not json? It’s not an object, sure…

If the error can be trusted it should have the correct value but I will try your suggestion. :slight_smile:

Without the device_class, it still looks like an acceptable date string to me.

image

AHA! I was using device_class: date when what I should have been using was device_class: timestamp

Thanks again!

Glad you got it sorted. And I stand corrected on the json!