I like to get hour of the sunrise and sunset to Homey Script. I have the Sun Events app in which there are tags available for sunset and sunrise, but I have only found the way to get the capability values from other devices to Homey Script but the Sun Events app doesn’t have devices at all. What to do?
Also other ways of getting the sunrise and sunset hours to Homey Script would be appreciated.
I have an almost complete solution, but I do want this as a date object. And that is not easy, unless I split and build text into a parseable string. Anyone got a solution?
let sun=await Homey.apps.getAppSettings({id: 'com.cyclone-software.sunevents'})
// returns format 13.2.2026, 08:01
let sunrise=(JSON.parse(sun.myEventsTimes)).find(({ name }) => name === "Sunrise").date
let sunset=(JSON.parse(sun.myEventsTimes)).find(({ name }) => name === "Sunset").date