I need to ask for your help again. I cannot figure out why this will not evaluate correctly. I’m assuming this may be a syntax issue but I can’t spot it. Please help my sanity.
{% set action_response = {"calendar.david_work":{"events":[{"start":"2026-01-21T16:00:00+00:00","end":"2026-01-21T23:45:00+00:00","summary":"4-Mid"},{"start":"2026-01-23T16:00:00+00:00","end":"2026-01-23T23:45:00+00:00","summary":"4-Mid"}]}} %}
{% set test = action_response["calendar.david_work"]["events"][0].start | as_datetime %}
{% set shift_start_hour = test.strftime('%H')|int %}
{% if shift_start_hour > 05 %}
Test
{% else %}
Error
{% endif %}
Instead of returning Test, I am instead getting the following error:
TemplateSyntaxError: expected token ‘end of statement block’, got ‘integer’
How can I get this if statement to work? Many thanks for any help you can provide.
You ask a great question. I’m not sure either and will change them.
I have been using the Template tab in the Developer tools section but appreciate you flagging it up in case I hadn’t been.
EDIT:
Oh, correction, I didn’t realise which part of the code you were commenting on. This is raw output copied from the “Calendar: Get Events” action and I believe is structured as JSON, so not my choice!