FHEM Forum

FHEM - Hardware => Einplatinencomputer => Thema gestartet von: laxmann am 18 März 2017, 11:51:44

Titel: Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: laxmann am 18 März 2017, 11:51:44
Hallo zusammen,
ich möchte das HM-Funkmodul als Remote-HMLAN benutzen. Auf meinem FHEM-Rasp funktioniert mein HM-MOD-RPI-PCB als HMLAN.
Jetzt zu meiner Frage:
Auf
https://wiki.fhem.de/wiki/HM-MOD-RPI-PCB_HomeMatic_Funkmodul_f%C3%BCr_Raspberry_Pi#Remoteanbindung_-_Pi_.2B_RPI_Modul_.3D_LAN_Modul (https://wiki.fhem.de/wiki/HM-MOD-RPI-PCB_HomeMatic_Funkmodul_f%C3%BCr_Raspberry_Pi#Remoteanbindung_-_Pi_.2B_RPI_Modul_.3D_LAN_Modul)
ist die Installation beschrieben. So, wie ich dieses Manual verstehe, beginnt erst mit der Abschnittsüberschrift
ZitatRemoteanbindung - Pi + RPI Modul = LAN Modul
die Installation für diese Remoteanbindung.

Nur mit
sudo systemctl enable hmlangw
erhalte ich die Antwort
Failed to execute operation: Bad message

Wo ist der Fehler?

Gruß
laxmann
Titel: Antw:Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: laxmann am 18 März 2017, 15:36:26
Hier habe ich noch etwas zu sudo systemctl status -l hmlangw

pi@HMRaspHinten:~ $ sudo systemctl status -l hmlangw
● hmlangw.service
   Loaded: loaded (/etc/systemd/system/hmlangw.service)
   Active: inactive (dead)

Mär 18 15:25:18 HMRaspHinten systemd[1]: [/etc/systemd/system/hmlangw.service:1] Assignment outside of section. Ignoring.
Mär 18 15:25:18 HMRaspHinten systemd[1]: [/etc/systemd/system/hmlangw.service:4] Unknown lvalue 'Type' in section 'Install'
Mär 18 15:26:00 HMRaspHinten systemd[1]: [/etc/systemd/system/hmlangw.service:1] Assignment outside of section. Ignoring.
Mär 18 15:26:00 HMRaspHinten systemd[1]: [/etc/systemd/system/hmlangw.service:4] Unknown lvalue 'Type' in section 'Install'
Mär 18 15:26:52 HMRaspHinten systemd[1]: [/etc/systemd/system/hmlangw.service:1] Assignment outside of section. Ignoring.
Mär 18 15:26:52 HMRaspHinten systemd[1]: [/etc/systemd/system/hmlangw.service:4] Unknown lvalue 'Type' in section 'Install'
Mär 18 15:27:22 HMRaspHinten systemd[1]: [/etc/systemd/system/hmlangw.service:1] Assignment outside of section. Ignoring.
Mär 18 15:27:22 HMRaspHinten systemd[1]: [/etc/systemd/system/hmlangw.service:4] Unknown lvalue 'Type' in section 'Install'
Mär 18 15:29:08 HMRaspHinten systemd[1]: [/etc/systemd/system/hmlangw.service:1] Assignment outside of section. Ignoring.
Mär 18 15:29:08 HMRaspHinten systemd[1]: [/etc/systemd/system/hmlangw.service:4] Unknown lvalue 'Type' in section 'Install'
Titel: Antw:Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: laxmann am 19 März 2017, 13:08:39
Hallo zusammen,
auf
https://wiki.fhem.de/wiki/Benutzer:Benheim/Startscript_systemd (https://wiki.fhem.de/wiki/Benutzer:Benheim/Startscript_systemd)
habe ich noch etwas entdeckt:
ZitatNun muss einmalig der Befehl

systemctl daemon-reload

eingegeben werden, damit die neuen Dateien eingelesen werden. Mit dem Befehl

systemctl enable fhem.service

