openHABian hassle-free openHAB Setup

Oh perfect:-), I didn’t take a look to the latest posts on GitHub.

Hi!
first of all thank you great work, helped me a lot in setting up my OH2.
But now i’m struggling. i got a serial pi plus and tried it on a fresh jessie setup. after adding “enable_uart=1” to /boot/config.txt i get this

pi@raspberrypi:~ $ ls -l /dev lrwxrwxrwx 1 root root 7 Mar 29 18:29 serial0 -> ttyAMA0 lrwxrwxrwx 1 root root 5 Mar 29 18:29 serial1 -> ttyS0

but if i do the same thing on my openHABian setup there’s no serial0 nor serial1

[code][pi3]
kernel=vmlinuz-4.4.0-1-rpi2
initramfs initrd.img-4.4.0-1-rpi2 followkernel

enable the serial console for the installed system

enable_uart=1
gpu_mem=16
dtparam=audio=on
dtoverlay=pi3-disable-bt[/code]

i also tried to disable/enable serial settings via openHABian setup, but that’s not helping.
any idea what i can do?

Not entirely sure what you are trying to accomplish. Please check the following article: http://elinux.org/RPi_Serial_Connection#Connection_to_a_microcontroller_or_other_peripheral

i’d lile to use this one https://www.abelectronics.co.uk/p/51/Serial-Pi-Plus with modbus binding.

ls -l /devdoesn’t bring anything with “serial*” up.
i just made a fresh install of newest openHABian and in settings i activated serial and got this msg:

âââââââââââââââââââââââââââ⤠Operation Successful! âââââââââââââââââââââââââââââ â â â All done. After a reboot the serial console will be available via â â /dev/ttyAMA0 or /dev/ttyS0 (depends on your device). â
shouldn’t i see this with ls -l /dev?

with a clean raspian jessi install i get seria0 and serial1.

the link you postet doesn’t help. sudo: raspi-config: command not found
also methods 2 & 3 don’t seem to get me a serial device to use with modbus.

OK, today i used a clean raspian jessie and installed openHABian via git, configured the serial port, added permission and now it finally seems to be working! sadly all me other conf is on the openHABian install - won’t i be able to use serial with the minimal openHABian install?

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?