Exec-binding 2.0

execbinding
executecommandline
binding
Tags: #<Tag:0x00007f1e6e2263c8> #<Tag:0x00007f1e6e225f18> #<Tag:0x00007f1e6e225180>
(Yann) #1

Hi,
I have a problem since the update of exec-binding.
With exec-binding 1.9 and openhab build 524 i could see executed commandLine … in log:tail when i switched on the button.
Now with exec-binding 2.0 and openhab build 624 with the same conf i don t see anything and my item has no action on the reality.
I guess that the module have a problem but in bundle:list i can see it. (193 | Active | 80 | 2.0.0.201611291735 | Exec Binding).
I m on MACOSX yosemith.
Have you got a solution ?

edit : With exec-binding 2.0, executeCommandLine is undefinned with Eclipse SmartHomeDesigner…

Regards,
YannF

0 Likes

(Rich Koshak) #3

Please post your Thing and Item definition

0 Likes

(Daniel Walters) #4

You can’t use the exec 2.0 binding exactly as you used the exec 1.9 binding. You need to read the documentation and adjust your config accordingly.

As far as I’m aware executeCommandLine isn’t part of the 2.0 binding.

0 Likes

(Yann) #5

For Rich:

blocks.items :
Switch test “Test” {exec=">[ON:bash /Users/name/Documents/openhab/conf/scripts/switchGudeStatus.sh t282-gude02 1 on] >[OFF:bash /Users/name/Documents/openhab/conf/scripts/switchGudeStatus.sh t282-gude02 1 off]"}

This line works with exec binding 1.9 and openhab build 524
No file *.things
Openhab log show that exec command is captured
08:16:35.849 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘GUDESLOT1’ received command OFF
08:16:35.850 [INFO ] [marthome.event.ItemStateChangedEvent] - GUDESLOT1 changed from ON to OFF
08:16:35.852 [INFO ] [ab.binding.exec.internal.ExecBinding] - executed commandLine ‘bash /Users/name/Documents/openhab/conf/scripts/switchGudeStatus.sh t282-gude02 1 off’

In exec binding 2.0 build 624 Openhab log just show button switch on or off,
08:12:54.662 [INFO ] [marthome.event.ItemStateChangedEvent] - test changed from ON to OFF
08:12:55.124 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘test’ received command ON
08:12:55.126 [INFO ] [marthome.event.ItemStateChangedEvent] - test changed from OFF to ON
08:12:55.696 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘test’ received command OFF

For Daniel :
Ok i will try to change my setting with a things declaration

Thanks

0 Likes

(Yann) #6

Ok i understand the new system. But i have a problem :

Thing exec:command:gude [command=“bash /Users/name/Documents/openhab/conf/scripts/switchGudeStatus.sh t282-gude02 1 on”]

Switch gude { channel=“exec:command:gude:run”}

Question :

Have you got example with a switch system ? I don’t understand how can i do as exec binding 1.9. I want to run my script with parameter on switch on, and other parameter on switch off.

Thank you

0 Likes

Question about exec switch item with two commands
(David K.) #7

Hi Yann,

you can also add an argument to a command. Try this:

Thing exec:command:gude [command="bash /Users/name/Documents/openhab/conf/scripts/switchGudeStatus.sh t282-gude02 1 %2$s", autorun=false]

%2$s will be replaced by your string

Item String gude { channel="exec:command:gude:input"}
Sitemap Switch item=gude label="Gude" mappings=[on="ON", off="OFF"]

Cheers

0 Likes

(Yann) #8

Thank you, It’s working but with a big delay.
When I click on the on or off button, there is 10-30 seconds of waiting time before action. With rules and exec command it’s immediately. Do you know why ?

Cheers

Edit : OK I have changed autorun false => true and it works.

But I don’t like the result, there is no update to the status (red or green), It’s not what i need.
In fact, I would like a switch which call a rule with 3 parameters (2 custom parameters and 1 which is the status of the switch : on or off).

Like this :

var status_on = " on"
var status_off = " off"
var gude001 =  " t282-gude02"
var port1 = " 1"

rule "gude001"
	when
		Item t282gude02slot1 received command
	then
		if(receivedCommand == OFF) executeCommandLine("bash /Users/name/Documents/openhab/conf/scripts/switchGudeStatus.sh"+gude001+port1+status_off) 
	
		if(receivedCommand == ON) executeCommandLine("bash /Users/name/Documents/openhab/conf/scripts/switchGudeStatus.sh"+gude001+port1+status_on) 
end

Now i would like to do something like that :
*.items
Switch t282gude02slot1 {gude001=" t282-gude02"} , but i don’ know the syntax

Thanks

0 Likes

(Gad Ofir) #9

Hi please help not working for me what am i doing wrong?
things.
Thing exec:command:micropcofft [command=“net rpc shutdown -I 10.0.0.10 -U gadof01%%123 -f”, interval=0, autorun=false]

items.
Switch mpcoff “MicroPc off” { channel=“exec:command:micropcofft:run” }

map.
Switch item=mpcoff

0 Likes

(Rich Koshak) #10
0 Likes