wird dafür gesorgt, dass bei einem Systemstart FHEM automatisch gestartet wird (ein symbolischer Link im mit WantedBy= wird erstellt). Der automatische Start lässt sich mit

Habe "fhem.service" in "hmlangw.service" geändert, der sich im Pfad
/etc/systemd/system
befindet.

Das Ergebnis:
pi@HMRaspHinten:~ $ sudo systemctl daemon-reload
pi@HMRaspHinten:~ $ sudo systemctl enable hmlangw.service
Failed to execute operation: Bad message


Wo ist mein Fehler?

Schönen Sonntag!

Gruß
laxmann
Titel: Antw:Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: Otto123 am 19 März 2017, 21:05:34
Hi,

wie sieht Deine Datei /etc/systemd/system/hmlangw.service aus?

Gruß Otto
Titel: Antw:Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: laxmann am 20 März 2017, 17:58:25
Hallo Otto,
/etc/systemd/system/hmlangw.service
$cat /etc/systemd/system/hmlangw.service
  [Install]
  WantedBy=multi-user.target
  Type=forking
 
  [Service]
  ExecStart=/usr/bin/socat TCP4-LISTEN:2000,fork,reuseaddr /dev/ttyAMA0,raw,echo=0,b115200
  User=root
  Restart=always
  RestartSec=10


Dann habe ich nochmals die aktuelle Seite
https://wiki.fhem.de/wiki/HM-MOD-RPI-PCB_HomeMatic_Funkmodul_f%C3%BCr_Raspberry_Pi#Remoteanbindung_-_Pi_.2B_ (https://wiki.fhem.de/wiki/HM-MOD-RPI-PCB_HomeMatic_Funkmodul_f%C3%BCr_Raspberry_Pi#Remoteanbindung_-_Pi_.2B_)
aufgerufen und siehe da

[Install]
WantedBy=multi-user.target
Type=forking
 
[Service]
ExecStart=/usr/bin/socat TCP4-LISTEN:2000,fork,reuseaddr /dev/ttyAMA0,raw,echo=0,b115200
User=root
Restart=always
RestartSec=10

hat sich geändert.
Ich habe es mit der neuen hmlangw.service-Datei ausprobiert:

pi@HMRaspHinten:~ $ sudo systemctl enable hmlangw
Created symlink from /etc/systemd/system/multi-user.target.wants/hmlangw.service to /etc/systemd/system/hmlangw.service.


Dann kann die Installation von HM-MOD-RPI-PCB HomeMatic Funkmodul weiter gehen.

Danke, ich hätte sonst nicht nochmal nachgeschaut.

Gruß
laxmann


