Files
ha-freshharvest/examples/dashboard-view.yaml
T
flan 957505209a
Validate / hassfest (push) Failing after 6s
Validate / pytest (push) Successful in 11s
Validate / HACS (push) Failing after 15s
Cut 0.4.0: document the control entities and ship the dashboard
Rebuilds the README entity docs around the distinction that kept causing
confusion — the produce box is chosen, its contents are read-only, and only
add-ons are a list you edit — and re-exports the dashboard view now running,
including the date labels that stop the to-do list and the totals reading as a
contradiction.
2026-08-03 20:59:04 +00:00

183 lines
6.0 KiB
YAML

# Fresh Harvest dashboard view.
#
# Four sections: the next delivery, what is in the box, the controls, and the
# add-ons you can still edit.
#
# The split matters. The produce box is CHOSEN (a select), its contents are
# read-only, and only add-ons are add/removable (a to-do list). The to-do list
# edits the OPEN order while the totals describe the ARRIVING one, which is why
# each is labelled with its date -- unlabelled, they read as a contradiction.
#
# To use it, open your dashboard, choose "Edit dashboard" -> "Raw configuration
# editor", and paste this under `views:`. It needs only the entities this
# integration creates -- no custom cards.
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 n = ((d | as_datetime).date() - now().date()).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_items
name: Items
icon: mdi:basket-check
color: light-green
- type: markdown
content: |-
{%- set fee = states('sensor.fresh_harvest_next_delivery_fee') | float(-1) -%}
{%- if fee == 0 -%}
**Free delivery** on the order arriving next.
{%- elif fee > 0 -%}
Delivery fee of **${{ '%.2f' | format(fee) }}** applies to this order.
{%- endif -%}
- 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 box_price = states('sensor.fresh_harvest_next_delivery_box_price') | float(0) -%}
{%- set addons_total = states('sensor.fresh_harvest_next_delivery_add_ons') | float(0) -%}
{%- if produce -%}
**In the box** · ${{ '%.2f' | format(box_price) }}
{% for i in produce %}
- {{ i }}
{%- endfor %}
{%- else -%}
_Box contents not assigned yet._
{%- endif %}
{% if addons %}
**Add-ons** · ${{ '%.2f' | format(addons_total) }}
{% for a in addons %}
- {{ a }}
{%- endfor %}
{%- endif -%}
- type: grid
cards:
- type: heading
heading: Manage
heading_style: title
icon: mdi:tune-variant
- type: tile
entity: select.fresh_harvest_produce_box
name: Produce box
icon: mdi:package-variant-closed
color: green
features:
- type: select-options
- type: tile
entity: switch.fresh_harvest_skip_next_order
name: Skip next order
icon: mdi:calendar-remove
color: amber
- type: tile
entity: sensor.fresh_harvest_shopping_window
name: Shopping window
icon: mdi:clock-alert-outline
color: orange
- type: tile
entity: sensor.fresh_harvest_open_order_delivery
name: Open order
icon: mdi:calendar-arrow-right
color: amber
- type: tile
entity: sensor.fresh_harvest_open_order_total
name: Running total
icon: mdi:cash
color: teal
- type: markdown
content: |-
{%- set left = states('sensor.fresh_harvest_open_order_free_delivery_remaining') | float(-1) -%}
{%- set d = states('sensor.fresh_harvest_open_order_delivery') -%}
{%- set when = (d | as_datetime).strftime('%b %-d') if d not in ['unknown', 'unavailable', 'none'] else 'this' -%}
{%- if left == 0 -%}
The **{{ when }}** order already qualifies for free delivery.
{%- elif left > 0 -%}
The **{{ when }}** order needs **${{ '%.2f' | format(left) }} more** for free delivery.
{%- endif -%}
- type: tile
entity: button.fresh_harvest_donate_next_order
name: Donate this box
icon: mdi:hand-heart
color: pink
hide_state: true
- type: markdown
content: |-
Donating gives the whole box away and **cannot be undone**.
[Manage on freshharvest.com →](https://freshharvest.com/p/dashboard/manage-orders)
- type: grid
cards:
- type: heading
heading: Add-ons & Standing Orders
heading_style: title
icon: mdi:cart-plus
- type: markdown
content: |-
{%- set d = states('sensor.fresh_harvest_open_order_delivery') -%}
{%- if d not in ['unknown', 'unavailable', 'none'] -%}
Editing the **{{ (d | as_datetime).strftime('%b %-d') }}** order — the one still open.
{%- else -%}
No order is open for changes right now.
{%- endif -%}
- type: todo-list
entity: todo.fresh_harvest_add_ons
display_order: alpha_asc
- type: tile
entity: sensor.fresh_harvest_next_delivery_add_ons
name: Arriving box add-ons
icon: mdi:cart-plus
color: purple
- type: tile
entity: sensor.fresh_harvest_subscriptions
name: Subscriptions
icon: mdi:autorenew
color: cyan
- type: markdown
content: |-
{%- set items = state_attr('sensor.fresh_harvest_subscriptions', 'items') or [] -%}
{%- if items -%}
**Repeating every week**
{% for i in items %}
- {{ i }}
{%- endfor %}
{%- else -%}
_No standing orders beyond the box._
{%- endif -%}
- type: tile
entity: sensor.fresh_harvest_vacation_holds
name: Vacation holds
icon: mdi:airplane
color: blue