The command that I enter in things works in the terminal, I also wrote the command in the whitelist. The command is:
/usr/bin/python3 /etc/openhab2/scripts/relais.py 4 %2$s
The command that I enter in things works in the terminal, I also wrote the command in the whitelist. The command is:
/usr/bin/python3 /etc/openhab2/scripts/relais.py 4 %2$s
Youâre going to have to provide a lot more information than that. Please see How to ask a good question / Help Us Help You.
Your title and the contents of the post donât match up either. So it works in a rule, then why not use that rule?
Are you really running OH 2.5? PaperUI doesnât exist in OH 3.
Show your configs. Show your logs. Describe what youâve done.
Weâre happy to help but you have to meet us half way.
What else is needed?
I donât understand the question correctly, I speak and write German and then have Google translate it
Here is the rule with which it works
rule âAussenbeleuchtung einschaltenâ
when
Time cron "0 30 07 ? * MON,TUE,WED,THU,FRI" or
Time cron "0 30 08 ? * SAT,SUN" or
Channel 'astro:sun:home:set#event' triggered START
then
grp_relais?.members.forEach[Switch|sendCommand(Switch, "ON") Thread::sleep(2000)]
logInfo("Testregel","Hier ist tatsÀchlich eingeschaletet worden")
end
OK, you are running OH 2.?. Which specific version? See 10 in the link I posted above.
Youâve shown events.log but not openhab.log. But mind 12 in the link above, please post text with code fences where possible. Screen shots are next to useless.
Youâve not shown the Item configs, specifically which Items are linked to which Channels of the Thing. Thatâs particularly important since you are using %2 in the command.
There is a German language forum where it might be easier to get help.
Looking at your events.log
, your Gewaechshaus Item is getting a whole series of ON/OFF commands within seconds. If that has something to do with the rule or the Thing you have shown us, there is also something else at work - another rule perhaps.
Thanks for the answer.
I use Openhabianâs fast on / off
I generated switching processes via the app on the mobile phone.
The rules that I have set up work well in my opinion.
Because of my problem, Iâve looked around the Internet and the Openhab community a lot, Iâve learned a lot, but I canât get on with things. The command works when I type it into the terminal. But there I enter ON once and OFF the next time as the second parameter.
I am using Openhabian on a Rasberry:
Release = Raspbian GNU / Linux 10 (buster)
Your Thing has âautorun
â turned off. This means that your script will not be run when you send a command through your Item to the input
channel.
I have activated autorun, but there is no change.
the command that works in the terminal is obviously not executed in the command line of the thing.
I donât know how I can control that more closely.
Iâve already read about the user rights, but I canât get any further.
I have a whitelist in the directory â/etc/openhab2/misc/exec.whitelistâ with the following content:
usr / bin / python3 /etc/openhab2/scripts/relais.py 4,% 2 $ s
created
I also searched for and read the exec binding in the community and tried out a lot of things that I found
Also after the
RegEx transformation-regex - 2.5.0 looked at it
I had to
file /var/lib/openhab2/etc/org.ops4j.pax.url.mvn.cfg
change, then I could install RegEx
Youâve not linked anything to the Input channel. The %2$s
gets replaced with the contents of the Item linked to that Channel. Typically in a case like this you will send a command to the Item Linked to the Input Channel, which triggers the script to be called.
Note there is also an Output Channel. Link a String Item to that and youâll get the text output by the script.
The Switch Item linked to the Run Channel indicates whether or not the script is running. In this configuration it is not used to trigger the script to run.
Youâve still not posted any openhab.log entries. The Exec binding actually logs out what itâs doing when it runs.
Sorry about the openhab.log entries
2021-12-28 15:44:16.861 [ERROR] [ng.exec.internal.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : âFormat specifier â%2$sââ
2021-12-28 15:45:47.825 [ERROR] [ng.exec.internal.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : âFormat specifier â%2$sââ
2021-12-28 15:47:49.116 [ERROR] [ng.exec.internal.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : âFormat specifier â%2$sââ
2021-12-28 15:47:50.955 [ERROR] [ng.exec.internal.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : âFormat specifier â%2$sââ
2021-12-28 15:47:54.106 [ERROR] [ng.exec.internal.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : âFormat specifier â%2$sââ
2021-12-28 15:47:57.506 [ERROR] [ng.exec.internal.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : âFormat specifier â%2$sââ
2021-12-28 16:27:07.123 [INFO ] [pse.smarthome.model.script.Testregel] - Steckdose Shelly 1 eingeschaltet
2021-12-28 16:27:11.883 [INFO ] [pse.smarthome.model.script.Testregel] - Hier ist tatsÀchlich eingeschaletet worden
2021-12-28 16:27:37.892 [INFO ] [pse.smarthome.model.script.Testregel] - Hier ist sind die Steckdosen eingeschaletet worden
I mean, but I have linked the input channel to the item, isnât that correct?
Are you controlling anything but Shelly devices ? If not, why not use the Shelly binding instead of exec binding with python script ?
I think you missed this in the binding docs -
Attention: Linking
input
to any other item type thanString
will result in erroneous behavior. If needed, please use a rule to convert your itemâs state to a string.
Exec binding can be quite clumsy to use. Another limitation of the input channel is that autorun only triggers for commands that are different from the previous.
You might want to keep your Switch type Item, abandon the binding, and instead use a command-triggered rule to run executeCommandLine()
instead.
the Shelly devices are used in the house, the relays are in the sub-distribution, from there lines go into the garden.