314ma

time_to_event

Dec 16th, 2020 (edited)
244
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sensor:
  2.   - platform: template
  3.     sensors:
  4.       time_to_event:
  5.         value_template: >
  6.          {%- if state_attr('calendar.familijne', 'start_time') == None -%}
  7.             Brak wydarzeń
  8.           {%- else -%}
  9.             {%- set t = ((state_attr('calendar.familijne', 'start_time') | as_timestamp - now() | as_timestamp)/3600) | int  -%}
  10.             {{ (t/24) | round(method='floor') }} dni, {{ t % 24}} godzin
  11.           {%- endif -%}
RAW Paste Data