Dear community, I have installed the astro binding as well as a somfy tahoma binding to control my rollershutters. Controlling them works like a charm, so now I want to open and close them during the course of the day based on the astro events. Hence I created a rule for that. This worked as well, but rollershutters are opening way to early and close too soon. So I checked the astro binding again and came up with creating an additional astro thing with an offset. The setup worked well and the items show the proper offset time of day. However the event activitiy (Start / End) still run on the regular time.
Here is what I have done:
Create an astro thing with a given offset
//Things Astro
Thing astro:sun:sunset_offset "Sonnenaufgang mit Offset" [geolocation="XX.XXXXXXX,XX.XXXXXXX,98", interval=60 ] {
Channels:
Type rangeEvent : rise#end [
earliest="07:00",
latest="08:30"
]
Type rangeEvent : set#end [
earliest="22:00",
latest="00:00"
]
}
I created a rule to run rollershutters based the astro offset (e.g. sunrise end)
//Rule Sonnenaufgang
//RolllÀden öffnen mit Sonnenaufgang (Offset), Schalfzimmer nur, wenn niemand zuhause ist
rule "RolllÀden Sonnenaufgang"
when
Channel "astro:sun:sunset_offset:rise#event" triggered END
then
logInfo("Rule Log", "Regel - RolllĂ€den Sonnenaufgang - ausgefĂŒhrt")
if (Gruppe_Anwesenheit.state == OFF) {
Rolladen_SZ_Steuerung.sendCommand(UP)
}
Rolladen_WZ_Terrasse_Steuerung.sendCommand(UP)
Rolladen_WZ_Sofa_Steuerung.sendCommand(UP)
Rolladen_Sportzimmer_Steuerung.sendCommand(UP)
Rolladen_EZ_Steuerung.sendCommand(UP)
Rolladen_Buero_Steuerung.sendCommand(UP)
sendNotification("MAILADDRESS", "TEXT")
end
Now I would have expected the rule to run at the offset time of e.g. T07:00:00.000+0200 as shown in the screenshot above.
However if I check my log, the rule triggered at the original time which is T05:27:00.000+0200. Please see screenshot:
You both lead me to specifying an offset not just for the END/START but rather for the whole event. I donât quite get, how this works just from a theoretical thinking (I get how to do it though). Maybe you can explain it to me.
If I apply an offset to END/START, it is quite clear, that it moves the actual point in time (e.g. START - 30 minutes) or specifies an particular statement for EARLIEST/LATEST. But how does an event be affected by this? An event is a duration like From-To, or not? How can you apply an offset to this time period? I do not get it, sorry.
The offset only affects the channel itâs configured on. If you would have linked an Item to e.g. the rise#start channel, that would display the original time without offset applied, since thatâs only configured on the rise#end channel. Same goes for rise#event.
Have you tried following the example in the link or are you still trying to use the files?
Personally I find the UI easier and less confusing and less prone to errors.
Donât put anything in the earliest and latest. Leave that blank.
As far as the files goes, sorry canât help you there.
Okay, understood. But isnât that, what I have done? I have specified the offset for the channel rise#end as you can see in the things-file (or also in the UI):
Type rangeEvent : rise#end [
earliest="07:00",
latest="08:30"
No, each channel group (e.g. rise) have four different channels: #start, #end, #duration and #event, all with separate configurations. You have only configured the #end channel.
Okay, now replying to both of you @pacive and @hmerk. Sorry if I keep asking stupid questions.
I specified the offset for the #end channel, as you can see above in post #7. I agree.
I then created a rule, which shall fire once channel #event triggered END.
So having the rule react to #event is not what I want, as I did not specify any offset for that channel. So I need to adjust as mentioned as well in post #7?
rule "RolllÀden Sonnenaufgang"
when
Channel "astro:sun:sunset_offset:rise#end" triggered
then
logInfo("Rule Log", "Regel - RolllĂ€den Sonnenaufgang - ausgefĂŒhrt")
if (Gruppe_Anwesenheit.state == OFF) {
Rolladen_SZ_Steuerung.sendCommand(UP)
}
Rolladen_WZ_Terrasse_Steuerung.sendCommand(UP)
Rolladen_WZ_Sofa_Steuerung.sendCommand(UP)
Rolladen_Sportzimmer_Steuerung.sendCommand(UP)
Rolladen_EZ_Steuerung.sendCommand(UP)
Rolladen_Buero_Steuerung.sendCommand(UP)
sendNotification("Mailaddress", "Text")
end
Correct?
But checking my log files, the channel rise#end does not trigger anything at all. I canât find it. I only find the channel rise#event triggering something (START and END).
No, the #event channel is the only one that is a trigger channel, i.e. can be used as a rule trigger. So you HAVE to configure the offset on this channel if you want the rule to be triggered according to the offset.
Edit: this is my config:
The rise#end channel has no offset configured, and displays the actual time of the sun rise.
This form of rule trigger is looking for a channel trigger event.
But rise#end is not an event channel. It is a state channel. You can tell this because you can link it to a Datetime Item.
At midnight, Astro binding works out times for the day ahead, and updates state channel rise#end to 06:30 or whatever. An Item linked to that channel stays at 06:30 until next midnight, nothing happens with it, you canât use that for triggers.
Channel rise#event is a trigger event channel. Itâs a completely different type, you canât link it to an Item because it has no state at all. It just triggers events once in a while, events called START or END.
So you need to change your rule trigger from
astro:sun:sunset_offset:rise#end
to
astro:sun:sunset_offset:rise#event
To apply an offset to the event
Type rangeEvent : rise#event [
earliest="07:00",
latest="08:30"
Note that you have to offset the whole event, you cannot offset START and END individually.
What you do with the event does not affect the state channels, independent offsets.
Simple summary: if you donât see the word event in your trigger and in your offset, youâve got it wring.
Okay, all understood. Thanks @rossko57 for the explanation. To just check, if I got it correctly.
Letâs say:
I specified the offset for an event as mentioned by @rossko57 to be earliest=â07:00â and latest=â08:30â. The regular state for rise#start is 06:45 and the regular state for rise#end is 08:15
As a result, the trigger of rise#event will fire for START at 07:00 (based on the offset) and for END at 08:15 (offset wonât have any impact here)
Is that correct?
Am I assuming right, that if I want various offsets for END (letâs say earliest 08:30), I would have to create an additional astro thing and place the right offset in the rise#event here yet again.
Donât think so. You cannot offset the individual components of an event/trigger channel, only the whole event.
If you offset +10 say, both START and END events get +10.
If you âearliestâ 07:00 say, neither START nor END will take place before 07:00. If they both ânaturallyâ fall before 07:00, I think youâll get both in millisecond quick succession at 07:00
Sunrise START and END events are normally just a few minutes apart, the time it takes the Sunâs disc to cross the horizon.
Yes, e.g. a weekday earliest Thing and a weekend earliest Thing.
EDIT - reading again, I donât think youâve grasped it yet
It doesnât matter what you do to rise#start and rise#end, these are state channels and it will only affect what you see in linked Items. This does not affect rise#event at all
If you want rise#event to have earliest/latest, you have to tell it.
When you do ⊠This does not affect rise#start or rise#end at all
itâs all fully independent.
I think I got it, @rossko57. It is maybe my misleading English to tell exactly, what I understood.
So here is, what Iâve done now:
Setting offset at the rise#event and the set#event channels like:
Thing astro:sun:sunset_offset_week "Sonnenaufgang mit Offset Werktag" [geolocation="XX.XXXX31765844546,XX.XXXX60934829714,98", interval=60 ] {
Channels:
Type rangeEvent : rise#event [
earliest="07:30",
latest="08:00"
]
Type rangeEvent : set#event [
earliest="22:00",
latest="00:00"
]
}
The offset is well reflected in the UI as well.
Now create a rule, telling OH3 what to do - like:
rule "RolllÀden Sonnenuntergang"
when
Channel "astro:sun:sunset_offset_week:set#event" triggered END
then
logInfo("Rule Log", "Regel - RolllĂ€den Sonnenuntergang - ausgefĂŒhrt")
if (Gruppe_Anwesenheit.state == OFF) {
Rolladen_WZ_Terrasse_Steuerung.sendCommand(STOP)
}
Rolladen_WZ_Sofa_Steuerung.sendCommand(STOP)
Rolladen_Sportzimmer_Steuerung.sendCommand(STOP)
Rolladen_EZ_Steuerung.sendCommand(STOP)
Rolladen_Buero_Steuerung.sendCommand(STOP)
Rolladen_SZ_Steuerung.sendCommand(STOP)
logInfo("Rule Log", "Regel - RolllĂ€den Sonnenuntergang - durchgefĂŒhrt")
sendNotification("Mailaddress", "RolllĂ€den bei Sonnenuntergang schlieĂen")
end
Now the rollershutter at sunset shall close, if the set#event triggerd END.
END as trigger of set#event will be earliest at 10PM and latest at midnight. Or, if the regular state is somewhere in between, it will fire in between.
Only if you apply an identical offset to the separate state channels, I think.
Bear in mind the state channels only get recalculated at binding restart or midnight.