OpenHAB Exec Binding explained in detail on 433MHz radio transmitter example

rule "Wohnzimmer"
   when Item Wohnzimmer changed to OPEN
then
   postUpdate (Wohnzimmer.state == OPEN){}
   if(receivedCommand == 14756833){
     postUpdate(DOORSENSOR, OPEN)
   }else{
     if Wohnzimmer.stateCommand =(“FALSE”)
       (Wohnzimmer_Out.state == CLOSED)
   }
end

Group Licht_EG "Licht"

Switch Wohnzimmer

Switch Remote_Send { channel="exec:command:remote-send:run" }
String Remote_Send_Args { channel="exec:command:remote-send:input"}
String Remote_Send_Out { channel="exec:command:remote-send:output" }

```php
sitemap funklicht label="Erdgeschoss" {
    Frame label="Licht" {
        Switch item=Wohnzimmer icon="light"
        }
}

Thing exec:command:Wohnzimmer [
command="/home/pi/433Utils/RPi_utils/Wohnzimmer_decke.sh %2$s",
interval=0,
autorun=false




I have tried everything  on this page and I don't  know what als I should do ... I am only looking to get a states from my 433mhz door sensor to show on my openhab2 at habpanel for door open / door close. I am not expert for using python and Linux but I'm trying my best . if anyone here will post the right scripts for this project I would really appreciate it. I know most of the scripts in this page is for sending code but for my project its receiving code to give a status for open or close

@Josar you were absolutely right!
I ended up using the http binding with cache.
One GET returns multiple parameters.
Here are my items for picking out single values from the cache string:

ret=OK,pow=1,mode=4,adv=,stemp=24.0,shum=0,dt1=25.0,dt2=M,dt3=25.0,dt4=24.0,dt5=24.0,dt7=25.0,dh1=AUTO,dh2=50,dh3=0,dh4=0,dh5=0,dh7=AUTO,dhh=50,b_mode=4,b_stemp=24.0,b_shum=0,alert=255,f_rate=A,f_dir=0,b_f_rate=A,b_f_dir=0,dfr1=5,dfr2=5,dfr3=5,dfr4=A,dfr5=A,dfr6=5,dfr7=5,dfrh=5,dfd1=0,dfd2=0,dfd3=0,dfd4=0,dfd5=0,dfd6=0,dfd7=0,dfdh=0

http.cfg:

# configuration of the first cache item
ACcache.url=http://192.168.1.8/aircon/get_control_info?
ACcache.updateInterval=10000
# configuration of the second cache item  
ACsensorCache.url=http://192.168.1.8/aircon/get_sensor_info?
ACsensorCache.updateInterval=60000

.items

// http items
String ACpowerState                                               {http="<[ACcache:6000:REGEX(.*?pow=.*?([0-9]*).*)]"}
String ACsetTemp                                                  {http="<[ACcache:1000:REGEX(.*?stemp=.*?([0-9\\.0-9]*).*)]"}
String ACmode                                                     {http="<[ACcache:1000:REGEX(.*?mode=.*?([0-9]*).*)]"}
String ACfanRate                                                  {http="<[ACcache:1000:REGEX(.*?f_rate=.*?([AB34567]*).*)]"}
String ACfanDir                                                   {http="<[ACcache:1000:REGEX(.*?f_dir=.*?([0-9\\.0-9]*).*)]"}
String ACinDoorTemp "Inside temperature [%s °C]" <temperature>    {http="<[ACsensorCache:1000:REGEX(.*?htemp=.*?([0-9\\.0-9]*).*)]"}
String ACoutDoorTemp "Outside temperature [%s °C]" <temperature>  {http="<[ACsensorCache:1000:REGEX(.*?otemp=.*?([0-9\\.0-9]*).*)]"}

@OMR glad i could help.

@ramy_rutu first off all, what you wan´t is not achieve very fast. And note at all trivial.

Second watching your code, i think you miss proper undestanding for programming. Your code is full of erros.

Third i posted the basics of how you will get this done, you schould have followed them and make your solution.

Fourth it seems also you miss the propper manners as you expect us to do everything for you and call it support.

But you are lucky as a wanted to do a little coding exercise so i will post a solution in a seperate thread.

All good Josar. I have not missed anything for manner or respect . I have said that I don’t know how to code and I’m new, I am trying to learn small stuff and if I wanna fix my code than I need to study and study to understand what’s going on and I got no time not a lot… I thought someone here could just take my code and fix to help me and help others in this community . After all I do understand what you trying to say

Peace

@ramy_rutu as stated before with your approach what you want to do is not possible.

So please try to do something which is possible, then it will make sense to correkt your code.

Maybe try to read out the temperatures of your RPI.

Hey @ramy_rutu here you go.

Hey there.
At the moment I try to implement the 433MHz sender. When I fire up the send command from root it is working fine:

/opt/SourceCode/raspberry-remote# ./send 100001 1 1
using pin 0
sending systemCode[100001] unitCode[1] command[1]

When I try to send the same command as the openhab user I get the following error:

/opt/SourceCode/raspberry-remote# sudo -u openhab ./send 100001 1 1
using pin 0
wiringPiSetup: Must be root. (Did you forget sudo?)

I installed openhabian on a fresh debian installation with the setup wizard, because it’s a BananaPi (first edition, Dualcore, 1GB RAM)

I had to create the “gpio” group manually, it wasn’t created during the openhabian setup. Maybe there’s a fault. I tried a lot of things I’ve found in the forums but nothing worked.

Maybe someone have a clue what’s going wrong on my installation.

If you need more informations please tell me what to do :slight_smile:

Thanks a lot!
kovu94

What I’ve tested until now:

sudo visudo:

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL
openhab ALL=(ALL) NOPASSWD: ALL
www-data ALL=(ALL) NOPASSWD: ALL
openhabian ALL=(ALL) NOPASSWD: ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
%sudo   ALL=(ALL:ALL) ALL
openhab ALL=(ALL) NOPASSWD: ALL
www-data ALL=(ALL) NOPASSWD: ALL
openhabian ALL=(ALL) NOPASSWD: ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

  • chmod 777 for the send file
  • several right things I’ve found in the forums
  • several things in the openhab files (things, items, sitemap, etc.) - but I think it wont work until it works from command line
  • exec binding is installed (several attempts, first with habmin, after it through paperUI)

Details for the bananapi:

login as: root
 ____                                  ____  _
| __ )  __ _ _ __   __ _ _ __   __ _  |  _ \(_)
|  _ \ / _` | '_ \ / _` | '_ \ / _` | | |_) | |
| |_) | (_| | | | | (_| | | | | (_| | |  __/| |
|____/ \__,_|_| |_|\__,_|_| |_|\__,_| |_|   |_|


Welcome to ARMBIAN 5.38 stable Debian GNU/Linux 9 (stretch) 4.14.18-sunxi
System load:   0.45 0.36 0.40   Up time:       20 min
Memory usage:  23 % of 998MB    IP:            192.168.178.5
CPU temp:      36°C
Usage of /:    16% of 15G

Is it possible that we can check that the “gpio” group has the correct bindings in the system. I’m not a linux crack but I think there are some permissions I’ve to give to the group after creating it.

The point of the gpio group is that the files that represent the GPIO pins have permission to read/write for the group gpio.

Taken from a raspberry pi

rich@cerberos:~   ls -l /sys/class/gpio/
total 0
-rwxrwx--- 1 root gpio 4096 Jan 29 16:17 export*
lrwxrwxrwx 1 root gpio    0 Jan 29 16:17 gpiochip0 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0/
lrwxrwxrwx 1 root gpio    0 Jan 29 16:17 gpiochip100 -> ../../devices/gpiochip2/gpio/gpiochip100/
lrwxrwxrwx 1 root gpio    0 Jan 29 16:17 gpiochip128 -> ../../devices/gpiochip1/gpio/gpiochip128/
-rwxrwx--- 1 root gpio 4096 Jan 29 16:17 unexport*

When I look on my Banana Pi I see that those files only have permissions for root.

rich@chiron:~   ls -l /sys/class/gpio/
total 0
--w------- 1 root root 4096 Feb 12 11:50 export
lrwxrwxrwx 1 root root    0 Feb 12 11:50 gpiochip0 -> ../../devices/platform/soc/1c20800.pinctrl/gpio/gpiochip0/
lrwxrwxrwx 1 root root    0 Feb 12 11:50 gpiochip352 -> ../../devices/platform/soc/1f02c00.pinctrl/gpio/gpiochip352/
--w------- 1 root root 4096 Feb 12 11:50 unexport

Since sys is a tmpfs directory (meaning it gets created and populated on system boot) I don’t know how one would change the permissions on these files and have them stick through a reboot.

So I’m guessing you cannot access the GPIO on a Banana Pi as any user other than root.

@kovu94 and @rlkoshak i never did it myself but i think this could help to get it work.

and be aware that the udev rule has to be adapted from

/sys/devices/platform/soc/*.gpio/gpio

to

/sys/devices/platform/soc/*.pinctrl/gpio

or maybe

/sys/devices/platform/soc/*/gpio

or use

1 Like

I’m sure I tested this last weekend but I’ll try it again tomorrow because I’m not sure I made the dist-upgrade.

If it will not work I have to switch to a original raspberry, as @rikoshak mentioned. Maybe it’s by design for the banana pi.

Many thanks for you pointing me in the right direction. I’m back tomorrow evening with the results.

Good night :slight_smile:

Sorry. It doesn’t seem to work.

The udev rule is edited this way:

# /etc/udev/rules.d/80-gpio-noroot.rules
# Acces to GPIO without root
#
#  Change group
SUBSYSTEM=="gpio", PROGRAM="/bin/sh -c '/bin/chown -R root:gpio /sys/devices/platform/soc@01c00000/1c20800.pinctrl/gpio'"
# set acces permission
SUBSYSTEM=="gpio", PROGRAM="/bin/sh -c '/bin/chmod -R ug+rw /sys/devices/platform/soc@01c00000/1c20800.pinctrl/gpio'"

Because that’s the only “soc” in the folder:

[15:27:15] root@bananapi:/sys/devices/platform/soc@01c00000/1c20800.pinctrl/gpio# ls -la
total 0
drwxrwxr-x 3 root gpio 0 Feb 13 15:24 .
drwxr-xr-x 5 root root 0 Feb 13 15:26 ..
drwxrwxr-x 3 root gpio 0 Feb 13 15:24 gpiochip0
[15:27:17] root@bananapi:/sys/devices/platform/soc@01c00000/1c20800.pinctrl/gpio#

I use this version of WiringPi at the moment, the one you suggested doesn’t work.

Error with your Version:

Unable to determine hardware version. I see: Hardware   : Allwinner sun7i (A20) Family
,
 - expecting BCM2708, BCM2709 or BCM2835.
If this is a genuine Raspberry Pi then please report this
to projects@drogon.net. If this is not a Raspberry Pi then you
are on your own as wiringPi is designed to support the
Raspberry Pi ONLY.

It seems to work:

[15:31:46] root@bananapi:/opt/SourceCode/WiringBP# gpio readall
 +-----+-----+---------+------+---+--Banana Pro--+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT5 | 0 |  3 || 4  |   |      | 5V      |     |     |
 |   3 |   9 |   SCL.1 | ALT5 | 0 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 0 |  7 || 8  | 1 | ALT2 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 0 | IN   | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI | ALT5 | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO | ALT5 | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK | ALT5 | 0 | 23 || 24 | 0 | ALT5 | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 0 | ALT5 | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 0 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 | ALT4 | 0 | 31 || 32 | 0 | ALT4 | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+--Banana Pro--+---+------+---------+-----+-----+
[15:31:49] root@bananapi:/opt/SourceCode/WiringBP#

@rlkoshak - when I use “ls -l /sys/class/gpio” now it looks good:

[15:31:49] root@bananapi:/opt/SourceCode/WiringBP# ls -l /sys/class/gpio/
total 0
-rw-rw---- 1 root gpio 4096 Feb 13 15:25 export
lrwxrwxrwx 1 root gpio    0 Feb 13 15:25 gpiochip0 -> ../../devices/platform/soc@01c00000/1c20800.pinctrl/gpio/gpiochip0
lrwxrwxrwx 1 root gpio    0 Feb 13 15:25 gpiochip413 -> ../../devices/platform/soc@01c00000/1c2ac00.i2c/i2c-0/0-0034/axp20x-gpio/gpio/gpiochip413
-rw-rw---- 1 root gpio 4096 Feb 13 15:25 unexport
[15:32:30] root@bananapi:/opt/SourceCode/WiringBP#

But still this damn error:

[15:33:42] root@bananapi:/opt/433Utils/RPi_utils# sudo -u openhab ./codesend 9385235
wiringPiSetup: Must be root. (Did you forget sudo?)
[15:33:50] root@bananapi:/opt/433Utils/RPi_utils#

I think I’m going for an original RPi3 soon…

@kovu94 How are the permissions of

pi@raspberrypi:~ $ ls -l /sys/class/gpio/
total 0
-rwxrwx--- 1 root gpio 4096 Feb 13 23:02 export
lrwxrwxrwx 1 root gpio    0 Feb 13 00:07 gpio27 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio27
lrwxrwxrwx 1 root gpio    0 Feb 12 12:46 gpiochip0 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0
lrwxrwxrwx 1 root gpio    0 Feb 12 12:46 gpiochip100 -> ../../devices/gpiochip2/gpio/gpiochip100
lrwxrwxrwx 1 root gpio    0 Feb 12 12:46 gpiochip128 -> ../../devices/gpiochip1/gpio/gpiochip128
-rwxrwx--- 1 root gpio 4096 Feb 12 12:46 unexport

Maybe add a udevrule to adjust this permissions, additionally. And also for the folders where the links show to.
As the gpiochipxxx files created when configuring the pins i think. So could you try to set up a pin as output and then list the folder to see the permission for it when the pin is actually there?

So my setup looks as follows:

pi@raspberrypi:/sys/class/gpio $ ls -l
total 0
-rwxrwx--- 1 root gpio 4096 Feb 13 23:02 export
lrwxrwxrwx 1 root gpio    0 Feb 13 00:07 gpio27 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio27
lrwxrwxrwx 1 root gpio    0 Feb 12 12:46 gpiochip0 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0
lrwxrwxrwx 1 root gpio    0 Feb 12 12:46 gpiochip100 -> ../../devices/gpiochip2/gpio/gpiochip100
lrwxrwxrwx 1 root gpio    0 Feb 12 12:46 gpiochip128 -> ../../devices/gpiochip1/gpio/gpiochip128
-rwxrwx--- 1 root gpio 4096 Feb 12 12:46 unexport

pi@raspberrypi:/sys/class/gpio $ ls -l ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio27
total 0
-rwxrwx--- 1 root gpio 4096 Feb 13 00:07 active_low
lrwxrwxrwx 1 root gpio    0 Feb 13 00:07 device -> ../../../gpiochip0
-rwxrwx--- 1 root gpio 4096 Feb 13 23:02 direction
-rwxrwx--- 1 pi   pi   4096 Feb 13 23:02 edge
drwxrwx--- 2 root gpio    0 Feb 13 00:07 power
lrwxrwxrwx 1 root gpio    0 Feb 13 00:07 subsystem -> ../../../../../../../class/gpio
-rwxrwx--- 1 root gpio 4096 Feb 13 00:07 uevent
-rwxrwx--- 1 pi   pi   4096 Feb 13 00:07 value

pi@raspberrypi:/sys/class/gpio $ ls -l ../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0
total 0
-rwxrwx--- 1 root gpio 4096 Feb 12 12:46 base
lrwxrwxrwx 1 root gpio    0 Feb 12 12:46 device -> ../../../3f200000.gpio
-rwxrwx--- 1 root gpio 4096 Feb 12 12:46 label
-rwxrwx--- 1 root gpio 4096 Feb 12 12:46 ngpio
drwxrwx--- 2 root gpio    0 Feb 12 12:46 power
lrwxrwxrwx 1 root gpio    0 Feb 12 12:46 subsystem -> ../../../../../../class/gpio
-rwxrwx--- 1 root gpio 4096 Feb 12 12:46 uevent

pi@raspberrypi:/sys/class/gpio $ ls -l ../../devices/gpiochip2/gpio/
total 0
drwxrwx--- 3 root gpio 0 Feb 12 12:46 gpiochip100

pi@raspberrypi:/sys/class/gpio $ ls -l ../../devices/gpiochip2/gpio/gpiochip100
total 0
-rwxrwx--- 1 root gpio 4096 Feb 12 12:46 base
lrwxrwxrwx 1 root gpio    0 Feb 12 12:46 device -> ../../../gpiochip2
-rwxrwx--- 1 root gpio 4096 Feb 12 12:46 label
-rwxrwx--- 1 root gpio 4096 Feb 12 12:46 ngpio
drwxrwx--- 2 root gpio    0 Feb 12 12:46 power
lrwxrwxrwx 1 root gpio    0 Feb 12 12:46 subsystem -> ../../../../class/gpio
-rwxrwx--- 1 root gpio 4096 Feb 12 12:46 uevent

Please post how your files look like when a pin is configured.

And somehow your path is different to what @rlkoshak posted. You have an /soc@ does the normal folder not exist?

Is the user openhab added to the group gpio.

pi@raspberrypi:~ $ sudo -u openhab groups
openhab video gpio

Did you reboot ? This is sometimes neccessary. :smile:

@Josar - Thanks for trying to help. I tried the last days a lot to get the GPIOs working. In the end I gave up. I ordered a RPi3 and today I migrated my configuration.
Then in the second try the GPIO is working and finally I’m able to switch my powerplugs.
It definitely has something to do with this damn BananaPi. Now he’s retired and maybe used again in future as a proxy or something.

BTW - for my cheap plugs I’ve used this tutorial which is working fine with GPIO:

Again - thank you very much for your help!
Have a nice weekend.

@Josar Thanks for putting this tutorial together. I am using nearly 99% RF outlets and a rooted Wink Hub 1 that also uses exec binding, so this helps a lot. However, I followed what you had very closely and am getting the following error during the testing:

Cannot convert ‘5330371’ to a command type which item ‘Outlet_Power_Args’ accepts: [OnOffType, RefreshType].

Here are my files, simple for now as I am trying to figure this all out.

exec.things

Thing exec:command:outlet-power [ 
           command="/home/pi/python_scripts/automation/v2/codesend %2$s",
           interval=0,
           autorun=true]

rf_outlets.items

Switch rf_plug_LR_lamp <poweroutlet>

Switch Outlet_Power         { channel="exec:command:outlet-power:run"       }
Switch Outlet_Power_Args    { channel="exec:command:outlet-power:input"     }
Switch Outlet_Power_Out     { channel="exec:command:outlet-power:output"    }

rf_outlets.sitemap (Probably less important)

sitemap rf_outlets label="RF Outlets"
{
    Frame label="RF Outlets"
    {
        Switch item=rf_plug_LR_lamp label="Living Room Lamp"
    }
}

rf_outlets.rules

rule "Living Room Lamp"
    when
        Item rf_plug_LR_lamp received command
    then
        // wait for transmitter to be free
        // state will be NULL if not used before or ON while command is executed
        while(Outlet_Power.state == ON){
            Thread::sleep(500)
        }

        if(receivedCommand == ON){
            Outlet_Power_Args.sendCommand("5330371")
        } else {
            Outlet_Power_Args.sendCommand("5330380")
        }

        // wait for the command to complete
        while(Outlet_Power.state != OFF){
            Thread::sleep(500)
        }

        logInfo("RF Outlets","Result:" + Outlet_Power_Out.state)
end

Essentially, the same exact thing that you did, by my code isn’t in 3 parts, only 1 but don’t know why this would matter. Any ideas what is happening and what I can do to correct it? Thanks!

**EDIT: Totally figured out what I missed (guess I didn’t follow as closely as I thought).

Instead of

Switch Outlet_Power_Args    { channel="exec:command:outlet-power:input"     }
Switch Outlet_Power_Out     { channel="exec:command:outlet-power:output"    }

in my items file, it should be:

String Outlet_Power_Args    { channel="exec:command:outlet-power:input"     }
String Outlet_Power_Out     { channel="exec:command:outlet-power:output"    }

The command isn’t actually executing like I would expect, but the error is gone now. On to figure out why it isn’t executing.

Switch vs String, Input and output only supports strings at the moment.

Can you execute the command as user openhab in the command line as described above?

So I actually can. I have been getting misdirected (perhaps) on chasing down adding openhab to sudoers with no password, but I don’t think that is the problem here.

The script is actually located here:

/home/pi/python_scripts/automation/v2/codesend

When logged in as pi, and in /home/pi, I can run

sudo -u openhab /home/pi/python_scripts/automation/v2/codesend 5330380  (or the ON variant code)

And it works perfectly.

Not sure what it says, but I can also run the same exact command from

/etc/openhab2

And it works as well.

In my log, all I am getting is the following:

23:23:45.792 [INFO ] [smarthome.event.ItemStateChangedEvent] - Outlet_Power_Args changed from NULL to 5330371
23:23:47.888 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘rf_plug_LR_lamp’ received command OFF
23:23:47.900 [INFO ] [smarthome.event.ItemStateChangedEvent] - rf_plug_LR_lamp changed from ON to OFF
23:23:47.907 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘Outlet_Power_Args’ received command 5330380
23:23:47.909 [INFO ] [smarthome.event.ItemStateChangedEvent] - Outlet_Power_Args changed from 5330371 to 5330380
23:23:49.524 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘rf_plug_LR_lamp’ received command ON
23:23:49.527 [INFO ] [smarthome.event.ItemStateChangedEvent] - rf_plug_LR_lamp changed from OFF to ON
23:23:49.533 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘Outlet_Power_Args’ received command 5330371
23:23:49.538 [INFO ] [smarthome.event.ItemStateChangedEvent] - Outlet_Power_Args changed from 5330380 to 5330371

So this part looks like it is working, but the one thing I don’t really know - Is it really sending that command? And, if so, is it getting rejected for some reason. In a way, since it works when I run it as sudo -u openhab from multiple locations, it should be working from here, right?

Is there a way I can tell if this command is actually getting sent? All the log really tells me is that it is getting the OFF or ON command and the ARGS are getting changed.

please use the code fences also for logs not the blockqoutes. There are buttons for that at the right top of the textfield. This makes this a lot easier to read.

```
your log goes here
```

If this works, all is good, but your binding, thing, item or sitemap has errors.
As the path starts with / it should work from everywhere as this is an absolute path.

sudo -u openhab /home/pi/python_scripts/automation/v2/codesend 5330380

I copy pasted your stuff and changed my path, and command. And to answer your question: you know it worked when something happened e.g the led goes off :wink: .

And the log should show the result of the executed command.

[INFO ] [pse.smarthome.model.script.RF Outlets] - Result:sending code[5330380]
[INFO ] [smarthome.event.ItemStateChangedEvent] - Outlet_Power_Args changed from 5330380 to 11607809
[INFO ] [smarthome.event.ItemStateChangedEvent] - Outlet_Power changed from OFF to ON
[INFO ] [smarthome.event.ItemStateChangedEvent] - Outlet_Power changed from ON to OFF
[INFO ] [smarthome.event.ItemStateChangedEvent] - Outlet_Power_Out changed from sending code[5330380] to sending code[11607809]

Everything works in my setup. But your log is missing the execution.
Uninstalling the exc binding results in the same output as yours.

[INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'rf_plug_LR_lamp' received command ON
[INFO ] [pse.smarthome.model.script.RF Outlets] - Result:sending code[11607812] // this is the old state so missing in your log.
[INFO ] [smarthome.event.ItemStateChangedEvent] - rf_plug_LR_lamp changed from OFF to ON
[INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Outlet_Power_Args' received command 11607809
[INFO ] [smarthome.event.ItemStateChangedEvent] - Outlet_Power_Args changed from 11607812 to 11607809

Install the exec binding and you should be good to go.

Edit: :bulb:

If it is something as simple as that, I will be happy, but also that would be incredibly ironic! I was thinking last night as I was going to bed that maybe I am looking I’m the wrong place. That maybe it had to do with the binding itself. I am not in front of my setup and won’t be till later, but I was wondering if it had something to do with the fact that I have exec1 installed as well. Wait, now that I said that I think I know exactly what is wrong! (Insert lightbulb here) I’m not going to say until I check it, but will report back for posterity. Thanks again!