Hi, I want to migrate from HC2 by adding devices through the API first, and then move z-wave devices gradually. I first tried to do this using the HTTP binding, but as far as I could understand, it did not work with POST data?
Next try was using the exec binding, where I made a script which forwards the values to HC2. The script works fine from the shell. This is the binding used:
[ERROR] [hab.binding.exec.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : 'Format specifier '%2$s''
Thank you! That was not very intuitive, it threw me off as I expected something was wrong with the “Thing”. However, I never got it to work. Any pointers?
I just coded a small server in Python (it was time to learn some Python anyways ) which listens on a TCP port and forwards the input to the HC2 API.
… just realized that it was probably not what I wanted, as openHAB sends HTTP request, not raw TCP data…
Still no luck. I tried to remove the %2$s parameter from the equation by making both parameters to the script constant, but from what I can see, it is not even executing when the item is changing (but it does three times when I save the .things file!).
When I save the file, I get the following errors, although it seems to return immediately from the command line:
20:05:19.886 [INFO ] [smarthome.event.ThingUpdatedEvent ] - Thing 'exec:command:hc2' has been updated.
20:05:19.917 [INFO ] [smarthome.event.ThingUpdatedEvent ] - Thing 'exec:command:hc2' has been updated.
20:05:19.955 [ERROR] [hab.binding.exec.handler.ExecHandler] - An exception occured while waiting for the process ('/home/pi/hc2_setvalue 28 30') to finish : 'null'
20:05:19.961 [WARN ] [hab.binding.exec.handler.ExecHandler] - Forcibly termininating the process ('/home/pi/hc2_setvalue 28 30') after a timeout of 15000 ms
20:05:19.982 [ERROR] [hab.binding.exec.handler.ExecHandler] - An exception occured while waiting for the process ('/home/pi/hc2_setvalue 28 30') to finish : 'null'
20:05:19.983 [WARN ] [hab.binding.exec.handler.ExecHandler] - Forcibly termininating the process ('/home/pi/hc2_setvalue 28 30') after a timeout of 15000 ms
I have discovered that when autorun=true, the command gets sent periodically. However, changing the item through a sitemap does not trigger the command. Am I on the wrong path here? Could you maybe point me to an example with a sitemap -> item -> thing configuration for exec that gives the slider value as a parameter to the exec command?
Changing the item type to String seemed to do the trick! I also had to add a comma before autorun=true, now it works fine I guess I should polish and publish this script.
That’s great. Are you still seeing the script being invoked periodically even without any command input? If so, you may need to add an interval=0 to the thing configuration.
I installed the “Exec Binding (1.x)” instead of the “Exec Binding 2.0”. It works fine using the same .items file than in OpenHAB 1.8.3, without creating any .things file for that. Previously I activated the OH1.x compatibility layer.
Hi All,
I am having a really hard time with the exec2 binding. I have 2.1.0 configured with the demo setting (option selected right at the start), then i added the exec binding with a basic command to run and print the arguments it gets.
All the links are setup between the Thing and Items (i set the “simple” option to create them automatically).
Then I set the Input to “a123b”, and the command to:
/…/scripts/openhab ‘%1$s’ ‘%2$s’
As you can see, the input channel is setup.
Everything works find if I remove the ‘%2$s’ from the command, but if I add it in I get this error:
2017-08-15 20:07:12.902 [ERROR] [hab.binding.exec.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : ‘Format specifier ‘%2$s’’