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

@domeninini I added some more information to the tutorial maybe you schould read it carefully. :face_with_raised_eyebrow: :wink:
I used Switch Power_Plug_Socket_A <poweroutlet> instead of Switch Power_Plug_Socket_B_x <poweroutlet> which better represents the remote.
I also showed executing multiple devices with one dedicated switch AB.
If i find some more time i will post a setting which reduces the code by using groups, or someone working throught this could do that. :smirk:

Hy. I hope I find help here. I’ve been trying to use a 433 mhz module for a long time with openhab.
I can use it in the shell with the following command: /home/openhabian/433Utils/RPi_utils/./codesend 13108705.

And now I try desperately to integrate this command with exec binding (version 2). I hope who can help, I try to send the command as a push button.
Where is my mistake? Post my composition. Thank you

.things

//Wohnzimmer_Decke
Thing exec:command:Wohnzimmer_Decke [ command="/home/openhabian/433Utils/RPi_utils/Wohnzimmer_decke.sh %2$s, interval=0, autorun=true ]

.sh

#!/bin/sh


if [ "$1" = "off" ] || [ "$1" = "0" ] || [ "$1" = "OFF"  ]; then
        /home/openhabian/433Utils/RPi_utils/./codesend 13108705
else
        /home/openhabian/433Utils/RPi_utils/./codesend 13108705
fi

rule

rule "Poweroutlet B"
  when
    Item Wohnzimmer_Decke received command
  then
     if(receivedCommand == ON){
        Remote_Send_Args.sendCommand("13108705")
     }else{
       Remote_Send_Args.sendCommand("10010 2 0")
     }

      // wait for the command to complete, state will be NULL if not used befor$
      while(Remote_Send.state != OFF){
         Thread::sleep(500)
      }
      logInfo("Power_Plug", "Resuts are: \n" + Remote_Send_Out.state )
end

.items

Group Licht_EG "Licht" 

Switch Wohnzimmer_Decke (Licht_EG) [ "Switchable" ] { channel="exec:command:Wohnzimmer_Decke:run", autoupdate="false" }

.sitemap

sitemap Schneeberggasse16 label="Erdgeschoss" {
    Frame label="Licht" {
        Switch item=Wohnzimmer_Decke mappings=[ "ON"="ON" ] icon="light"
        Switch item=Wohnzimmer_Led mappings=[ "ON"="ON", "OFF"="OFF" ]
        Switch item=steckdoseG3Switch mappings=[ "ON"="ON", "OFF"="OFF" ]
        Switch item=steckdoseG4Switch mappings=[ "ON"="ON", "OFF"="OFF" ]
        
        Switch item=Licht mappings=[ "ON"="ON", "OFF"="OFF" ]
        
        Switch item=Dash_Switch
        }
}

Could you please format your post like you did here

Did you try to execute the command as user openhabian as explained?
This is a crucial step to make sure openhab is able to execute the command! Make sure to take the right user openhab for self installed, openhabian for openhabian.

Make sure to add openhab/openhabian to the group which is necessary to execute your commands. Most probably gpio. I don’t know what kind off 433MHz transciever you use.

Second you don’t need the shell Skript. Put your call to codesend in the thing as explained above in the tutorial. Have a closer look there.

Please post the output of

  1. Executions as user openhabian from commandline.
  2. After adding openhabian to the right group and successful executing 1. the output of the log from the rule.

Thank you . I will try this tomorow

Hy.
Have everything rebuilt now, it still not works. Where can my mistake lie.

wohzimmer.items

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" }

funklicht.sitemap

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

funklicht.things

Thing exec:command:remote-send [ command="/home/openhabian/433Utils/RPi_utils/./codesend %2$s", interval=0, autorun=true ]

wohnzimmer.rules

rule "Wohnzimmer"
  when
    Item Wohnzimmer received command
  then
     if(receivedCommand == ON){
        Wohnzimmer.sendCommand("13108705")
     }else{
       Remote_Send_Args.sendCommand("13108705")
     }

      // wait for the command to complete, state will be NULL if not used before or ON while command is executed
      while(Remote_Send.state != OFF){
         Thread::sleep(500)
      }
      logInfo("Wohnzimmer", "Resuts are: \n" + Remote_Send_Out.state )
end

etc/sudoers file edited with visudo , I hope the entries are correct.

#
# 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
openhab ALL=(ALL) NOPASSWD: ALL
www-data ALL=(ALL) NOPASSWD: ALL
openhabian ALL=(ALL) NOPASSWD: ALL
openhabian /home/openhabian/433Utils/RPi_utils/./codesend 13108705

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

#includedir /etc/sudoers.d

and the log file

17:44:14.478 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'wohnzimmer.items'
17:44:14.523 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'wohnzimmer.items' has errors, therefore ignoring it: [6,25]: missing '}' at 'Decke'
[6,30]: extraneous input '"  (Licht_EG) [ "' expecting RULE_ID
[6,76]: extraneous input ':' expecting RULE_ID

17:44:20.880 [WARN ] [basic.internal.render.SwitchRenderer] - Cannot determine item type of 'Wohnzimmer'
org.eclipse.smarthome.core.items.ItemNotFoundException: Item 'Wohnzimmer' could not be found in the item registry
        at org.eclipse.smarthome.core.internal.items.ItemRegistryImpl.getItem(ItemRegistryImpl.java:60)[98:org.eclipse.smarthome.core:0.9.0.b5]
        at org.eclipse.smarthome.ui.internal.items.ItemUIRegistryImpl.getItem(ItemUIRegistryImpl.java:658)[136:org.eclipse.smarthome.ui:0.9.0.b5]
        at org.eclipse.smarthome.ui.basic.internal.render.SwitchRenderer.renderWidget(SwitchRenderer.java:50)[176:org.eclipse.smarthome.ui.basic:0.9.0.b5]
        at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.renderWidget(PageRenderer.java:164)[176:org.eclipse.smarthome.ui.basic:0.9.0.b5]
        at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processChildren(PageRenderer.java:129)[176:org.eclipse.smarthome.ui.basic:0.9.0.b5]
        at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processChildren(PageRenderer.java:150)[176:org.eclipse.smarthome.ui.basic:0.9.0.b5]
        at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processPage(PageRenderer.java:92)[176:org.eclipse.smarthome.ui.basic:0.9.0.b5]
        at org.eclipse.smarthome.ui.basic.internal.servlet.WebAppServlet.service(WebAppServlet.java:152)[176:org.eclipse.smarthome.ui.basic:0.9.0.b5]
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
        at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)[172:org.ops4j.pax.web.pax-web-jetty:4.3.0]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)[80:org.eclipse.jetty.server:9.2.19.v20160908]
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)[79:org.eclipse.jetty.security:9.2.19.v20160908]
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)[80:org.eclipse.jetty.server:9.2.19.v20160908]
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)[80:org.eclipse.jetty.server:9.2.19.v20160908]
        at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:287)[172:org.ops4j.pax.web.pax-web-jetty:4.3.0]
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)[80:org.eclipse.jetty.server:9.2.19.v20160908]
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)[80:org.eclipse.jetty.server:9.2.19.v20160908]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)[80:org.eclipse.jetty.server:9.2.19.v20160908]
        at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)[172:org.ops4j.pax.web.pax-web-jetty:4.3.0]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[80:org.eclipse.jetty.server:9.2.19.v20160908]
        at org.eclipse.jetty.server.Server.handle(Server.java:499)[80:org.eclipse.jetty.server:9.2.19.v20160908]
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)[80:org.eclipse.jetty.server:9.2.19.v20160908]
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)[80:org.eclipse.jetty.server:9.2.19.v20160908]
        at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)[71:org.eclipse.jetty.io:9.2.19.v20160908]
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[83:org.eclipse.jetty.util:9.2.19.v20160908]
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[83:org.eclipse.jetty.util:9.2.19.v20160908]
        at java.lang.Thread.run(Thread.java:748)[:1.8.0_152]
