I can control a relay via rule, but not via Paper UI

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.

1 Like

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)

Kernel = Linux 4.19.75+

Platform = Raspberry Pi Model B Plus Rev 1.2

Here are the channels of the thing

I will now continue to strive for the requirements

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 than String 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.