Picnic: time offset (timezone?) in ETA sensor

Hi,
I want to create an automation for the PICNIC integration, for creating a calendar item for the moment my order will be delivered. Very simple automation, however…

If you look at the sensor (in this example; sensor.picnic_last_order_eta_end) I notice a ‘T’ between date and time and also notice 1 hour offset between checking the state in a template and checkling the state by opening the entry in the GUI. See screenshots below. Any thoughts???

Time offset:

And within a template, same:

That’s UTC time in ISO format and you can use the as_datetime filter to get rid of the ‘T’

{{ states('sensor.picnic_last_order_eta_end') | as_datetime }}

Thanks for your quick response!

Tried that also already, result, still an offset of 1 hour…:

What’s the timezone of your HA installation? UTC is GMT, CET (e.g. Europe/Berlin) is (currently) GMT/UTC + 1

CET, Amsterdam

So, everything is corrent. The UTC time from the sensor is mapped to the local timezone when being displayed.

Yeah. I guess you are right. My problem still isn’t solved tho…

How do I create a template so {{ states(‘sensor.picnic_last_order_eta_end’) | as_datetime }} is used in the automation in my timezone?

As per the folowing service in my automation:

service: google.add_event
data:
  calendar_id: [email protected]
  start_date_time: '{{ states(''sensor.picnic_last_order_eta_start'')| as_datetime }}'
  end_date_time: '{{ states(''sensor.picnic_last_order_eta_end'')| as_datetime }}'
  summary: Picnic ETA

This ends up in an appointment in my Google calendar with an incorrect offset of 1 hour (1h too early) :frowning:

Do you have any suggestions?

try combinations with as_local, like

"{{ states('sensor.picnic_last_order_eta_end') | as_local }}"

Yeah!!! This does the trick:

{{ states('sensor.picnic_last_order_eta_end') | as_datetime | as_local}}
1 Like