Need help to compare date time with a sensor containing date time in binary_sensor

here is some additional information…

Have you checked that “as_timestamp” for your sensor actually returns a valid unix timestamp in the template editor?

I think it should but since you having troubles it is easy enough to check.