Arduino über ser2net

Begonnen von Leon_Emm, 11 Juni 2021, 22:27:16

Vorheriges Thema - Nächstes Thema

Leon_Emm

Hallo alle zusammen,

ich hoffe, dass dies der richtige Bereich ist, aber ich habe derzeit ein größerers (Netzwerk)Technik Problem.

Kurz zu meinem Setup:
FHEM läuft auf einem Unraid-Server als Dockercontainer. Dieser Server steht physisch wegen anderen Anwendungen im Büro (DG). In meinem Schaltschrank habe ich einen Raspberrypi 1B, auf welchem ein EnOcean TCM310 sitzt (GPIO). Dieses wird über ser2net in mein Netzwerk geschickt (LAN) und von FHEM gesteuert. Soweit auch so gut. Nun möchte ich einen Zwischenzähler per Arduino und ArduCounter mittels S0-Schnittstelle auslesen.

Lokal auf dem Raspberry ließ sich der Arduino über avrdude mit dem passenden Image flashen. Ser2Net war wie folgt konfiguriert:

3002:raw:600:/dev/ttyACM0:115200 8DATABITS NONE 1STOPBIT //Arduino
3001:raw:0:/dev/ttyAMA0:57600 NONE 1STOPBIT 8DATABITS HANGUP_WHEN_DONE //TCM310


Leider konnte ich aber keine passende/sinnvolle Verbindung zwischen FHEM und Arduino herstellen. Das Modul ArduCounter lieferte folgenden log:
2021.06.11 16:47:38.599 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:47:38.599 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:47:40.581 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:47:42.583 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:47:44.585 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:47:52.586 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:48:02.594 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:48:02.595 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:48:02.927 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:48:04.929 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:48:06.931 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:48:14.932 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:48:24.936 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:48:24.937 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:48:25.856 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:48:26.526 3: klimazaehler: Sending info command to device
2021.06.11 16:48:28.530 3: klimazaehler: Timeout2 in ReadAnswer
2021.06.11 16:48:28.531 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:48:28.534 3: klimazaehler: Sending info command to device
2021.06.11 16:48:30.537 3: klimazaehler: Timeout2 in ReadAnswer
2021.06.11 16:48:30.538 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:48:37.861 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:48:47.862 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:48:47.864 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:48:50.606 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:48:52.610 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:48:54.610 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:49:02.612 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:49:12.615 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:49:12.616 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:49:14.778 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:49:16.781 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:49:18.780 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:49:26.784 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:49:36.787 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:49:36.788 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:49:38.767 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:49:40.770 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:49:42.772 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:49:50.771 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:50:00.775 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:50:00.775 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:50:04.931 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:50:06.934 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:50:08.934 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:50:16.936 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:50:26.938 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:50:26.939 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:50:30.633 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:50:32.637 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:50:34.637 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:50:42.637 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:50:52.640 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:50:52.641 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:50:57.653 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:50:59.659 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:51:01.658 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:51:09.659 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:51:19.663 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:51:19.664 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:51:19.943 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:51:21.946 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:51:23.946 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:51:31.949 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:51:41.950 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:51:41.950 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:51:44.811 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:51:46.814 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:51:48.813 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:51:56.818 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:52:06.820 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:52:06.821 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:52:08.354 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:52:10.357 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:52:12.212 3: Opening klimazaehler device 10.16.1.20:3002
2021.06.11 16:52:12.218 3: klimazaehler device opened
2021.06.11 16:52:14.222 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:52:16.221 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:52:24.224 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:52:24.225 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:52:28.311 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:52:30.313 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:52:32.314 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:52:40.318 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:52:50.357 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:52:50.358 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:52:50.660 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:52:52.664 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:52:54.664 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:53:02.663 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:53:12.664 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:53:12.665 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:53:14.826 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:53:16.829 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:53:18.829 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:53:26.832 3: klimazaehler: device didn't reply to k(eeepAlive), count=2
2021.06.11 16:53:36.836 3: klimazaehler: device didn't reply to k(eeepAlive), no retries left, setting device to disconnected
2021.06.11 16:53:36.837 3: 10.16.1.20:3002 disconnected, waiting to reappear (klimazaehler)
2021.06.11 16:53:37.894 3: 10.16.1.20:3002 reappeared (klimazaehler)
2021.06.11 16:53:39.896 3: klimazaehler: device didn't reply to k(eeepAlive), count=1
2021.06.11 16:53:41.895 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.11 16:53:41.896 1: PERL WARNING: Use of uninitialized value in string eq at ./FHEM/98_ArduCounter.pm line 477.
2021.06.11 16:53:41.897 1: PERL WARNING: Use of uninitialized value $name in concatenation (.) or string at ./FHEM/98_ArduCounter.pm line 478.
2021.06.11 16:53:49.901 3: klimazaehler: device didn't reply to k(eeepAlive), count=1