17:44:20.890 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Wohnzimmer' for widget org.eclipse.smarthome.model.sitemap.Switch
17:44:20.894 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch
17:44:20.899 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch
17:44:20.903 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch
17:44:20.907 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Wohnzimmer' for widget org.eclipse.smarthome.model.sitemap.Switch
17:44:20.911 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Wohnzimmer' for widget org.eclipse.smarthome.model.sitemap.Switch
17:44:20.915 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Wohnzimmer' for widget org.eclipse.smarthome.model.sitemap.Switch
17:44:23.028 [INFO ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at 'items/Wohnzimmer' for the unknown item 'Wohnzimmer'.
17:44:23.896 [INFO ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at 'items/Wohnzimmer' for the unknown item 'Wohnzimmer'.
17:49:14.246 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'funklicht.things'
17:49:14.266 [INFO ] [smarthome.event.ThingRemovedEvent   ] - Thing 'exec:command:Wohnzimmer_Decke' has been removed.
17:49:14.274 [INFO ] [smarthome.event.ThingRemovedEvent   ] - Thing 'exec:command:Wohnzimmer_Led' has been removed.
17:49:14.285 [INFO ] [smarthome.event.ThingRemovedEvent   ] - Thing 'exec:command:Wohnzimmer_Deckecontrol' has been removed.
17:49:14.292 [INFO ] [smarthome.event.ThingRemovedEvent   ] - Thing 'exec:command:steckdoseG3-status' has been removed.
17:49:14.303 [INFO ] [smarthome.event.ThingRemovedEvent   ] - Thing 'exec:command:Wohnzimmer_Deckestatus' has been removed.
17:49:14.345 [INFO ] [smarthome.event.ThingUpdatedEvent   ] - Thing 'exec:command:remote-send' has been updated.
17:53:53.341 [INFO ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at 'items/Wohnzimmer' for the unknown item 'Wohnzimmer'.
17:53:54.881 [INFO ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at 'items/Wohnzimmer' for the unknown item 'Wohnzimmer'.
17:54:21.591 [INFO ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at 'items/Wohnzimmer' for the unknown item 'Wohnzimmer'.
17:54:21.993 [INFO ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at 'items/Wohnzimmer' for the unknown item 'Wohnzimmer'.
17:54:22.392 [INFO ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at 'items/Wohnzimmer' for the unknown item 'Wohnzimmer'.
17:54:22.765 [INFO ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at 'items/Wohnzimmer' for the unknown item 'Wohnzimmer'.
17:54:23.365 [INFO ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at 'items/Wohnzimmer' for the unknown item 'Wohnzimmer'.

i hope you can help me.Thank you

Can you execute the command from commandline as user openhabian?

Why do you fiddle with sudoers?
Did you add openhabian to the gpio group?

What do you try to achieve here? Wohnzimmer ist a switch which can be on or off. Not a string.

Please try to follow the instructions step by step.

  1. Execute the command as user openhabian and post the result.
    Maybe the returned information will help getting the command to execute, mostly by adding the user to the group. Soduer rights are mostly not required.

Please remove all other stuff, as there are errors listet in the log which obviously contains data which is not listet here, which has errors.

And please use the preview to make sure the formating is properly, also or even more when copy pasting.

Sometimes/often it helps to restart the rpi when the files are changed a lot.

If it is really necessary to get sudoers for openHAB it is explained here

Hi Josar,

thank you very much for this tutorial. Everything works now and I´m very happy!

As I started with the “automatic” Installation by openhabian, I had a few things, that confused me. Perhaps someone else helps this out.

I was confused, in which Directory I should install the raspberry-remote, so I installed it in “/home/openhabian/” - which I guessed right - as I learned later :slight_smile:

As I had installed the raspberry-remote i got a error:

RCSwitch.h:31:26: fatal error: wiringPi.h: No such file or directory
     #include <wiringPi.h>
                          ^
compilation terminated.
<builtin>: recipe for target 'RCSwitch.o' failed
make: *** [RCSwitch.o] Error 1

so i figured out, that i have to install wiringPi first.

I upgraded my Raspberry with

sudo apt-get update && sudo apt-get upgrade

and Installed wiringPi in my “raspberry-remote” directory with

git clone git://git.drogon.net/wiringPi
cd wiringPi/
./build

After finishing this, i switched back in my raspberry-remote directory and now i could use

make send

The last Thing, I had to change, was in the exec.things-File. I had to change the Directory to this:

Thing exec:command:remote-send [
        command="/home/openhabian/SourceCode/raspberry-remote/send %2$s",
        interval=0,
        autorun=true]

Thank you again for your hard work and this Tutorial! Now as Christmas is over, i´ll have to find some other Things, that i will switch on and off in the meantime :stuck_out_tongue_winking_eye:

Alex

@Lucky i think this should also work for installing wiringpi:

sudo apt-get install wiringpi 

But thank you for the hint for all who are using openhabian.

openhab / openhabian have always been users of gpio

[23:34:08] openhabian@openHABianPi:~$ sudo adduser openhabian gpio
[sudo] password for openhabian:
The user `openhabian' is already a member of `gpio'.
[23:44:00] openhabian@openHABianPi:~$ sudo adduser openhab gpio
The user `openhab' is already a member of `gpio'.
[23:44:14] openhabian@openHABianPi:~$  sudo -u openhabian /home/openhabian/433Utils/RPi_utils/./codesend 13108705
sending code[13108705]
[23:44:46] openhabian@openHABianPi:~$  sudo -u openhabian /home/openhabian/433Utils/RPi_utils/./codesend 13108705
sending code[13108705]
[23:46:21] openhabian@openHABianPi:~$

I just want to send the radio command (13108705 decimalcode) as a push button. I control radio modules that I integrate into my light circuit (surge circuit). as easy as it is possible I do not want to prove if it is on or off. if I press in openhab on the switch it should send once the radio command.

sudo -u openhabian /home/openhabian/433Utils/RPi_utils/./codesend 13108705

works without problems the wireless module, but in the log, nothing appears.

get the following errors when pressing the switch.

23:57:39.418 [INFO ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at 'items/Wohnzimmer' for the unknown item 'Wohnzimmer'.
  1. GPIO , check.
  2. Commandline execution, check.
    There will be nothing logged, because it is not executed in openHAB, it is executed with the user rights of OpenHAB. And as this works we know there is something wrong with your thing, item, sitemap or rule.

Please edit your rule

rule "Wohnzimmer"
  when
    Item Wohnzimmer received command ON
  then

 // Check if an other rule uses the transmitter
      while(Remote_Send.state == ON){
         Thread::sleep(500)
      }
      Remote_Send_Args.sendCommand("13108705")

      // wait for the command to complete
      while(Remote_Send.state != OFF){
         Thread::sleep(500)
      }
      logInfo("Wohnzimmer", "Resuts: " + Remote_Send_Out.state )

    // After command is done
    // Set button back so you can reuse it
   Wohnzimmer.postUpdate(OFF)

// Reset argument, as it will not trigger execution next time the rule executed if the argument is the same.
Remote_Send_Args.postUpdate(" ")

end

What happens? What is logged?

Your rule works, the command will be sent, but only the first time. I took a video on how the switch reacts the first time and then no longer. the first time the light bulb lights up and then it is off.when i restart the raspi it works again the first time

Videolink: https://youtu.be/-vRwYClcUKg

What else can you change about the rule? you’re great thanks for everything so far.

log:

13:52:47.794 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard                                                                                                                      at https://192.168.8.111:8443
13:52:48.352 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI a                                                                                                                     t /basicui/app
13:52:48.432 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI a                                                                                                                     t /paperui
13:52:48.516 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel a                                                                                                                     t /habpanel
13:52:48.702 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin ser                                                                                                                     vlet at /habmin
13:54:35.708 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Wohnzimmer'                                                                                                                      received command ON
13:54:35.773 [INFO ] [marthome.event.ItemStateChangedEvent] - Wohnzimmer changed                                                                                                                      from NULL to ON
13:54:36.102 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Remote_Send_                                                                                                                     Args' received command 13108705
13:54:36.112 [INFO ] [marthome.event.ItemStateChangedEvent] - Remote_Send_Args c                                                                                                                     hanged from NULL to 13108705
13:54:36.119 [INFO ] [marthome.event.ItemStateChangedEvent] - Remote_Send change                                                                                                                     d from NULL to ON
13:54:36.639 [INFO ] [marthome.event.ItemStateChangedEvent] - Remote_Send change                                                                                                                     d from ON to OFF
13:54:36.653 [INFO ] [marthome.event.ItemStateChangedEvent] - Remote_Send_Out ch                                                                                                                     anged from NULL to sending code[13108705]
13:54:37.167 [INFO ] [se.smarthome.model.script.Wohnzimmer] - Resuts: sending co                                                                                                                     de[13108705]
13:54:37.188 [INFO ] [marthome.event.ItemStateChangedEvent] - Wohnzimmer changed                                                                                                                      from ON to OFF
13:54:38.311 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Wohnzimmer'                                                                                                                      received command ON
13:54:38.322 [INFO ] [marthome.event.ItemStateChangedEvent] - Wohnzimmer changed                                                                                                                      from OFF to ON
13:54:38.323 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Remote_Send_                                                                                                                     Args' received command 13108705
13:54:38.326 [INFO ] [se.smarthome.model.script.Wohnzimmer] - Resuts: sending co                                                                                                                     de[13108705]
13:54:38.334 [INFO ] [marthome.event.ItemStateChangedEvent] - Wohnzimmer changed                                                                                                                      from ON to OFF
13:54:39.270 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Wohnzimmer'                                                                                                                      received command ON
13:54:39.282 [INFO ] [marthome.event.ItemStateChangedEvent] - Wohnzimmer changed                                                                                                                      from OFF to ON
13:54:39.293 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Remote_Send_                                                                                                                     Args' received command 13108705
13:54:39.299 [INFO ] [se.smarthome.model.script.Wohnzimmer] - Resuts: sending co                                                                                                                     de[13108705]
13:54:39.314 [INFO ] [marthome.event.ItemStateChangedEvent] - Wohnzimmer changed                                                                                                                      from ON to OFF
13:54:40.296 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Wohnzimmer'                                                                                                                      received command ON
13:54:40.317 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Remote_Send_                                                                                                                     Args' received command 13108705
13:54:40.322 [INFO ] [marthome.event.ItemStateChangedEvent] - Wohnzimmer changed                                                                                                                      from OFF to ON
13:54:40.327 [INFO ] [se.smarthome.model.script.Wohnzimmer] - Resuts: sending co                                                                                                                     de[13108705]
13:54:40.340 [INFO ] [marthome.event.ItemStateChangedEvent] - Wohnzimmer changed                                                                                                                      from ON to OFF
13:54:41.590 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Wohnzimmer'                                                                                                                      received command ON
13:54:41.600 [INFO ] [marthome.event.ItemStateChangedEvent] - Wohnzimmer changed                                                                                                                      from OFF to ON
13:54:41.606 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Remote_Send_                                                                                                                     Args' received command 13108705
13:54:41.616 [INFO ] [se.smarthome.model.script.Wohnzimmer] - Resuts: sending co                                                                                                                     de[13108705]
13:54:41.628 [INFO ] [marthome.event.ItemStateChangedEvent] - Wohnzimmer changed                                                                                                                      from ON to OFF

@antihero00 I added something to my previous post.

I use postUpdate, this does not trigger the rule.
But I did not test it.

But the problem is if the argument stays the same the command will not be triggered.

If the thing is used by multiple rules it es advised to first check if item is active.

Video is not available.

I’ve done a video update! I have replaced the rule with the new one, but it does not change, send command only at the first time i push the button (look at the video).
The things are only used by this one rule, so far I have only this one configuration.
Thank you

log file:
    17:46:01.207 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'wohnzimmer.items'
    17:46:08.572 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'wohnzimmer.rules'
    17:46:09.962 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'funklicht.sitemap'
    17:46:10.014 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'Remote_Send_Out-exec:command:remote-send:output' has been added.
    17:46:10.019 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'Remote_Send_Args-exec:command:remote-send:input' has been added.
    17:46:10.021 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'Remote_Send-exec:command:remote-send:run' has been added.
    17:46:10.367 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'funklicht.things'
    17:46:10.473 [INFO ] [smarthome.event.ThingAddedEvent     ] - Thing 'exec:command:remote-send' has been added.
    17:46:10.499 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'exec:command:remote-send' changed from UNINITIALIZED to INITIALIZING
    17:46:10.506 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'exec:command:remote-send' changed from INITIALIZING to ONLINE
    17:46:13.155 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 192.168.8.109
    17:46:13.158 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at http://192.168.8.111:8080
    17:46:13.163 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 192.168.8.109
    17:46:13.165 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at https://192.168.8.111:8443
    17:46:13.797 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
    17:46:13.989 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
    17:46:14.080 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
    17:46:14.239 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
    17:46:47.240 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Wohnzimmer' received command ON
    17:46:47.297 [INFO ] [marthome.event.ItemStateChangedEvent] - Wohnzimmer changed from NULL to ON
    17:46:47.680 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Remote_Send_Args' received command 13108705
    17:46:47.689 [INFO ] [marthome.event.ItemStateChangedEvent] - Remote_Send_Args changed from NULL to 13108705
    17:46:47.694 [INFO ] [marthome.event.ItemStateChangedEvent] - Remote_Send changed from NULL to ON
    17:46:48.201 [INFO ] [marthome.event.ItemStateChangedEvent] - Remote_Send changed from ON to OFF
    17:46:48.209 [INFO ] [marthome.event.ItemStateChangedEvent] - Remote_Send_Out changed from NULL to sending code[13108705]
    17:46:48.702 [INFO ] [se.smarthome.model.script.Wohnzimmer] - Resuts: sending code[13108705]
    17:46:48.721 [INFO ] [marthome.event.ItemStateChangedEvent] - Wohnzimmer changed from ON to OFF
    17:46:48.733 [INFO ] [marthome.event.ItemStateChangedEvent] - Remote_Send_Args changed from 13108705 to
    17:46:55.277 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Wohnzimmer' received command ON
    17:46:55.287 [INFO ] [marthome.event.ItemStateChangedEvent] - Wohnzimmer changed from OFF to ON
    17:46:55.300 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Remote_Send_Args' received command 13108705
    17:46:55.308 [INFO ] [marthome.event.ItemStateChangedEvent] - Remote_Send_Args changed from   to 13108705
    17:46:55.312 [INFO ] [se.smarthome.model.script.Wohnzimmer] - Resuts: sending code[13108705]
    17:46:55.333 [INFO ] [marthome.event.ItemStateChangedEvent] - Wohnzimmer changed from ON to OFF
    17:46:55.339 [INFO ] [marthome.event.ItemStateChangedEvent] - Remote_Send_Args changed from 13108705 to

@antihero00 I had some time to test it. This is the best solution i could find so far.

set the thing autorun to false.

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

in the rule manually trigger the execution.

rule "Wohnzimmer"
  when
    Item Wohnzimmer received command ON
  then

     // Check if an other rule uses the transmitter
     while(Remote_Send.state == ON){
        Thread::sleep(500)
     }
     Remote_Send_Args.sendCommand("13108705")
     // triger sending manually
     Remote_Send.sendCommand(ON);

     // wait for the command to complete
     while(Remote_Send.state != OFF){
        Thread::sleep(500)
     }
     logInfo("Wohnzimmer", "Resuts: " + Remote_Send_Out.state )

     // After command is done
     // Set button back so you can reuse it
     Wohnzimmer.postUpdate(OFF)
end

This works for me and executes the command everytime.

Some sidenotes.
If the reseting is done with sendCommand instead of postUpdate it will also work, but it will trigger an execution which is not a good idea.

Josar you are my hero, it works fine. Thank you .

Hi Josar,
great tutorial. Tried it on a Raspberry Pi 3 with OpenHAB2. Followed exactly your steps. But I get the “An exception occurred while formatting the command line with the current time and input values : 'Format specifier ‘%2$s’” but as I’m quite new to OpenHAB, I don’t know how to handle your explanation to this error. Can you give me some newbe step-by-step advice?

Many thanks and best regards
Muhackl

@muhackl666 i think you have to install the

And the string in your input channel has to be properly set. Please post your settings only the error is not enougth to find out the reason.

@muhackl666

Did you do something like

Remote_Send.sendCommand("YOUR STRING")

instead of

Remote_Send_Args.sendCommand("YOUR STRING")

I 99% copy and pasted exactly what you postet in your tutorial. The 1% difference is the code I send to receiver. It’s 11111 1 1 and of cource 11111 1 0.
So there is Remote_Send_Args.sendCommand(“11111 1 1”) for example.

I manually installed regex transformation via openhab console and feature:install openhab-transformation-regex.
What else could it be?

@muhackl666 try to install the exec binding and the regex transformation from paper ui, again.

I encountered a problem with karaf and paper ui Installation.

Please clear the log then restart and post your full log.