InfluxDB: WHERE with only last day

Hello.
How I can send query with “WHERE time” to only last day (yesterday)?

I create a sensor template:

sensors:
timestamp_yesterday_start:
friendly_name: “Yesterday start”
value_template: “{{ (as_timestamp(now()) - (243600)) | timestamp_custom(‘%Y-%m-%d 00:00:10’, True) | as_timestamp()}}"
timestamp_yesterday_end:
friendly_name: “Yesterday end”
value_template: "{{ (as_timestamp(now()) - (24
3600)) | timestamp_custom(‘%Y-%m-%d 23:59:50’, True) | as_timestamp()}}”
but I dont know how can I put this sensors to query…

Something like that:

where: '“entity_id” = ‘‘gaz_impuls_z_licznika9’’ AND time > sensor.timestamp_yesterday_start AND time < sensor.timestamp_yesterday_end ’

dont work :frowning:

Thanks!