# Calculate time between sun down and 00:00 in decimal value

**URL:** <https://community.homey.app/t/calculate-time-between-sun-down-and-00-00-in-decimal-value/71308>\
**Category:** Questions & Help\
**Tags:** homey-pro\
**Created:** [October 28, 2022, 8:49am UTC](https://community.homey.app/t/calculate-time-between-sun-down-and-00-00-in-decimal-value/71308 "2022-10-28T08:49:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Twan\_Veugelers](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/twan_veugelers/32/129333_2.png) [@Twan\_Veugelers](https://community.homey.app/u/Twan_Veugelers)\
**Post date:** [October 28, 2022, 8:49am UTC](https://community.homey.app/t/calculate-time-between-sun-down-and-00-00-in-decimal-value/71308/1 "2022-10-28T08:49:51Z")

</div>

Hi.

I have ordered the New Homey Pro, so I’m looking into replacing old / no longer maintained apps.  
One functionality I use, is the Spline app to calculate the light intensity for the Toilet upstairs. From Sundown to 00:00 it goes down from 1 to 0.05 in increments.  
So that is great, unfortunately Spline will not be maintained anymore.

So I’m thinking of using the Chronograph Transition functionality to calculate the light strength that is needed. But I want to have the time the transition needs to be calculated as sundown changes every day.

So Here is my question, how can I calculate the number of minutes or seconds from sundown to 00:00?

---

<div class="post-metadata">

**Author:** ![Marcel\_Ubels](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_ubels/32/18860_2.png) [@Marcel\_Ubels](https://community.homey.app/u/Marcel_Ubels)\
**Post date:** [October 28, 2022, 10:09am UTC](https://community.homey.app/t/calculate-time-between-sun-down-and-00-00-in-decimal-value/71308/2 "2022-10-28T10:09:18Z")

</div>

Maybe you can use a part of my script. I use the api for getting the total minutes of daylight. But when you have the time for Sunrise or Sunset you can calculate the minutes till 0:00.  
[Solar panels prognose with daylight minutes](https://community.homey.app/t/zonnepanelen-prognose-script-voor-de-solar-edge-omvormer-op-basis-minuten-daglicht-historie/68773)

This is the api call:

url = (‘[https://api.sunrise-sunset.org/json?lat='+latitude](https://api.sunrise-sunset.org/json?lat='+latitude) +’&lng=‘+longitude +’&date=’ + currentYear + ‘-’ + currentMonth + ‘-’ +count +‘&formatted=0’);

Just take a look at the website sunrise sunset  
[Website Sunrise Sunset](https://www.sunrisesunset.com/)