Titel: Antw:Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: Otto123 am 20 März 2017, 18:05:45
Ja, habe ich korregiert. Ich dachte mir sowas.  :-[

Die erste Zeile hatte der Artikelverfasser noch vom "Ich zeige das mal an" Modus drin. Also cat -> die Datei.
Die erste Zeile gehört nicht zur hmlangw.service.

Gruß Otto
Titel: Antw:Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: Wernieman am 20 März 2017, 18:15:19
wobei ... währe es nicht besser, anstatt /dev/ttyAMA0 ein /dev/serial/by-id/xxx (oder  /dev/serial/ny-path/xxx) zu nehmen?

Ist bootfester, falls ein 2. Stick dazukommt .... (nicht gleicher, nur ähnlicher)
Titel: Antw:Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: Otto123 am 20 März 2017, 18:20:27
Zitat von: Wernieman am 20 März 2017, 18:15:19
wobei ... währe es nicht besser, anstatt /dev/ttyAMA0 ein /dev/serial/by-id/xxx (oder  /dev/serial/ny-path/xxx) zu nehmen?

Ist bootfester, falls ein 2. Stick dazukommt .... (nicht gleicher, nur ähnlicher)
Hi Werner,

ist kein Stick, ist die UART Schnittstelle der GPIO.

Gruß Otto
Titel: Antw:Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: laxmann am 20 März 2017, 19:27:54
Hallo zusammen,
da nun der Autostart funktioniert, treten nächste Probleme auf.
In der DeviceOverview erscheint
HMRaspHinten                                     opened

Hier die abwechselnden Readings
D-type                                        HM-MOD-UART
2017-03-19 17:17:40                           cond                                init
2017-03-20 18:59:23                           loadLvl                             suspended
2017-03-19 17:17:40                           state                               opened
2017-03-20 18:58:29


D-type                                       HM-MOD-UART
2017-03-19 17:17:40                          cond                                disconnected
2017-03-20 19:02:12                          loadLvl                             suspended
2017-03-19 17:17:40                          state                                opened
2017-03-20 18:58:29


Im Logfile erscheint
2017.03.20 19:03:57.902 3: HMRaspHinten device closed
2017.03.20 19:03:57.953 1: 192.168.178.81:2000 reappeared (HMRaspHinten)
2017.03.20 19:04:01.960 1: HMUARTLGW HMRaspHinten did not respond for the 1. time, resending
2017.03.20 19:04:04.965 1: HMUARTLGW HMRaspHinten did not respond for the 2. time, resending
2017.03.20 19:04:07.972 1: HMUARTLGW HMRaspHinten did not respond for the 3. time, resending
2017.03.20 19:04:10.978 1: HMUARTLGW HMRaspHinten did not respond after all, reopening
2017.03.20 19:04:10.979 3: HMRaspHinten device closed
2017.03.20 19:04:11.094 1: 192.168.178.81:2000 reappeared (HMRaspHinten)
2017.03.20 19:04:15.100 1: HMUARTLGW HMRaspHinten did not respond for the 1. time, resending
2017.03.20 19:04:18.107 1: HMUARTLGW HMRaspHinten did not respond for the 2. time, resending
2017.03.20 19:04:21.113 1: HMUARTLGW HMRaspHinten did not respond for the 3. time, resending
2017.03.20 19:04:24.120 1: HMUARTLGW HMRaspHinten did not respond after all, reopening
2017.03.20 19:04:24.121 3: HMRaspHinten device closed
2017.03.20 19:04:24.215 1: 192.168.178.81:2000 reappeared (HMRaspHinten)
2017.03.20 19:04:28.218 1: HMUARTLGW HMRaspHinten did not respond for the 1. time, resending
2017.03.20 19:04:31.222 1: HMUARTLGW HMRaspHinten did not respond for the 2. time, resending
2017.03.20 19:04:34.224 1: HMUARTLGW HMRaspHinten did not respond for the 3. time, resending
2017.03.20 19:04:37.230 1: HMUARTLGW HMRaspHinten did not respond after all, reopening
2017.03.20 19:04:37.231 3: HMRaspHinten device closed
2017.03.20 19:04:37.480 1: 192.168.178.81:2000 reappeared (HMRaspHinten)
2017.03.20 19:04:41.484 1: HMUARTLGW HMRaspHinten did not respond for the 1. time, resending
2017.03.20 19:04:44.489 1: HMUARTLGW HMRaspHinten did not respond for the 2. time, resending
2017.03.20 19:04:47.495 1: HMUARTLGW HMRaspHinten did not respond for the 3. time, resending


Wenn ich
sudo systemctl stop  hmlangw
auslöse erscheint im Logfile

2017.03.20 19:06:53.042 1: 192.168.178.81:2000 disconnected, waiting to reappear (HMRaspHinten)

Im DeviceOverview bleibt der Status immer
Zitatopened
Nach [code]sudo systemctl stop  hmlangw[/code] springt der Status auf
Zitatdisconnected

Nach
sudo systemctl start hmlangw
springt der Status nach ca. 60 sec 
Zitatopened

Hier noch die Internals
Internals
CNT                                1
DEF                               uart://192.168.178.81:2000
DevState                        1
DevType                         UART
DeviceName                   192.168.178.81:2000
FD                                  143
LastOpen                        1490034022.14782
NAME                              HMRaspHinten
NR                                  534
PARTIAL
STATE                             opened
TYPE                               HMUARTLGW
XmitOpen                        0
owner_CCU                     vccu1


Draufgesteckt ist dieses Modul auf einen Raspi 2B mit aktuellem Jessie.

Schönen Abend noch

Gruß
laxmann
Titel: Antw:Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: Otto123 am 20 März 2017, 19:37:55
Hi laxmann,

was mir noch nicht eindeutig klar ist:
Das Modul selbst funktioniert? Getestet in FHEM? Auf dem Rechner wo es jetzt steckt?
Wenn es dann aber remote verfügbar sein soll ist jeglicher Zugriff vom lokalen FHEM darauf deaktiviert?

Was sagt ?sudo systemctl status  hmlangw


Gruß Otto
Titel: Antw:Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: laxmann am 21 März 2017, 16:20:12
Hallo Otto,
hier die Antwort
Zitatsudo systemctl status  hmlangw

i@HMRaspHinten:~ $ sudo systemctl status  hmlangw
● hmlangw.service
   Loaded: loaded (/etc/systemd/system/hmlangw.service; enabled)
   Active: active (running) since Mo 2017-03-20 19:31:33 CET; 20h ago
Main PID: 368 (socat)
   CGroup: /system.slice/hmlangw.service
           ├─ 368 /usr/bin/socat TCP4-LISTEN:2000,fork,reuseaddr /dev/ttyAMA0...
           └─1545 /usr/bin/socat TCP4-LISTEN:2000,fork,reuseaddr /dev/ttyAMA0...

Mär 20 19:31:33 HMRaspHinten systemd[1]: Starting hmlangw.service...
Mär 20 19:31:33 HMRaspHinten systemd[1]: Started hmlangw.service.


Das Funkmodul steckt auf einem Rasp ohne Fhem (IP 192.168.178.81) mit einem "EDIMAX" USB-Wlan-Stick.
Die Aufzeichnungen kommen alle von meinem Fhem-Server (IP 192.168.178.60)


Gruß
laxmann
Titel: Antw:Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: Otto123 am 21 März 2017, 16:32:43
Hallo Laxmann,

aber nochmal die Frage: Du hast den raspbi schon ordentlich eingerichtet (https://wiki.fhem.de/wiki/HM-MOD-RPI-PCB_HomeMatic_Funkmodul_f%C3%BCr_Raspberry_Pi#Vorbereitung_serielle_Schnittstelle_unter_Jessie)?

Die Schnittstelle muss ja trotzdem laufen.

Was liefert ls -l /dev/ttyAMA0 ?

Gruß Otto
Titel: Antw:Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: laxmann am 23 März 2017, 20:01:16
Hallo Otto,
vielen Dank für deine Bemühungen.
Ich habe
Zitataber nochmal die Frage: Du hast den raspbi schon ordentlich eingerichtet?
nicht erledigt.
Ich habe die Seite
https://wiki.fhem.de/wiki/HM-MOD-RPI-PCB_HomeMatic_Funkmodul_f%C3%BCr_Raspberry_Pi#Remoteanbindung_-_Pi_.2B_ (https://wiki.fhem.de/wiki/HM-MOD-RPI-PCB_HomeMatic_Funkmodul_f%C3%BCr_Raspberry_Pi#Remoteanbindung_-_Pi_.2B_)
erst ab der Bereichsüberschrift
ZitatRemoteanbindung - Pi + RPI Modul = LAN Modul
für die Installation des Funkmoduls angewendet.

Jetzt habe ich den o.g. Link von oben bis unten durchgearbeitet.
Es gab Probleme bei dem FW-Update ohne FHEM, aber es ist gelöst, da ich diesen nötigen FW-Update unter FHEM durchgeführt habe.

Nochmal meinen Dank -

Otto - Du hast schon viel Geduld -

Gruß
laxmann
Titel: Antw:Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: Otto123 am 23 März 2017, 20:53:11
und jetzt funktioniert alles?

Gruß Otto
Titel: Problem gelöst - Antw:Remoteanbindung - Pi + RPI Modul = LAN Modul
Beitrag von: laxmann am 24 März 2017, 08:27:31
Alles perfekt!!!!