Hi i have a short question, i want to control my 433mhz sockets, it works in pimatic with shell execute , but didnt get it to work on the openhab 2.2 exec binding, already read all threads about EXEC Binding.
Switch on
pilight-send -p pollin -s 5 -u 4 -t
Switch of
pilight-send -p pollin -s 5 -u 4 -f
I created 2 seperate items but nothing seems to work.
From Shell the Pi User execute the Command and from Binding the Openhab User execute the Command ⊠I think the Openhab User has not the right to execute âŠ
Try if
sudo pilight-send -p pollin -s 5 -u 4 -t
on shell works âŠ
then you can authenticate the Openhab User to do sudo commands
Thanks for the idea.
yes the command works in the bash with and without sudo
i tried with bash
sudo -u openhab /usr/local/bin/pilight-send -p pollin -s 9 -u 8 -t
works also.
How can i create a custom thing with with 2 items which are the states on and off.
if i create the exe binding with that commandline , it creates a thing with strange items / chanels. Output, Input, Exit Value, Running , Last Execution, no idea if that is the right way.
if your Pi is heavily guarded and youâre 100% sure, you could give the openHAB user sudo privileges. But thatâs highly not recommended!
So, if pilight-send works without sudo, then you should leave it at this.
Whatâs your code then? You can either use a rule or a thing or an item.
Thanks for the hint, i read it but i didnt understand it, is it realy that complicate to create a switch ? I realy need a rule to get that switch to work ?
My idea was⊠create a thing called Powerswitch-Shelf , and in that i create 2 items for ON and OFF, or iam thinking wrong ?
perhaps you have to make sure, that pilight-send can be started without directory, or you just add it (assuming youâre using openHABian and pilight-send is compiled in ~):
Thx binderth, we are getting closer, yes realy makes no sense to have to items for hat switch.
Mhh didnt worked , testet it with the full path to pilight send.
works like a charm in bash
/usr/local/bin/pilight-send -p pollin -s 9 -u 8 -t
/usr/local/bin/pilight-send -p pollin -s 9 -u 8 -f
Is there a log for checking - checked /opt/openhab2/userdata/logs , but nothing to find regarding the command execution.
I cant use that item in the Paper UI but shows up in HUBPanel , is there a thing needed to show up, what should i wrote in that things file to get it combind to my item ?
first of all: you donât need anything for a item. Itâs just there. especially handy if you need a âproxy itemâ, which just stands there as a variable - but doesnât have an effect on anything. These items donât have a binding definition in braces.
If you want to use a item with a binding you have to tell in the item definition the binding configuration in braces.
so. Some bindings need Things for items (most 2.x bindings need one). The exec-binding doesnât need one<= CAREFUL: This is false - see below for more info.
So, next step is looking into the logs, if youâre using openHABian, theyâre here:
/var/log/openhab2/events.log // basically, everything on the eventbus is in here
/var/log/openhab2/openhab.log // here goes all INFO, WARNings, ERRORs, âŠ
look in openhab.log and youâll find something, why it didnât work.
Shows only:
2:55:57.060 [INFO ] [smarthome.event.ItemCommandEvent ] - Item âMyPilightSwitchâ received command ON
22:55:57.073 [INFO ] [smarthome.event.ItemStateChangedEvent] - MyPilightSwitch changed from OFF to ON
So no error, but still dont turn on and off , thats confusing.
in my default.items stands only:
Switch MyPilightSwitch âPilight Schalterâ {exec=">[OFF:/usr/local/bin/pilight-send -p pollin -s 9 -u 8 -f] >[ON:/usr/local/bin/pilight-send -p pollin -s 9 -u 8 -t]"}
Switch MyPilightSwitch2 âPilight Schalter2â {exec=">[OFF:pilight-send -p pollin -s 9 -u 8 -f] >[ON:pilight-send -p pollin -s 9 -u 8 -t]"}
hmm. ok, this tells you, that the openHAB-item was changed and there was no ERROR while trying to execute. Then thereâs something within your system configuration
Thereâs a pretty cool thread from Rich, please go there first:
if youâre still stuck, of course you can come back here anytime!
@bestgrafix@binderth I think this is the openhab 1 thing definition. So to used this kind of configuration install the legacy binding.
If you use Openhab 2 and the EXEC Binding 2 please follow the example.
When it works you can try to optimize, but i am not aware that it works as you like it to work.
Changes with the next version off the exec binding will reduce files and overhead and bring back openhab 1 binding like behavior, but for now the example is how it works and how you may get error logs to be able to traces problems.
I just did the test installing the legacy exec binding and it works as you like, no thing defining the command for on and off in the item. Before it did not.
So this is the legacy binding configuration and not the openhab 2 binding configuration.
So, Iâm curious, why the syntax works with meâŠ?
update:
Now I know! The items do nothing at all (as @Josar suggested correctly).
What I did obviously is to use âexecuteCommandlineâ in a rule, whenever an item changes (Iâm even commented it in the rule itself!) :
rule "USB Hausnummer an/aus"
when
Item USB_EG_Windfang_01 changed
then
// Wegen exec 2.0 binding Syntax!
if(USB_EG_Windfang_01.state == OFF) { executeCommandLine("/home/openhabian/usbstrom.sh 0 f 1") }
if(USB_EG_Windfang_01.state == ON) { executeCommandLine("/home/openhabian/usbstrom.sh 0 o 1") }
end
With that comment I remember now: I was fed up with the complicated, warped exec2-thing configuration and so I did that Workaround. But Iâm glad to hear that is taken care of in a new version of exec2
The rule is thus also executed with the status NULL.
Status NULL is usually not available, since you have a persistence âŠ
Try it, Iâm not sure that the Syntax is 100% correct
rule "USB Hausnummer an/aus"
when
Item USB_EG_Windfang_01 received command
then
if(receivedCommand == OFF && USB_EG_Windfang_01.state != OFF) { executeCommandLine("/home/openhabian/usbstrom.sh 0 f 1") }
if(receivedCommand == ON && USB_EG_Windfang_01.state != ON) { executeCommandLine("/home/openhabian/usbstrom.sh 0 o 1") }
end
Thanks for your ideas. indeed my rule is a bit more complex, as I also read the status of each of the four USB-controlled power outlets and as the outlet has some minor flaws like it not always correctly toggles power and allâŠ
Thanks for all the help, got it to work, uninstalled EXEC Binding 2.X and installed version 1, now its working
The command worked with the complete path to pilight-send and without.
2nd Question, i got Homematic IP at thome and use the HTTP Request to push the values in Pimatic, can i do that witth the HTTP Request Binding and how can i create a Diagramm in the HABPanel ?
Thanks for the info I will try to setup the Persistence up - but looks complicated to me
I only want to draw a chart with temperature values , humidity and power consumption. Power consumption i already have as item from the tp link smart home binding (HS110 power plugs)
The Temp uns Humudity (values from homematicip-rest-api) i need to import , in pimatic it worked with a http request und push it in a variable, which would be an item in OpenHab2 i guess.
Thats one line and i need only the value from acutal Temperature
python3 ./homematicip_cli.py --list-devices > hip-devics.log
tail hip-devics.log | grep â3014F711A0000E970992A398â | grep -o -P â(?<=actualTemperature().*(?=) )â
then i get exact 18.2 and that value i need to get in to openhab, perhaps the HTTP Binding is not the right one?