Es scheint also, als gäbe es bei Ser2net einen Konfigurationsfehler. Leider hab ich aber bisher nichts gefunden, was ser2net-konfigurationen betrifft. Kann mir da jemand von euch weiterhelfen? Ein List vom Device kann ich euch leider nicht liefern, da ich das Modul aus der Produktivumgebung wieder rausnehmen musste.
Falls sich das mit ArduCounter und ser2net nicht sinnvoll umsetzen lässt, gibt es dann alternativen?

Viele Grüße
Leon

tpm88

Hallo Leon,

Ich betreibe einen Arduino Nano mit ArduCounter seit langen stabil mit folgender ser2net Konfig:

4004:raw:0:/dev/ttyUSB_AC_water:38400 8DATABITS NONE 1STOPBIT

VG
Tobias
Test FHEM Server on RPi, CUL_HM
Prod FHEM Server on Odroid HC1, HM-USB, JeeLink
Devices: diverse HM, IT1500, 1wire, LaCrosse, MQTT

Leon_Emm

#2
Danke für die schnelle Info.

Es scheint zu funktionieren, da ich ursprünglich nach Wiki die Baudrate 115200 genommen hab, da ich nicht davon dachte, dass die im SVN vorhandene .hex datei eine Outdated version ist.
Also das Device kann jetzt geöffnet werden.

leider hab ich jetzt bei dem List:

Internals:
   Board      UNO
   BoardDet   
   DEF        10.16.1.20:3002
   DeviceName 10.16.1.20:3002
   FD         17
   FUUID      60c45d3e-f33f-9bc6-c327-1f0b9f3a709212c7
   Initialized 1
   LASTOPEN   1623482586.77503
   NAME       klimazaehler
   NOTIFYDEV  global
   NR         4294
   NTFY_ORDER 50-klimazaehler
   PARTIAL   
   STATE      opened
   SketchCompile Aug 12 2019 21:16:36
   TCP        1
   TYPE       ArduCounter
   VersionFirmware 3.34
   VersionModule 7.30 - 17.5.2020
   WaitForAlive 0
   allowedPins 3,4,5,6,7,8,9,10,11,13,14,15,16,17,18,19,20,21
   buffer     
   deviceBooted 1623482260.28936
   devioLoglevel 3
   nextOpenDelay 60
   READINGS:
     2021-06-12 09:35:12   calcCounterD5   0.0005
     2021-06-12 09:35:12   calcCounterD5_i 0
     2021-06-12 09:35:12   countDiffD5     0
     2021-06-12 09:35:12   interpolatedLongD5 1
     2021-06-12 09:35:12   longD5          1
     2021-06-12 09:35:12   pinD5           1
     2021-06-12 09:35:12   powerD5         0.000
     2021-06-12 09:35:12   rejectD5        0
     2021-06-12 09:23:06   state           opened
     2021-06-12 09:35:12   timeDiffD5      63097
   runningCfg:
     5          P5 rising min 2, R5 C0 D0/0 T0 N951927,0 X0
     I          60 300 0 0
     V          0
Attributes:
   board      UNO
   interval   60 300
   pinD5      rising pulldown
   pulsesPerKWh 2000
   pulsesPerUnit 2000
   room       Relais


Immernoch die Fehlermeldung im Log:

