Display sunset in local time in assist

HI All.

I am trying to work out how to display time in local time instead of UTC
see below

I have OpenAI as my pipeline, and ask a simple question, but would like it to display it in local time

I am trying to work what instructions to add to the OpenAI config, I have added {{ utcnow().astimezone() }} but it doesnt work

The best I can get it if I add {{ now().astimezone() }} which displays the following

Does anyone have any instructions to add which will only display in local time

Thanks

Have you tried simply adding the instruction to only use your time zone in the prompt?

This is the intent/script I use:

conversation:
  intents:
    MyLocalSun:
      data:
        - sentences:
            - "what (time's|times|time is) {sun_event} [at] [{day_ord}]"
            - "(when's|whens|when is) {sun_event} [at] [{day_ord}]"
          lists:
            sun_event:
              values:
                - in: "(sunset|sun set)"
                  out: "sunset"
                - in: "(sunrise|sun rise)"
                  out: "sunrise"
                - "solar noon"
                - "solar midnight"
            day_ord:
              values:
                - "today"
                - "tomorrow"
          slots:
            day_ord: "today"

intent_script:
  MyLocalSun:
    speech:
      text: |
        {% set day_ord = 'today' if (day_ord is undefined or day_ord in ['today', '', none]) else day_ord%}
        {% if sun_event in ['sunrise', 'sunset'] %}
        {% set event_suf = 'setting' if sun_event 
        is search('set') else 'rising' %}
        {% else %}
        {% set event_suf = sun_event|slugify %}
        {% endif %}
        {% set ent = 'sensor.home_sun_'~event_suf %}  {# YOUR SENSOR GOES HERE #}
        {% set time = (state_attr(ent, day_ord)|as_datetime|as_local) %}
        {%- from 'speech_macros.jinja' import say_time -%}
        {{ sun_event|capitalize}}{{[' will be at ',' is at ']|random if now()<time else ' was at '}}{{-say_time(time, 5)}} {{day_ord}}.

I use Sun2 for the source sensors, but the template could be changed to fit other options.

HI, Yes when I ask in local timezone, it is correct, but i would just like to ask when is sunset or sunrise…

You could create separate entities that you provide to assist. e.g. localSunset I do this with current information where I’m picky about how it’s presented to me, like weather.