openHABian hassle-free openHAB Setup

Hi,
i’m new to the whole homeautomation game and to openHAB.
I downloaded the openhabianpi-raspbian image (~200mb).

Installation and first configuration steps (openhabian-config, first things, first items etc) were as easy as advertised.

So many thanks to ThomDietrich an all involved for their work and time.:clap:

I hit a little bump in the road, when i tried to install mosquitto. I used openhabian-config, entered the password (myPaSSword) for the openhabian user.
sudo systemctl start mosquitto … status mosquitto showed everything up and running.

When i tested a connection with: mosquitto_sub -d -u openhabian -P myPaSSword -t dev/test on the same Pi3
i got an: connection refused.

When i looked at /etc/mosquitto/mosquitto.conf it was broken.

# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

^[[90;01m$ echo -e
password_file /etc/mosquitto/passwd
allow_anonymous false
^[[39;49;00m

password_file /etc/mosquitto/passwd
allow_anonymous false

After cleaning up (deleting) the two wonky lines, and the double password_file allow_anonymous lines in between, everything is working fine now.

Just wanted to inform the MAKER’S, so someone more knowledgeable then me, can have a look at the script code.

btw. Pi3 is new, 2 weeks old, as is the SD-Card.There should be no corruption yet (i hope :smile:).

Hey @garionth, thanks for reporting this bug (which it is). I’m surprised that 1) I didn’t catch it while adding and testing the authentication feature and 2) you are the first one to report it after 37 days…

I’ve just committed a (tested) bugfix. As always one has to update the openHABian Configuration Tool to receive it.

Thanks for the report!

I saw them and deleted them yesterday too. Sorry for not reporting. It was too after a fresh install of openHabian too if that helps.

Sudo asking for password problem solved

Replace user ‘pi’ with ‘openhabian’ in /etc/sudoers.d/010_pi-nopasswd
from
pi ALL=(ALL) NOPASSWD: ALL
to
openhabian ALL=(ALL) NOPASSWD: ALL

From now on all sudo commands won’t ask for the openhabian password again (that was the default before changing the standard user from ‘pi’ to ‘openhabian’.

Tipp: for more comfort you may run “sudo bash” to run multiple commands as root, but don’t get lazy and know what you are doing!

Changing hostname with openhabian-config does not change all appearances of the hostname

If I change the hostname via openhabian-config the hostname gets changed in /etc/hostname und /etc/hosts, but not in /boot/openhabian.conf and my router/dhcp server knows the raspi under the old name.

Yesterday, I installed a new openHABian. I am using the new dsmr binding with manual configuration and specify the serial port in a .things file. Previously, I used a persistent device name through a udev rule without issues. Now this does not seem to work with openHABian. Using the device /dev/ttyUSB1 fortunately is working, but I’d like to use persistent /dev/dsmr.

What could be wrong?

$ cat /etc/udev/rules.d/50-usb-serial.rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A5Z5VJCX", SYMLINK+="dsmr"

$ ls -la /dev
lrwxrwxrwx  1 root root           7 Apr  3 10:39 dsmr -> ttyUSB1
crw-rw----  1 root dialout 188,   1 Apr  3 10:39 ttyUSB1

$ cat /etc/group | grep 'dialout'
dialout:x:20:openhabian,openhab

Update: it has nothing to do with the binding. The same applies for the rfxcom binding that is working with /dev/ttyUSB0 and not with /dev/rfxcom.

Perhaps asking for the password is meant a feature, by design, for additional security?

1 Like

Problem with device permissions and razberry board

I use a razberry board and was succesful with installing it an raspbian with openhab. Now with openhabian I ran into problems (it should be the other way around?).
I used the ‘serial port’ setup from openhabian-config to prepare for the razberry.
After reboot I have a symbolic link from /dev/serial0 to /dev/ttyAMA0. Nice. But /dev/ttyAMA0 has the permissions crw_w__ and user root and group tty. So the user openhabian does not have access rights to /dev/AMA0 or /dev/serial0 even it is member of group ‘tty’.
I will try to get it installed by hand as before.

Solved

I had to delete ‘console=serial0,115200’ in /boot/cmdline.txt’ and reboot.
Then /dev/ttyAMA0 has group dialout and rw rights for the group.
Z-Wave is now shown as online in the paper ui and I could add a door sensor.

@ThomDietrich do you have a clue why my udev device is not working with openHABian?

Options for udev rules

Here’s my example from a jeelink transceiver on USB (on Raspbian, change accordingly):

JeeLink v3 868 Mhz udev rule

SUBSYSTEMS==“usb”, ATTRS{serial}==“AH02EWYA”, ATTR{idVendor}==“0403”, ATTR{idProduct}==“6001”, OWNER=“root”, GROUP=“users”, MODE=“0664”, SYMLINK+=“ttyUSB_jeelink”

You could try: Subsystem usb instead of tty, specify owner, group, permissions.
I read that some devices react different if the name does not begin with tty or ttyUSB so I always use a prefix of “ttyUSB_” and a device idenitifier as suffix.

I tried changing the udev rule for the rfxcom device from /dev/rfxcom to /dev/ttyUSB_rfxcom without success. The port is not visible to openHAB either. As soon as I change it back to `/dev/ttyUSB0’ the things come online.

Sorry, I forgot:
Add the serial device name to
EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/ttyAMA0"
in /etc/defaults/openhab2
and restart OpenHAB.

I’m have to get my old udev rules working again on Openhabian. It’s important as soon as you have more than one USB Transceiver connected with the same usb chip. One time it is ttyUSB0 and another it may be ttyUSB1.

1 Like

Hey,

Thanks @ThomDietrich for your hardworking with openhabian.
I am using openhabian, but I don’t know how to connect to wifi, without Lan cable openhabian can not start.
Can you show me how to set static ip for Raspberry 3 to connect to wifi.

Thanks in advance

QT.Tran

Got it working after editing the default file.

@ThomDietrich Wouldn’t it be good to add to the openhabian documentation page that you might need to modify the /etc/default/openhab2 file for using serial ports?

I see a problem running openhab on raspi on a SD card.
I had in the past, such a SD card just drops dead for no reason (the reason is actually that this device is so cheap)

It would be great if there would be a script which copies periodically all settings in a file (on remote device) , which openhabian could read and bootstrap when rebuilding the system. I mean everything should be recorded in the file which is needed.

Please have a look at he github issues

If you can wait some more…

I suggest using the menu config entry use usb device as system disk (or similiar, can’t remember).
I used this manually while being on raspbian to prevent the file system on the sd card to get corrupted (which happened often!). And it worked. There are some more tricks like moving /tmp and or /var/tmp into memory, and buffering some log entries, but I don’t know if they are implemented in openhabian as well.

maybe to much, but what about building a cheap raspi cluster. Sharing same logical name.

The corruption of sd cards with Raspberry Pi is a known problem:


This has 363 comments (heavy) and I don’t consider it closed and solved.
To me it’s not a question of the right sd card or power supply but of the firmware and sd card driver
(proof: sd cards work way better in cameras and PCs)
I just try to get around it with a read-only sd-card for boot and file system on an usb stick to be safe.