Files
ha-freshharvest/examples/dashboard-view.yaml
T
flan 527f662189 Surface add-on prices and add an add-ons total sensor
Add-on rows already carried quantity, unit and extended price; only the name
was exposed. The attribute now renders the full line and a new monetary
sensor reports the add-ons subtotal separately from the box.

The fixture totals were copied from a seven-add-on cart while the fixture
itself had one, so they are now self-consistent and a test asserts that
add-ons plus box price equals the portal's subtotal.
2026-08-03 19:15:19 +00:00

100 lines
3.3 KiB
YAML

# Fresh Harvest dashboard view.
#
# This is the tab shipped alongside the integration: three sections covering the
# next delivery, what is in the box, and the order that can still be changed.
#
# To use it, open your dashboard, choose "Edit dashboard" -> "Raw configuration
# editor", and paste this under `views:`. It only needs the six sensors the
# integration creates.
type: sections
max_columns: 4
icon: mdi:basket
path: fresh-harvest
sections:
- type: grid
cards:
- type: heading
heading: Next Delivery
heading_style: title
icon: mdi:truck-delivery
- type: markdown
content: |-
{%- set d = states('sensor.fresh_harvest_next_delivery') -%}
{%- set box = state_attr('sensor.fresh_harvest_next_delivery_items', 'box') -%}
{%- if d not in ['unknown', 'unavailable', 'none'] -%}
{%- set days = (d | as_datetime).date() - now().date() -%}
{%- set n = days.days -%}
## {% if n < 0 %}Delivered{% elif n == 0 %}Arriving today{% elif n == 1 %}Arriving tomorrow{% else %}Arriving in {{ n }} days{% endif %}
{{ (d | as_datetime).strftime('%A, %B %-d') }}{% if box %} · {{ box }}{% endif %}
{%- else -%}
## No delivery scheduled
{%- endif -%}
- type: tile
entity: sensor.fresh_harvest_next_delivery
name: Arriving
icon: mdi:calendar-clock
color: green
- type: tile
entity: sensor.fresh_harvest_next_delivery_total
name: Order total
icon: mdi:cash-multiple
color: teal
- type: tile
entity: sensor.fresh_harvest_next_delivery_add_ons
name: Add-ons
icon: mdi:cart-plus
color: purple
- type: tile
entity: sensor.fresh_harvest_next_delivery_items
name: Items
icon: mdi:basket-check
color: light-green
- type: grid
cards:
- type: heading
heading: What's Coming
heading_style: title
icon: mdi:carrot
- type: markdown
content: |-
{%- set produce = state_attr('sensor.fresh_harvest_next_delivery_items', 'produce') or [] -%}
{%- set addons = state_attr('sensor.fresh_harvest_next_delivery_items', 'add_ons') or [] -%}
{%- set addons_total = state_attr('sensor.fresh_harvest_next_delivery_items', 'add_ons_total') -%}
{%- set box_price = state_attr('sensor.fresh_harvest_next_delivery_items', 'box_price') -%}
{%- if produce -%}
**In the box**{% if box_price %} · ${{ '%.2f' | format(box_price) }}{% endif %}
{% for i in produce %}
- {{ i }}
{%- endfor %}
{%- else -%}
_Box contents not assigned yet._
{%- endif %}
{% if addons %}
**Add-ons**{% if addons_total %} · ${{ '%.2f' | format(addons_total) }}{% endif %}
{% for a in addons %}
- {{ a }}
{%- endfor %}
{%- endif -%}
- type: grid
cards:
- type: heading
heading: Still Open
heading_style: title
icon: mdi:cart-arrow-right
- type: tile
entity: sensor.fresh_harvest_open_order_delivery
name: Delivery
icon: mdi:calendar-arrow-right
color: amber
- type: tile
entity: sensor.fresh_harvest_shopping_window
name: Shopping window
icon: mdi:clock-alert-outline
color: orange
- type: markdown
content: |-
Once an order passes its cutoff it locks for packing, and the following week's cart opens.
[Change this order →](https://freshharvest.com/p/dashboard/manage-orders)