Hi
Can someone help me to convert the following scrape result into a custom date/time format?
Scrape:
- resource: "https://www.tango.nl/stations/tango-amsterdam-langsom"
sensor:
- name: "Tango last update"
unique_id: tango_last_update
select: ".sidenote"
index: 0
availability: >-
{{ (states('sensor.tango_last_update') not in ('unknown', 'unavailable')) }}
gives me as result:
Laatste prijs update: 12:05 uur, 01-09-2024
But I’m looking for a custom date/time format like:
01 Sep 2024, 12:47
so: day month day, hour:minutes
When I try something like this it gives me the correct date but not the timestamp:
{% set x = states.tango_last_update| selectattr('state', 'in', ['unavailable', 'unknown', 'none']) | list | count %} {{ now().timestamp() | timestamp_custom('%d %b %Y, %I:%M') }}
result:
01 Sep 2024, 12:50
so the date is correct but not the time…
I’m wondering if I could better solve it at the scrape sensor, or use seperate template sensor like this?
thanks