openHABian hassle-free openHAB Setup

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.

Hi,

sometimes I have the need to remotely restart my openhab instances.
Originally I was running openhab with root rights and just added a shellexecute into my rules.
This allowed restarting from gui which was very convenient.
Is there a way to achieve something similar with openhabian?

You can use sudo (you will have to set the openHAB user to need no password for the command, see http://askubuntu.com/questions/159007/how-do-i-run-specific-sudo-commands-without-a-password for how to do this)

1 Like

Hi @Udo_Hartmann:
Thank you for your quick reply. I was not aware that this is possible.
Thanks a lot :slight_smile:

@ThomDietrich

Hi Tom,

How would I go about adding another log file to the frontail live logs? The log file I want to add is currently in the following folder

/etc/openhab2/scripts/iLocatorBridge/

Thanks

Hello everyone,

@Nathan_Wilcox that’s easy, just append whichever files you want to follow to /etc/systemd/system/frontail.service.

@Spaceman_Spiff The answer by @Udo_Hartmann is also the one I’d have given (Thanks for jumping in). As adding commands for user openhab to the sudoers file is pretty common, maybe I should provide a template/example setup (commented) with openHABian!? Wdyt?

@rtvb could you rephrase that?

@quangtuyentran You don’t need to set a static IP. You need to tell your system the SSID and Password of your Wifi. Please see the release notes for openHABian v1.2 for details.

@rtvb @greenoid after your discussion about jeelink/udev, any additions you would like to see in openHABian?

@greenoid exactly. You can of course change the sudo behavior but that’s a decision, not a bugfix :wink:

The one and the other are totally unrelated. I’d need to investigate why the second is the case. Any news on your side? Regarding /boot/openhabian.conf, this file is not modified after first boot. If you change the hostname, that’s unrelated to the file. In fact the file could be delete. Maybe I’ll do that.

I hope I didn’t miss anything.

1 Like

@ThomDietrich

Thanks Tom,

As always a quick response with the appropriate direction.

Could you now help me with /etc/rc.local please?

I’d like to add the following lines to the file so that a script can continuously be run in the background without me having to initiate it myself:

sleep 15
sudo python /usr/sbin/iLocator.py   <whatever your path to the script is>

I’m just a little hesitant to add them myself in case I break the system for the millionth time…

Thanks

Tricky subject. Do you need it to start with the system or just to be active in the background? In the latter case I’d recommend to use a screen shell for it - gives you the right amount of flexibility.
If you want it to start in background with the system and you do not want to define your own service file (basically a copy of the frontail file) you can add it to rc.local (not a clean solution). However you need to do that in a way the script will not block the termination of rc.local. Therefore this would probably be close to what you are looking for:

(/bin/sleep 15 && /usr/bin/python /usr/sbin/iLocator.py) &

Read: In a subshell, execute sleep then the python script, send the subshell into the background.

1 Like

Thanks!

I’ve opted for the first option, screen shell, and will give it a go for a few days to see how it runs. I didn’t realise that existed. It’s great for me as all too often either the little one or the partner switches ssh off without realising what it is…

From what I read I presume that the only way that the script will stop running in the background now is if either I terminate it by reconnecting to the instance or by rebooting the Pi?