You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.6 KiB
68 lines
2.6 KiB
######################################################################
|
|
# @CCOSTAN - Follow Me on X
|
|
# For more info visit https://www.vcloudinfo.com/click-here
|
|
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
|
# -------------------------------------------------------------------
|
|
# Royal Caribbean - Price alerts and a sanitized booked-cruise countdown
|
|
# Uses Cruise Tracker for webhook alerts and a read-only Kitchen Show fact.
|
|
# -------------------------------------------------------------------
|
|
# Notes: Use script.notify_engine for app notifications.
|
|
# Notes: The REST endpoint omits confirmation, cabin, price, and watch-list data.
|
|
######################################################################
|
|
|
|
sensor:
|
|
- platform: rest
|
|
name: Next Booked Cruise Countdown
|
|
unique_id: next_booked_cruise_countdown
|
|
resource: !secret cruise_tracker_next_booked_url
|
|
method: GET
|
|
scan_interval: 3600
|
|
timeout: 20
|
|
value_template: >-
|
|
{% set cruise = value_json.next_booked_cruise | default(none) %}
|
|
{{ cruise.days_until if cruise is mapping and cruise.days_until is number else 'unknown' }}
|
|
json_attributes_path: "$.next_booked_cruise"
|
|
json_attributes:
|
|
- ship
|
|
- sail_date
|
|
- nights
|
|
- port
|
|
icon: mdi:ferry
|
|
unit_of_measurement: "days"
|
|
|
|
automation:
|
|
- alias: "Royal Caribbean Price Drop Alert"
|
|
id: royal_caribbean_price_drop_alert
|
|
mode: queued
|
|
trigger:
|
|
- platform: webhook
|
|
webhook_id: !secret royalcaribbean_price_drop_webhook
|
|
variables:
|
|
payload: "{{ trigger.json | default({}) }}"
|
|
ship: "{{ payload.ship | default('Royal Caribbean') }}"
|
|
sail_date: "{{ payload.sail_date | default('') }}"
|
|
room_type: "{{ payload.room_type | default('') }}"
|
|
old_price: "{{ payload.old_price | default('') }}"
|
|
new_price: "{{ payload.new_price | default('') }}"
|
|
booking_id: "{{ payload.booking_id | default('') }}"
|
|
details: >-
|
|
{{ [ship, sail_date, room_type] | select('string') | select('length') | join(' | ') }}
|
|
message: >-
|
|
New price {{ new_price }} vs {{ old_price }}.
|
|
action:
|
|
- service: script.notify_engine
|
|
data:
|
|
who: carlo
|
|
title: "Royal Caribbean price drop"
|
|
value1: "{{ details }}"
|
|
value2: "{{ message }}"
|
|
value3: ""
|
|
group: "royal_caribbean_price_drop"
|
|
level: "active"
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: "Royal Caribbean price drop"
|
|
message: "{{ details }} - {{ message }}"
|
|
notification_id: >-
|
|
{{ 'rc_price_drop_' ~ (booking_id if booking_id else sail_date|replace('-', '')) }}
|