Event happening 1h before sunset triggers start?

Hi,
i have a rule that triggers when sunset starts. Thanks a lot to ASTRO its very easy as you for sure know.
Is there a simple way to have a rule that starts every day 1h before sunset starts?

Thanks a lot, Norbert

rule "HouseNr_Switch ON via Sunset"
when
    Channel 'astro:sun:local:set#event' triggered START
then
    HouseNr_Switch.sendCommand(ON)
    PvXL_Switch.sendCommand(OFF)
end

Binding docs describe offset.
Perhaps less obvious is that you can create another Thing and apply offsets to its features, while leaving your original Thing as normal.

1 Like

ah OK, but it requires a new ā€œthingā€. will check this offset element. thanks!

I didnā€™t say it required a new Thing.
You can apply an offset to any channel. But when itā€™s offset, itā€™s offset. If you want both regular and offset versions of the exact same channel, you would need a separate Thing.
However, for something like ā€œlights at duskā€ there are several dusk channels - civil, astro, etc. You can offset just one of those.

OK. thanks - will check out.

One more question as it seems to not work properly.
I used the eyisting ā€œLocal Sunā€ thing i have related to Astro binding, i simply took astro:sun:local:civilDusk#startā€¦which is in my location today 18:19ā€¦

In addition i created an item which would not be required, as far as i understandā€¦and it does the -45min offset correctlyā€¦but based on the rule below the switch turned off at 19:45. Any idea??? could you please check if ( @rossko57 ) my rule should work that way? Iā€™m uncertain if the set offset is considered if i do this based on an event???

2020-03-28 22:17:34.028 [vent.ItemStateChangedEvent] - LocalSun_CivilDusk_StartTime changed from 2020-03-28T18:19:00.000+0100 to 2020-03-28T17:34:00.000+0100

rule "PvXL_SwitchHouseNr_Switch OFF via Sunset"
when
    Channel 'astro:sun:local:civilDusk#event' triggered START
then
    PvXL_Switch.sendCommand(OFF)
end

What usually confuses people with the Astro binding is that state channels and events channels are completely different channels.
As such, they each have completely different offset and range settings.
Applying an offset to a ā€˜duskā€™ state channel will have no effect on a ā€˜duskā€™ event channel.

So an Item would be linked to a state channel.

while your rule is triggered from an event channel.

Youā€™ve not shown us whatever you did with offsets, so I have to guess that you offset the state channel only.

Itā€™s always difficult messing with astro settings as you might not get results for 24 hours, events for day ahead are calculated once at midnight.

hm, thanks for your feedback!

Long story shortā€¦based on my offset setting for element (whatever its called correctly)ā€¦will it work based on my rule above (to take my offset into consideration and not stay on zero offset).

I donā€™t know, I donā€™t use PaperUI for this stuff so I donā€™t recognize which channel youā€™re tweaking there.
For an event trigger, you want to be tweaking the Range Event channel that is the same one you use for a rule trigger.

hm, somehow it does not take the offset correctly as you already mentioned aboveā€¦

What i see is that the ā€œitemā€ i created works properly and based on my offset.
LocalSun_CivilDusk_StartTime changed from 2020-03-30T19:22:00.000+0200 to 2020-03-30T18:37:00.000+0200

Can you please tell me how i would define a rule that triggers when my item reached its timeā€¦compared to what i have right nowā€¦from the rule above. thanks!!!

You canā€™t, thatā€™s why Astro provides event triggers.

You should make sure you have restarted at least this binding to pick up any Thing edits. The events get scheduled at restart or midnight.

sorry but still i do not make it right and it confuses me even more every day.

Iā€™m on Civil Dusk for my Cityā€¦
It seems whatever i change the offset for ā€œastro:sun:local:civilDusk#startā€ it has no impact to the rule i do on ā€œChannel ā€˜astro:sun:local:civilDusk#eventā€™ triggered STARTā€.

Should this channel take offsets into account or do i need anything put into this rule in order to work as it shouldā€¦whatever i change in the offsetā€¦it perfectly reflects immediately in ā€œitemsā€ based on this Channel, but the channel rule itself always triggers without any offset?

Any idea?

That is correct.
You would want to change the offset for ā€˜astro:sun:local:civilDusk#eventā€™
States are not events.
They have different channels.
They have different offsets.
civilDusk#start is a state channel.
You can set an offset on that, it will not affect the events.
civilDusk#eventā€™ is an event channel.
You can set an offset on that, it will not affect the states.

1 Like

oh will tryā€¦still little confusing but i start getting itā€¦

Look for Range Event channels in PaperUI

thanks a lot, after several days of testing - seems to work great. many thanks again!!!

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.