[APP][Pro] Sun Events - Triggers you at certain positions of the sun

Orr install the latest test version.

Hello, I already have the latest version 2.4.3.
In the list all the events appear on the same date but it is updated every day.

Can’t you create flow with an event that starts today and ends tomorrow?

How do you control a light that turns on at sunset and turns off the day after sunrise?

Thank you

Events are instantaneous, and unless you use delays, so are flows more or less.
Use two flows, one that runs at sunset and one that runs at sunrise.

Is it possible to add a tag that sets the highest altitude point from the sun what it would be that day? With that tag i can calculate what the maximum lux would be from that day.

You can create it, albeit the highest value from yesterday.
If that’s precise enough:

I created a numeric var called [highest_altitude_yesterday] to store the value

Thanks that’s also something i can work with. I’ve been chatting the whole day with ChatGPT first it came up to import the SunCalc module into Homeyscript, but this wasn’t posible. The alternative is the code below. That is something i can work with.

Now i have the highest position from the sun at that day and with that i can calculate the highest lux from that day.

{{ round(110000 * sin(result* PI / 180)) }}

Somewhere between 100.000 and 120.000 should the highest possible lux outside. I took 110.000. Maybe someone can use this for them selfs :slight_smile:

// Setting the latitude for your location
const latitude = latitude ;

// Determine current date and day number
const today = new Date();
const startOfYear = new Date(today.getFullYear(), 0, 0);
const diff = today - startOfYear;
const oneDay = 1000 * 60 * 60 * 24;
const dayOfYear = Math.floor(diff / oneDay);

// Calculate declination
const declination = 23.44 * Math.sin((2 * Math.PI / 365) * (dayOfYear - 81));

// Calculate maximum sun altitude
const maxSunAltitude = 90 - Math.abs(latitude - declination);

// Round result to two decimal places
const roundedAltitude = Math.round(maxSunAltitude * 100) / 100;

// Return only the numeric result
return roundedAltitude;

Hello,

first of all, thanks for this great app. There seem to be some improvements and new features in the test version. I try to stick to stable versions wherever possible. Is there a timeline when the 2.x version of the app will be released as a stable version? I am still using the latest stable version 1.4.8.

I’ll test out the latest test version. As I was running the old stable version.
As far as I can see from the thread, it might be stable enough.

You refer to the latest test version for a lot of solutions. Which is for good reason.

I can confirm that the latest test version works like a charm, on my Homey Pro (Early 2016).
I had to adjust one script, as the circadian level is now in decimals/factor.

Any ide? i uninstall, reboot , install the latest verion Test, but not appear values any idea:

That’s normal for all (app) tags @ Pro 2023 and newer models.
To discover the value, add the tag to a notification card and test run it.

Hello,

it seems that the app is not properly evaluating the condition “It is between event and event”. As you can see after sunset, but before midnight the card evaluates to “false”. I would expect to return “true” like in the condition from the app Timey.

Homey can have issues with time conditions which reach past midnight
To rule that out, I invert the condition plus the events;
With your SE card, it would change into:
and it's not between sunrise ends and sunset starts

This returns true before midnight.

1 Like

Thank you for the hint that will fix my isse. :+1:

Nevertheless, I would consider this a bug that should be fixed by Athom or the app developer. As you can see with the “Date & Time” standard flow conditions and the Timey app it’s possible. There should be a development guide that defines how a condition which reaches past midnight should behave. Otherwise it’s inconsistent to the user.

1 Like

(still running some tests)

Hi,

first of all thanks for this great app. But since the latest test versions 2.46 / 2.47 it’s not working anymore. All my flows using Sun Events trigger are not running any more. Could you please have a look and fix it.

Thanks.

Peter

Yes, I will look into it. The strange thing is that I only updated the localisation. Could you maybe reboot homey? As I have no problem at my Homey. Please check if this is loaded correctly:

The times with in the several events:

I have the same effect since the current update. The flows are not working anymore.
Homey is rebooted. No times in the events

No problems with the event times:

(When… Flow Card)

Using also the new test version 2.4.7.

@owuerker, are you sure that you’re using the latest test version 2.4.7? If that were the case, then the events Moonrise and Moonset would already have to be translated into German, as they are for me.

1 Like

Yes I am using the latest version

Correction;-)
I had the regular Version 2.4.7. Using test version 2.4.7 I have the time for the events, too

Will check if the events are now triggered.