2021.06.12 09:22:56.191 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.12 09:23:06.775 3: Opening klimazaehler device 10.16.1.20:3002
2021.06.12 09:23:06.776 3: klimazaehler device opened
2021.06.12 09:23:10.779 3: klimazaehler: sending h(ello) to device to ask for version
2021.06.12 09:23:10.831 3: attribute board is set to UNO and is overwriting board NANO reported by device
2021.06.12 09:23:10.832 3: klimazaehler: device sent hello with outdated Arducounter Firmware (3.34) - please update!
2021.06.12 09:23:10.833 3: klimazaehler: unparseable message from device: T100 110
2021.06.12 09:23:11.832 3: klimazaehler: ConfigureDevice: send config
2021.06.12 09:23:11.833 3: klimazaehler: ConfigurePin sends old syntax to outdated firmware (3.34)
2021.06.12 09:23:11.833 3: klimazaehler: ConfigurePin creates command 5,2,1,2a
2021.06.12 09:23:11.835 3: klimazaehler: Invalid interval specification
2021.06.12 09:23:11.835 3: klimazaehler: ConfigureVerboseLevels creates command 0,0,0,0,0v
2021.06.12 09:23:11.879 3: klimazaehler: device: defined P5 falling pullup min 2
2021.06.12 09:23:11.880 3: klimazaehler: device: devVerbose set to 0
2021.06.12 09:23:11.880 3: klimazaehler: device: Status: ArduCounter V3.34 on NANO compiled Aug 12 2019 21:16:36
2021.06.12 09:23:11.881 3: klimazaehler: unparseable message from device: T100 110
2021.06.12 09:23:11.913 3: klimazaehler: device: no config in EEPROM
2021.06.12 09:23:11.914 3: klimazaehler: device: Next report in 28368 milliseconds
2021.06.12 09:25:37.997 3: klimazaehler: ConfigureIntervals creates command 60,300,0,0i
2021.06.12 09:25:38.015 3: klimazaehler: device: intervals set to 60 300 0 0
2021.06.12 09:27:46.472 3: klimazaehler: ConfigurePin sends old syntax to outdated firmware (3.34)
2021.06.12 09:27:46.472 3: klimazaehler: ConfigurePin creates command 5,3,0,2a
2021.06.12 09:27:46.490 3: klimazaehler: device: defined P5 rising min 2
2021.06.12 09:27:52.300 3: klimazaehler: ConfigurePin sends old syntax to outdated firmware (3.34)
2021.06.12 09:27:52.300 3: klimazaehler: ConfigurePin creates command 5,3,0,2a
2021.06.12 09:27:52.314 3: klimazaehler: device: defined P5 rising min 2
2021.06.12 09:33:31.993 3: klimazaehler: Sending info command to device
2021.06.12 09:33:32.016 3: klimazaehler: device: Status: ArduCounter V3.34 on NANO compiled Aug 12 2019 21:16:36
2021.06.12 09:33:32.053 3: klimazaehler: unparseable message from device: T100 110
2021.06.12 09:33:32.054 3: klimazaehler: device: no config in EEPROM
2021.06.12 09:33:32.054 3: klimazaehler: device: Next report in 40145 milliseconds


Insbesondere das "unparseable Message from Device" stört mich en bisschen.
Und nur aus konzept: die S0-Schnittstelle würde ich zwischen D5 und GND schalten in dem Fall, oder 5V?


LG
Leon

tpm88

Zuallererst würde ich mal die aktuelle ArduCounter Firmware flashen: https://svn.fhem.de/trac/browser/trunk/fhem/FHEM/firmware

Bezüglich S0:
S0+ an (zB) D5
S0- an GND

Das hier ist der Haupt-Supportthread für den AC: https://forum.fhem.de/index.php/topic,19285.0.html

Dort liest auch der Autor mit...

VG
Tobias
Test FHEM Server on RPi, CUL_HM
Prod FHEM Server on Odroid HC1, HM-USB, JeeLink
Devices: diverse HM, IT1500, 1wire, LaCrosse, MQTT