Calculate Years Month and Days to break even

Hello I need some help with a calculation.

I have created a sensor that calculates the seconds until the BReak Even from a sensor. This also works great now I would either like to change the existing sensor so that he calculates a date or a new from the seconds calculates how many years months and days it still is. I just do not get it right

here is the sensor that calculates the whole thing:

  • name: solar Time to Break-Even

      unique_id: "TtBE"         
    
      unit_of_measurement: "s"
    
      state: >
    

{{ (862-(states(‘sensor.solar_savings’) | float )) / ((states(‘sensor.solar_savings’) | float ) / (as_timestamp(now())) - 1692939600)) }}

I can’t find much to do with this

So to clarify…

you are saying that your sensor tells you how many seconds in the future it is until the break even point?

if so then you can show the time in the future by using this:

{% set futuretime = states('sensor.solar_time_to_break_even') %}
{{ now() + timedelta(seconds=futuretime)}}

just make sure the entity id of the sensor is correct

1 Like

Yes its in the future