I have tried making a template for this, but no luck so far this is what I have, but but it reports Unavailable
sensor:
- platform: template
sensors:
days_until_full_moon:
friendly_name: "Days Until Full Moon"
unit_of_measurement: 'days'
value_template: >
{% set today = now().date() %}
{% set next_full_moon = states('sensor.moon') | as_datetime %}
{% set full_moon_date = next_full_moon.date() %}
{% set days_until_full_moon = (full_moon_date - today).days %}
{{ days_until_full_moon }}