Civil dawn/dusk, nautical dawn/dusk, sunrise/sunset on tools page

Hi Everyone!

I’m looking for the time of civil dawn/dusk, nautical dawn/dusk and sunrise/sunset for my location. I was almost certain this information used to be displayed on the tools tab of a reactor sensor, but maybe that was on an older version… (running 2.4 now).

Does anyone know if this information is still readily available and where it can be found under the reactor sensors?

Thankyou!

It’s available in conditions, specifically the “Sun” condition type.

Hi Patrick!

Oh sorry, I perhaps wasn’t clear. I found them under the conditions and can use them as such.

I guess I was wondering how I can see what the actual time is that nautical dusk/dawn, civil dusk dawn are evaluating to? (i.e 8:34 pm etc). Is there a place I can still see these?

OK. Add the following variable/expressions to the configuration of any ReactorSensor:

Name           Expression
suntbl         unstringify( getstate( "Reactor", "urn:toggledbits-com:serviceId:Reactor", "sundata" ) )
tym            strftime( "%c", suntbl.civdusk )

In the getstate() expression, make sure that first parameter (“Reactor”) contains the actual name of your Reactor master device. Or, you can put in the Reactor master’s device number (without quotes).

You can modify the second expression to display whichever sun time you are looking for: sunrise, sunset, civdawn, civdusk, nautdawn, nautdusk, astrodawn, astrodusk. You can also add more such expressions to display more than one of the time values, just give each variable/expression a unique name.

1 Like

ahhh so I can bring it out with an expression. Ok, my main reactor device is 23. I tried this… but got the following errors. Any ideas where I went wrong?

suntbl     unstringify(getstate(23, "urn:toggledbits-com:serviceId:Reactor", "sundata" ))
Invalid result type for state variable storage (table)

tym      strftime( "%c", suntbl.civdusk )
Undefined variable: suntbl at 7

You didn’t go wrong, I did. I’ve got 3.0 on the brain these days. Reactor 3.0 allows the direct storage of a table result, but 2.x does not. So in 2.x, you have two slightly different steps, and you have to repeat both for each time value you want to retrieve:

civdawn    unstringify( getstate( 23, "urn:toggledbits-com:serviceId:Reactor", "sundata" ) ).civdawn
civstring  strftime( "%c", civdawn )

So basically in 2.x, you have to reduce the result of each expression to a primitive type (number, string, boolean), where 3.0 will allow you to store table results. That means in 2.x, you have to do repeat the longer form first expression for each element you want to retrieve, as well as the second to format it into a human-readable date/time. The longer 2.x form will still work in 3.0, of course.

Ahh so version 3 will allow storage of a table set of results, then you can just call each of them with the ```
strftime( “%c”, suntbl.XYZ), where XYZ is civdusk, civdawn etc… without having to explicity specify in the first expression. Cool. Maybe I’ll have to sign up for a 3.0 beta tester! :slight_smile:

Your mods worked perfectly for the 2.x version though, returned the civdawn and civdusk results using the modified expression string. Thankyou sir!!

3.0 is in beta right now, has been for about two weeks. It’s settled down pretty well, so I will probably open it to public pre-release toward the end of the week. If you want to try it sooner than that, PM me your email address and I’ll add you to the list and send you the install package.