[SOLVED] Openhab binding te923 needs sudo rights. How to?

I have installed a binding called te923 from github. It uses a shellscript to read data from my weather station which is connected to my raspbianpi via usb.

I can run the script manually via ssh, so I see that it works. But I have to run it as sudo.

In the openHAB paper UI, I have added the the binding and the thing successfully, but I cant read any data. The error message is the same that I see when I try to run the script without sudo

error: Unexpected answer from cmd command line: Error while setting configuration (-1). Error while setting configuration (-1). - Size is 1 and should be 22

So i am assuming that I somehow have to give openhab sudo rights? Or change the permissions on the shell script?

Let me add that I am not at all experienced with linux.

You need to change to permission of the shell script and add openhab

sudo chown openhab /your/path/to/script.sh

Thanks, this sounds like what I was searching for. Unfortunately it did not solve my problem.
edit: is it possible that “openhab” is not the right user? How would i find out?

Can you publish your script, please?

Hi, you were able to compile te923 and are able to get data from the te923con right?

Did you tried in a shell

(become root)

sudo su
(Get process of openhab)
ps -edf | grep openhab

The first line should be “openhab” (the running user)

Try to run as openhab user

su openhab --preserve-environment

Try to run a similar command to this one with this user

You should get something like

If you are not able to do that my binding will not work.

What do you get?

(Sorry for the lack of support of this plugin, but I haven’t seen many people interested)

You will probably need to grant openhab some permissions.

To give a specific group access to a USB device you have to add a rule to udev in /etc/udev/rules.d/. Add a file called CHOOSEANAME.rules that contains something like this line:


Search the web for a detailed tutorial on udev rules and maybe symlinks.

The not preferable way is granting sudo.


Thanks to all for your replies.

  • I have verified that the user is ‘openhab’ as described by gabriel.klein
  • I ran the script as ‘openhab’ and I am still getting the error message.
openhab@openHABianPi:/home/openhabian$ sudo /opt/te923/te923con
openhab@openHABianPi:/home/openhabian$  /opt/te923/te923con
Error while setting configuration (-1).

I am now trying to understand and follow what Josar posted, but It might take me a while.

I would add a udev rule which adds the device to the dialout group.
as shown above, last post and link.

Then add the user openhab to the dialout group and restart.

sudo adduser openhab dialout

After restart show the groups of the user openhab

sudo -u openhab groups

then try to use the comand as the user openhab like this

sudo -u openhab /opt/te923/te923con

if this works then it should also work from within openhab.

Hello, please use the following approach instead of this binding as it’s cleaner. (I wrote the binding).


i have a Problem with TE923 on the Openhab2 Paper UI

Status: OFFLINE - CONFIGURATION_ERROR Unexpected answer from cmd command line: Error while setting configuration (-1). Error while setting configuration (-1). - Size is 1 and should be 22

Putty is ok
[21:09:49] openhabian@RaspberryPi:~$ sudo te923con
[sudo] password for openhabian:

Please Help
Thank you

The user “openhabian” probably has no access to te923.

(If openhabian is the user running openhab2)