Great integration. Works perfectly.
Just to get some people up and running below you can find some template examples:
// Show all upcoming (available timeslots)
{% for timeslot in state_attr('sensor.picnic_delivery_time_slots', 'time_slots') -%}
{% if timeslot.is_available == true -%}
{{
as_timestamp(timeslot.window_start) | timestamp_custom('%a %b %d, %H:%M')
+ ' - '
+ as_timestamp(timeslot.window_end) | timestamp_custom('%H:%M')
}}
{% endif -%}
{% endfor %}
// Results
Thu Feb 11, 21:00 - 22:00
Fri Feb 12, 18:15 - 19:15
Sat Feb 13, 21:00 - 22:00
Sun Feb 14, 15:30 - 16:30
Mon Feb 15, 11:30 - 12:30
Mon Feb 15, 21:00 - 22:00
// Setup integration (Use secrets)
- platform: picnic
username: !secret picnic_username
password: !secret picnic_password
country_code: "NL"
// Create a friendly template sensor
- platform: template
sensors:
picnic_next_delivery_formatted:
friendly_name: "Picnic Next Delivery"
value_template: "{{
as_timestamp(state_attr('sensor.picnic_delivery', 'delivery').window_start)
| timestamp_custom('%a %b %d, %H:%M')
+ ' - '
+ as_timestamp(state_attr('sensor.picnic_delivery', 'delivery').window_end)
| timestamp_custom('%H:%M')
}}"
icon_template: mdi:truck-delivery
picnic_first_available_timeslot_formatted:
friendly_name: "Picnic First Available Timeslot"
value_template: "{% set ns = namespace(found=false) %}
{% for timeslot in state_attr('sensor.picnic_delivery_time_slots', 'time_slots') -%}
{% if timeslot.is_available == true and ns.found == false -%}
{{
as_timestamp(timeslot.window_start) | timestamp_custom('%a %b %d, %H:%M')
+ ' - '
+ as_timestamp(timeslot.window_end) | timestamp_custom('%H:%M')
}}
{% set ns.found = true %}
{% endif -%}
{% endfor %}"
icon_template: mdi:calendar-clock