I’m trying out a simple astro-rule, according to information I think it should be working according to the attached code… I can see in my openhab-log that the event occurs…but the rule is not triggered… greatful for advice!
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.joda.time.*
import java.util.Date
rule "my astro-rule"
when
Channel 'astro:sun:local:set#event' triggered START
then
light1.sendCommand(ON)
light2.sendCommand(ON)
light3.sendCommand(ON)
end
Which version, 1 or 2?
According to your imports you are using openHAB1: astro 2 will not work with openHAB1
If you are using openHAB2:
check if your things is defined as “local”, because there is a mixup (not error) in the docs: manually created things example is “home”, but if you define astro thing through PaperUI it is “local”.
Thanks for the reply, I do use openhab2 and probably also astro2(?)… so this way of monitoring the channel does not work then ?
The imports are there because I dont know what Im doing
To be honest (as mentioned in another thred) I havent found any information of how to decide what to import and when …
To clarify:
openHAB1 works with 1.x bindings while openHAB2 works with 2.x AND 1.x bindings.
So let’s start from an earlier point, assuming you are using PaperUI and not text based files.
Check PaperUI → Add-Ons → Bindings if you have installed the “Astro Binding” and not the “Astro Binding (1.x)”
Go to PaperUI → Things and check if you have the thing Astro Sun data available and it’s online.
If not click on the “+” sign and let the Astro binding autodiscover the Astro Sun data thing.
Then click on the thing Astro sun data and add an item to the channel Sun Event Start Time
Now you have an item linked to the sun event channel and you should be good to go.
If you have done all that before I guess you only have to change Channel 'astro:sun:local:set#event' triggered START to Channel 'astro:sun:home:set#event' triggered START
If you are using text base things and items files it’s a little different story though …
Edit: and you should see in your openhab.log (after restart) something like:
2017-01-10 09:31:58.804 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-daily-sun at midnight for thing astro:sun:home
2017-01-10 09:31:58.809 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-positional with interval of 300 seconds for thing astro:sun:home
2017-01-10 09:31:59.548 [INFO ] [.astro.internal.job.AbstractDailyJob] - Scheduled astro event-jobs for thing astro:sun:home
Unfortunately still no luck…
I changed my code to:
rule "my astro-rule"
when
Channel 'astro:sun:home:set#event' triggered START
then
light1.sendCommand(ON)
light2.sendCommand(ON)
light3.sendCommand(ON)
end
Nothing happens…but I can see in the log that the event took place: