FHEM Forum

FHEM => Sonstiges => Thema gestartet von: itcompi am 10 Oktober 2017, 20:30:42

Titel: [gelöst] Docker FHEM HMLAN einbinden
Beitrag von: itcompi am 10 Oktober 2017, 20:30:42
Hallo,

ich versuche seit einiger Zeit mein HMLAN zur Steuerung in ein Docker Image, in dem FHEM läuft, zu integrieren.
HMLAN ist in der fhem.cfg konfiguriert und läuft im Netzwerk. Weiß jemand von euch wie ich FHEM dazu bringen kann
aus dem Docker Container mit dem HMLAN zu kommunizieren?`

Danke!
Titel: Antw:Docker FHEM HMLAN einbinden
Beitrag von: Otto123 am 10 Oktober 2017, 21:03:27
Hi,

das dürfte keine Sache von FHEM sondern eher eine Sache der Netzwerkkonfiguration deines Docker Images sein.
https://docs.docker.com/engine/userguide/networking/

Kannst Du den HMLAN pingen?

Gruß Otto
Titel: Antw:Docker FHEM HMLAN einbinden
Beitrag von: itcompi am 10 Oktober 2017, 21:47:13
Hi,

danke erstmal für deine Antwort. Nein kann ihn nicht anpingen. Ich muss allerdings gestehen, dass ich nicht recht verstehe wie ich das Netzwerk konfigurieren muss, damit er das lokale Netzwerk verwendet.
Titel: Antw:Docker FHEM HMLAN einbinden
Beitrag von: ThoTo am 15 Oktober 2017, 11:47:24
Kannst du aus einem Container heraus andere Geräte in deinem Netzwerk erreichen?
Bitte beschreib die Umgebung (docker run, Netzwerk etc.) noch ein wenig besser.

LG Thomas
Titel: Antw:Docker FHEM HMLAN einbinden
Beitrag von: itcompi am 16 Oktober 2017, 13:57:11
Ich habe mir folgendes Image zusammengebaut:


FROM resin/rpi-raspbian:stretch

MAINTAINER itcompi

ENV port 7072

# See https://debian.fhem.de/ and https://forum.fhem.de/index.php?topic=27679.0 for details

# Update your package administration:
RUN apt-get update


#### Install needed tools ####

# Install packages taht are needed when building the image with this Dockerfile
RUN apt-get -qy install apt-utils \
                        apt-transport-https \
                        wget


#### Install commodities ####

# Just for development. Not needed for production
RUN apt-get -qy install mc


#### Install fhem ####

# At the moment the following way is broken

# Import repository gpg key:
#RUN wget -qO - https://debian.fhem.de/archive.key | apt-key add -

# Add repository to /etc/apt/sources.list:
#RUN echo "deb https://debian.fhem.de/stable ./" | tee -a /etc/apt/sources.list

# Update your package administration:
#RUN apt-get update

#RUN apt-get -qy install fhem


# so (because it's broken) I install the package directly
WORKDIR /opt/fhem

# Manually install dependencies (not needed when installing fhem via apt-get install
RUN apt-get -qy install         \
      libdevice-serialport-perl \
      libwww-perl               \
      libio-socket-ssl-perl     \
      libcgi-pm-perl            \
      libjson-perl              \
      sqlite3                   \
      libdbd-sqlite3-perl       \
      libtext-diff-perl
     

# Install the perl module Module::Pluggable
# 'make' is needed for the cpan install of Module::Pluggable
RUN apt-get -qy install make                         
RUN export PERL_MM_USE_DEFAULT=1 && \
    cpan -i Module::Pluggable

# and now for FHEM itself
RUN wget  http://fhem.de/fhem-5.8.deb
RUN dpkg -i fhem-5.8.deb
RUN rm fhem-5.8.deb

#### Configure FHEM ####
ADD *.cfg /opt/fhem/
#### docker stuff ####

EXPOSE 8083 8084 8085 7072

# Some info about which user should start fhem: https://forum.fhem.de/index.php?topic=53586.0
#
# In fhem.pl there is the code:
#   # If started as root, and there is a fhem user in the /etc/passwd, su to it
#   if($^O !~ m/Win/ && $< == 0) {
#   ...

CMD perl fhem.pl fhem.cfg


Als Netzwerk habe ich die bridge verwendet. Ich habe mittlerweile einen Test per Ping gemacht und ich kann den HMLAN anpingen.
Meine Geräte laufen unter 192.168.178.*

Meine Logs zeigen, dass FHEM keine Verbindung aufbauen kann.

2017.10.16 09:29:56 1: Including fhem.cfg
2017.10.16 10:58:29 1: Including fhem.cfg
2017.10.16 10:58:30 3: httpmod_fhemcontrols: Defined with URL https://svn.fhem.de/fhem/trunk/fhem/controls_fhem.txt and interval 86400
2017.10.16 10:58:30 3: httpmod_ftui: Defined with URL https://raw.githubusercontent.com/knowthelist/fhem-tablet-ui/master/www/tablet/js/fhem-tablet-ui.js and interval 86400
2017.10.16 10:58:30 3: telnetPort: port 7072 opened
2017.10.16 10:58:31 3: WEB: port 8083 opened
2017.10.16 10:58:31 3: WEBphone: port 8084 opened
2017.10.16 10:58:31 3: WEBtablet: port 8085 opened
2017.10.16 10:58:31 3: tablet_ui: new ext defined infix:tablet/index.html: dir:./www/tablet:
2017.10.16 10:58:31 3: Registering HTTPSRV tablet_ui for URL /tablet/index.html   and assigned link tablet/index.html ...
2017.10.16 10:58:31 3: mobile_ui: new ext defined infix:mobile/index.html: dir:./www/mobile:
2017.10.16 10:58:31 3: Registering HTTPSRV mobile_ui for URL /mobile/index.html   and assigned link mobile/index.html ...
2017.10.16 10:58:31 2: eventTypes: loaded 0 events from ./log/eventTypes.txt
2017.10.16 10:58:31 1: Including ./fhem_interfaces.cfg
2017.10.16 10:58:31 1: HMLAN_Parse: HMLAN1 new condition disconnected
2017.10.16 10:58:31 3: Opening HMLAN1 device 192.168.178.23:1000
2017.10.16 10:58:32 3: Can't connect to 192.168.178.23:1000: Connection refused
2017.10.16 10:58:32 1: Including ./fhem_rubbish.cfg
2017.10.16 10:58:32 1: Including ./fhem_bvg.cfg
2017.10.16 10:58:32 3: BVG: URL is none, periodic updates will be limited to explicit GetXXPoll attribues (if defined)
2017.10.16 10:58:32 3: BVG: interval is 0, no periodic updates will done.
2017.10.16 10:58:32 3: BVG: Defined without URL
2017.10.16 10:58:32 1: Including ./fhem_utilities.cfg
2017.10.16 10:58:34 1: Including ./fhem_wc.cfg
2017.10.16 10:58:34 1: Including ./fhem_hall.cfg
2017.10.16 10:58:34 1: Including ./fhem_guest.cfg
2017.10.16 10:58:35 1: Including ./fhem_living.cfg
2017.10.16 10:58:35 1: Including ./fhem_dining.cfg
2017.10.16 10:58:35 1: Including ./fhem_bathroom.cfg
2017.10.16 10:58:35 1: Including ./fhem_parents.cfg
2017.10.16 10:58:35 1: Including ./fhem_child1.cfg
2017.10.16 10:58:35 1: Including ./fhem_child2.cfg


Es bleibt jedoch dabei, dass in FHEM keine Stati und keine Reaktion kommt :(
Titel: Antw:Docker FHEM HMLAN einbinden
Beitrag von: itcompi am 16 Oktober 2017, 18:21:16
Funktioniert. Das Problem bestand blöder Weise darin, dass auf einem RPi (Produktivumgebung) noch FHEM lief und dort HMLAN mit verbunden war.
Nach einem Disconnect und Connect gab es kein Problem mehr. Danke.