Offsetting time based senor

Hello! I got a time based sensor from an Integration that I am trying to offset by a few minutes.
I found the following topics but I am unsure how to combine them:

This is what I have so far:

sensor:
  name: Time Test3
  unique_id: time_test3
  - platform: time
    sensor: jewish_calendar_upcoming_candle_lighting_3
  - platform: template
    sensors:
      jewish_calendar_upcoming_candle_lighting_3_offset:
        value_template: '{{states.sensor.sensor.jewish_calendar_upcoming_candle_lighting_3.state | float - 00:30}}'

Any help would be much appreciated!

For a start:

https://www.home-assistant.io/docs/configuration/templating/#states

What does this return in the Developer Tools → Template editor?

{{ states('sensor.jewish_calendar_upcoming_candle_lighting_3') }}

@tom_l It returns a string “2023-12-15T20:58:00+00:00”

I don’t remember where I got it from but I saw that it might be needed to take the string and turn it into numbers, is the following along the right path?

state: = { strptime(states("sensor.jewish_calender_upcoming_candle_lighting_3), "%d/%m/%Y, %H:%M", "") - timedelta( minutes = 30 )}

No not numbers. You can use it as a datetime object:

value_template: "{{ states('sensor.jewish_calendar_upcoming_candle_lighting_3')|as_datetime - timedelta(minutes = 30) }}"

Also note you should be using the new template integration for new sensors:

configuration.yaml

template:
  - sensor:
      - name: Jewish Calendar Upcoming Candle Lighting 3 Offset
        state: "{{ states('sensor.jewish_calendar_upcoming_candle_lighting_3')|as_datetime - timedelta(minutes = 30) }}"
        device_class: timestamp

I’m not sure what this is supposed to be:

sensor:
  name: Time Test3
  unique_id: time_test3
  - platform: time
    sensor: jewish_calendar_upcoming_candle_lighting_3

Thank you! That worked great! Out of curiosity how would I add 30 minutes from the result rather than subtract?

Change the minus sign to +

state: "{{ states('sensor.jewish_calendar_upcoming_candle_lighting_3')|as_datetime + timedelta(minutes = 30) }}"