EnOcean Pi with Raspberry Pi OS and OH3 Docker Container

Hello,

I have OH3 on a Docker container running on a Raspi 4 with Raspberry Pi OS (64-bit). To integrate Hoppe Secusignal window handle sensors, I would like to use the EnOcean Pi module. I plugged this into the GPIO connector, the LED lights up green continuously. I have done following configuration:

  • Set Serial to enabled in the Raspi-Config
  • Deleted the console=serial0,115200 entry in /boot/cmdline.txt
  • Added the following lines to /boot/config.txt:
    dtoverlay=pi3-miniuart-bt
    enable_uart=1
    force_turbo=1
  • Raspi restarted
  • The binding EnOcean, version 3.2.0 installed on OH3
  • Created a Thing (EnoCean Gateway) configured as ESP3 and path /dev/ttyAMA0

Unfortunately I get the message “Configuration_Error, Port could not be found”

I tested on the Raspi using ls -lah /dev/ttyAMA0, as a result I get:
crw–w---- 1 root tty 204, 64 Jul 22 20:08 /dev/ttyAMA0

Does anyone have an idea what could be wrongly configured here?

Regards
neuling10

How do you pass the device to your docker container? Either you forgot to do that or forgot to mention it :slight_smile:

Sorry, I don’t understand what it means to pass the EnOcean device (?) to the Docker container? I got other devices into the thing-inbox after connecting the respective gateway (Somfy, Hue, MQTT) and scanning for things.
On the other hand I‘m a newbie in OH and Raspberry, maybe I have forgotten some simple config :grin:

Ok sorry, let me try to be more precise:
In order to be able to access the serial device (EnOceanPi Module) from within your openHAB docker Container you would need to allow your container to access the device. When you execute „ls /dev/ttyAMA0“ from within your container you will notice that the device you can see on your RasPi is not there.

These are different approaches to make the device accessible from within the container. See for example this discussion: Docker - a way to give access to a host USB or serial device? - Stack Overflow

Based on these permissions, only root-user could work with that device. Not sure with docker, but running OH3 natively, the openhab-user needs to be member of the tty-group (and this group needs permissions). So at least you’d need a chmod g+r on the ttyAMA0 device.

Thank you very much for your help! I’ve now come a few steps further.

On Portainer I added the devices /dev/ttyAMA0 and /dev/ttyACM0 (for z-Wave stick) under Runtime & Resources for my openHAB Container.
I added user rights with the following commands on the Raspi:
chmod g+r /dev/ttyAMA0
chmod g+r /dev/ttyACM0
usermod -a -G dialout openhab

Then I recreated the things… Suddenly EnOcean and Z-Wave Binding were online :smiley: . My EnOcean and z-Wave devices were created via Things successfully.

After restarting the Raspi everything is offline again with the same error messages from my first post. Unfortunately I can’t get it online anymore :confused:

Do you have another tip for me what I have to configure for a renewed and permanent online status?
Are there some entries neccessary in the docker .yaml file?

Did you check the permissions are still like intended ? Most likely the device is re-created via udev-rules on boot. You’d have to add the proper permissions in that rule.

Yes, that sounds logical, but I don’t know how to do it exactly.
After researching I created the following entries under /etc/udev/rules.d/99-usb.rules:
Kernel==“ttyAMA0”,MODE=“0666”
Kernel==“ttyACM0”,MODE=“0666”
As I understand it, this should always give the devices the same serial address on the Raspi.

I am now stuck with the next steps or with the necessary configuration of my OH Docker container. The command
docker run -t -i --device=/dev/ttyAMA0 [CONTAINER-NAME] bash
brings no success

You mentioned earlier that you use Portainer to manage your containers. Is this no longer the case? Doesn’t it work like before anymore?

Yes I’m still using Portainer. I have added the devices there.

Today I received an online connection to Z-Wave and EnOcean twice after various restarts of the container/Raspi. I can not understand exactly what ultimately led to the online status again.

However, it is a mystery to me which necessary rights I have to set on Portainer/on the Raspi so that the connection remains permanent after each restart.

After a long day the problem should be solved :slight_smile:

In the Docker-Compose .yml file I added devices:

devices:
 - /dev/ttyAMA0
 - /dev/ttyACM0

Then I was able to solve the problem for Z-Wave AND EnOcean with Ardanedh’s post in the following thread:
Aeotec Z-Wave Gen5+ Stick stays offline after container restart / Raspi reboot - #13 by Ardanedh

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.