anthony1
(Anthony)
December 12, 2021, 6:04pm
1
Hi
I have the following rest sensor which output ISO formatted time. Its been fine for months- - after 2021.12 i get a permanent error “sensor.green_bins_collection rendered invalid timestamp: Mon, Dec 13”
No matter how i reformat the timestamp - i cannot remove the error - can anyone point me in the right direct:
The sensor is here:
- platform: rest
name: Green Bins Collection
resource: https://citizen.westberks.gov.uk/apiserver/ajaxlibrary
method: POST
scan_interval: 7260
device_class: timestamp
payload: '{ "jsonrpc" : "2.0" , "id" : "1321455517694427543" , "method" : "veolia.wasteservices.v1.getServicesByUPRN" , "params" : { "uprn" : "XXXXXXXXXXX" } }'
value_template: "{{ as_timestamp(value_json.result.services[1].ServiceHeaders.ServiceHeader.Next) | timestamp_custom('%A, %B %d, %Y') }}"
headers:
Content-Type: application/json
User-Agent: Home Assistant REST sensor
```
anthony1
(Anthony)
December 19, 2021, 10:03am
2
Fixed with:
‘’’
platform: rest
name: Green Bins Collection
resource: https://citizen.westberks.gov.uk/apiserver/ajaxlibrary
method: POST
scan_interval: 7260
device_class: timestamp
payload: ‘{ “jsonrpc” : “2.0” , “id” : “1321455517694427543” , “method” : “veolia.wasteservices.v1.getServicesByUPRN” , “params” : { “uprn” : “100081027906” } }’
value_template: “{{ as_timestamp(value_json.result.services[1].ServiceHeaders.ServiceHeader.Next) | timestamp_custom(’%Y-%m-%dT%H:%M:%S%z’) }}”
headers:
Content-Type: application/json
User-Agent: Home Assistant REST sensor
and then using a template sensor:
sensor:
name: “Green Bin”
state: “{{ as_timestamp(states(‘sensor.green_bins_collection’)) | timestamp_custom(’%a %d %b’) }}”
icon: “mdi:calendar-clock”
‘’’
esbenr
(Esben Bücking-Rasmussen)
June 2, 2022, 7:16am
3
Can you please elaborate on what the problem was?
anthony1
(Anthony)
June 26, 2022, 6:36pm
4
it was the timestamp formatting changes that caused it to stop working