Astro Binding Rule

Hallo, ich hätte mal eine Frage zum Astro Binding und OpenHAB2

Ich habe mir eine Regel mit dem Rule Addon in Paper UI erstellt und zwar wenn “a trigger Channel fires” den Channel “Local Sun(Set#Event)” und bei Event einfach frei gelassen . Das Item “Draussen hell” wird so auch zuverlässig geschaltet. Für Sonnenaufgang habe ich ebenfalls eine Regel erstellt.

Das Problem ist nur das bei einem Neustart die Regeln auf uninizialized stehen und ich deswegen eine Regel selber erstellen will. Nur will das nicht funktionieren.

Habe die Regel wie folgt erstellt:

rule "Test Astro"
when
Channel ‘astro:sun:home:rise#event’ triggered START
then
sendCommand(VirtualItemTestSwitch,ON)
end

Was mache ich falsch, danke schon mal für die Antworten.

This is the international forum, if you write your question in English you will increase the chance someone can help you. I think there is a German forum somewhere if you prefer that instead. Anyway, you have to use double quotes defining the Channel… like

rule "Test Astro"
when
       Channel "astro:sun:home:rise#event" triggered START
then
      VirtualItemTestSwitch.sendCommand(ON)
end

Nope:

https://docs.openhab.org/addons/bindings/astro/readme.html#full-example

rule "example trigger rule"
when
    Channel 'astro:sun:home:rise#event' triggered START 
then
    ...
end

german and stuff already cleared, then

  • make sure, you use either " or ' (it seems, it is ).
  • Please check your astro-config (I believe it’s still in PaperUI, so go to Configuration > Things > astro sun data and make sure, the channel “Sunrise” is named like you addressed it (you can use the neat Copy-icon):
  • if that’s named, please make sure your “VirtualItemTestSwitch” is also addressed correct.

lastly some tips:

  • Check your logs (it should read the changes and/or Errors connected with it)
  • add some logging yourself:
rule "Test Astro"
when
      Channel ‘astro:sun:home:rise#event’ triggered START
then
      logInfo("astro logging", "I'm inside the rule")
      sendCommand(VirtualItemTestSwitch,ON)
end

with this - you should see in the logs, what went wrong. If it’s misconfiguration within the rule, it should say righton. if it’s within the addressing of the channel/item, it should either not trigger at all, or throw an error, if the item is sendCommanded. Next tipp: if making the trigger at first without a Event, which is only once a day, you can use another trigger (like every Minute or a virtualSwitchItem), so you can make sure, the rule works and you can wait for the trigger.

Hmmmm… Interesting. The rules documentation states otherwise https://docs.openhab.org/configuration/rules-dsl.html#channel-based-triggers :slight_smile:

1 Like

Note: You need to use quotes around triggerChannel if it contains special characters such as :.

I always use quotes - and they work.
But either single quotation marks are the key (then the astro-binding documentation must be updated), or both are possible (then the rules documentation must be updated)… :wink:

Quite right

I have always used single quotes for the astro binding, that works :grinning:

1 Like

ok, how do we change the rules documentation, then! :wink:

Submit an issue to github

I would not create a PR directly, instead discuss your change in the issue. The channel trigger is quite new, only few bindings support it and I’m not sure if EVERY binding uses double AND single quotations.

https://docs.openhab.org/addons/bindings/astro/readme.html#full-example

refers to ' while

https://docs.openhab.org/configuration/rules-dsl.html#channel-based-triggers

refers to "
:slight_smile:

I’m no developer, but the binding is responsible for the syntax within a rule? Then indeed we have to file an issue to get this straight…

Me neither … :grinning:

If that is the case,

Yes :sunglasses:

No, it does not. The syntax within the Rule is handle by OH core, not the binding. Since both single quotes and double quotes appears to be supported for Astro, it will be supported by all bindings in Rules.

This is the file that should be updated:

https://github.com/openhab/openhab-docs/blob/gh-pages/configuration/rules-dsl.md

Eine kurze Rückmeldung, nochmal auf deutsch, sorry. Suche mir sofort ein deutsches Board.
Also es lag tatsächlich an der falschen Adresse. Habe die so aus einer Regel aus dem Netz kopiert.
Bei Range Event steht bei mir local anstatt home. Und damit funktioniert es jetzt auch. Danke an alle für die Hilfe. Falls jemand ein deutsches Board kennt, bin für jeden Tipp dankbar.
Gruß

great to hear it works now!


Du wirst hier mehr Unterstützung finden als anderswo, das ist das offizielle Forum für alle. Es gibt daneben ein deutsches Forum (hat sihui ja schon gepostet):

Dort gibt es auch noch guten Traffic und viele Antworten - wenn Du englisch nicht so gut kannst, ist das die beste Quelle!
Hier im englischen Forum sind die Entwickler (Core und Bindings) regelmässig unterwegs, was es etwas einfacher macht - wenn man englisch kann.

hier die “offizielle Seite dazu”:
https://www.openhab.org/community.html