Neue Versionen und Support zum Modbus-Modul

Begonnen von StefanStrobel, 20 August 2017, 12:11:08

Vorheriges Thema - Nächstes Thema

StefanStrobel

Hallo,

hier nochmal eine neue Version.
Der Absturz wenn disable gesetzt ist sollte weg sein.
Zusätzlich gibt es die Attribute retriesAfterTimeout (gilt nur für den update-Zyklus, nicht für get/set)
und enableQueueLengthReading.

Beim Parsen / den expr-Attributen hat sich auch etwas geändert: der Wert steht nun nicht mehr nur als $val sondern auch als @val zur Verfügung. @val enthält mehrere Werte falls der unpack-Code mehrere Listenelemente erzeugt (z.B. 'ss'), was sinnvoll sein kann, wenn man mit einem Request zwei Register als ein Objekt lesen möchte und diese dann in der expr wieder zerlegen und danach zusammenrechnen möchte.

Gruss
   Stefan

pejonp

Hallo Stefan,

wie kann ich diese Register auslesen ? siehe auch hier (https://forum.fhem.de/index.php/topic,80767.msg846354.html#msg846354).
Wie komme ich zum String. unpack/pack irgendwas ?!

scan-h00004  => SolarEdge
scan-h00020  => SE5K
scan-h00044 ...
scan-h00052 ...


2018-10-16 00:39:07   scan-h00001     hex=6e53, string=nS, s=21358, s>=28243, S=21358, S>=28243
     2018-10-16 00:39:07   scan-h00002     hex=0001, string=.., s=256, s>=1, S=256, S>=1
     2018-10-16 00:39:07   scan-h00003     hex=0041, string=.A, s=16640, s>=65, S=16640, S>=65
     2018-10-16 00:39:07   scan-h00004     hex=536f, string=So, s=28499, s>=21359, S=28499, S>=21359
     2018-10-16 00:39:07   scan-h00005     hex=6c61, string=la, s=24940, s>=27745, S=24940, S>=27745
     2018-10-16 00:39:07   scan-h00006     hex=7245, string=rE, s=17778, s>=29253, S=17778, S>=29253
     2018-10-16 00:39:07   scan-h00007     hex=6467, string=dg, s=26468, s>=25703, S=26468, S>=25703
     2018-10-16 00:39:07   scan-h00008     hex=6520, string=e., s=8293, s>=25888, S=8293, S>=25888
     2018-10-16 00:39:07   scan-h00009     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00010     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00011     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00012     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00013     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00014     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00015     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00016     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00017     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00018     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00019     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00020     hex=5345, string=SE, s=17747, s>=21317, S=17747, S>=21317
     2018-10-16 00:39:07   scan-h00021     hex=354b, string=5K, s=19253, s>=13643, S=19253, S>=13643
     2018-10-16 00:39:07   scan-h00022     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00023     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00024     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00025     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00026     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00027     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00028     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00029     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00030     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00031     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00032     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00033     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00034     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00035     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00036     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00037     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00038     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00039     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00040     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00041     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00042     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00043     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00044     hex=3030, string=00, s=12336, s>=12336, S=12336, S>=12336
     2018-10-16 00:39:07   scan-h00045     hex=3032, string=02, s=12848, s>=12338, S=12848, S>=12338
     2018-10-16 00:39:07   scan-h00046     hex=2e31, string=.1, s=12590, s>=11825, S=12590, S>=11825
     2018-10-16 00:39:07   scan-h00047     hex=3035, string=05, s=13616, s>=12341, S=13616, S>=12341
     2018-10-16 00:39:07   scan-h00048     hex=3300, string=3., s=51, s>=13056, S=51, S>=13056
     2018-10-16 00:39:07   scan-h00049     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:07   scan-h00050     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00051     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00052     hex=3745, string=7E, s=17719, s>=14149, S=17719, S>=14149
     2018-10-16 00:39:00   scan-h00053     hex=3138, string=18, s=14385, s>=12600, S=14385, S>=12600
     2018-10-16 00:39:00   scan-h00054     hex=3230, string=20, s=12338, s>=12848, S=12338, S>=12848
     2018-10-16 00:39:00   scan-h00055     hex=4541, string=EA, s=16709, s>=17729, S=16709, S>=17729
     2018-10-16 00:39:00   scan-h00056     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00057     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00058     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00059     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00060     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00061     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00062     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00063     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00064     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00065     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00066     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00067     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00068     hex=0003, string=.., s=768, s>=3, S=768, S>=3
     2018-10-16 00:39:00   scan-h00069     hex=0067, string=.g, s=26368, s>=103, S=26368, S>=103
     2018-10-16 00:39:00   scan-h00070     hex=0032, string=.2, s=12800, s>=50, S=12800, S>=50
     2018-10-16 00:39:00   scan-h00071     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00072     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00073     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00074     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00075     hex=fffe, string=.., s=-257, s>=-2, S=65279, S>=65534
     2018-10-16 00:39:00   scan-h00076     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00077     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00078     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00079     hex=00ec, string=.., s=-5120, s>=236, S=60416, S>=236
     2018-10-16 00:39:00   scan-h00080     hex=00ed, string=.., s=-4864, s>=237, S=60672, S>=237
     2018-10-16 00:39:00   scan-h00081     hex=00ec, string=.., s=-5120, s>=236, S=60416, S>=236
     2018-10-16 00:39:00   scan-h00082     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00083     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00084     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00085     hex=138a, string=.., s=-30189, s>=5002, S=35347, S>=5002
     2018-10-16 00:39:00   scan-h00086     hex=fffe, string=.., s=-257, s>=-2, S=65279, S>=65534
     2018-10-16 00:39:00   scan-h00087     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00088     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00089     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00090     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00091     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00092     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00093     hex=0112, string=.., s=4609, s>=274, S=4609, S>=274
     2018-10-16 00:39:00   scan-h00094     hex=0408, string=.., s=2052, s>=1032, S=2052, S>=1032
     2018-10-16 00:39:00   scan-h00095     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00096     hex=ffff, string=.., s=-1, s>=-1, S=65535, S>=65535
     2018-10-16 00:39:00   scan-h00097     hex=8000, string=.., s=128, s>=-32768, S=128, S>=32768
     2018-10-16 00:39:00   scan-h00098     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00099     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:00   scan-h00100     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:06   scan-h00101     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:06   scan-h00102     hex=8000, string=.., s=128, s>=-32768, S=128, S>=32768
     2018-10-16 00:39:06   scan-h00103     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:06   scan-h00104     hex=8000, string=.., s=128, s>=-32768, S=128, S>=32768
     2018-10-16 00:39:06   scan-h00105     hex=8000, string=.., s=128, s>=-32768, S=128, S>=32768
     2018-10-16 00:39:06   scan-h00106     hex=fffe, string=.., s=-257, s>=-2, S=65279, S>=65534
     2018-10-16 00:39:06   scan-h00107     hex=0002, string=.., s=512, s>=2, S=512, S>=2
     2018-10-16 00:39:06   scan-h00108     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:39:06   scan-h00109     hex=ffff, string=.., s=-1, s>=-1, S=65535, S>=65535
     2018-10-16 00:39:06   scan-h00110     hex=ffff, string=.., s=-1, s>=-1, S=65535, S>=65535
     2018-10-16 00:39:06   scan-h00111     hex=ffff, string=.., s=-1, s>=-1, S=65535, S>=65535
     2018-10-16 00:39:06   scan-h00112     hex=ffff, string=.., s=-1, s>=-1, S=65535, S>=65535
     2018-10-16 00:39:06   scan-h00113     hex=ffff, string=.., s=-1, s>=-1, S=65535, S>=65535
     2018-10-16 00:39:06   scan-h00114     hex=ffff, string=.., s=-1, s>=-1, S=65535, S>=65535
     2018-10-16 00:39:06   scan-h00115     hex=ffff, string=.., s=-1, s>=-1, S=65535, S>=65535
     2018-10-16 00:39:06   scan-h00116     hex=ffff, string=.., s=-1, s>=-1, S=65535, S>=65535
     2018-10-16 00:39:06   scan-h00117     hex=ffff, string=.., s=-1, s>=-1, S=65535, S>=65535
     2018-10-16 00:39:06   scan-h00118     hex=ffff, string=.., s=-1, s>=-1, S=65535, S>=65535
     2018-10-16 00:39:12   scan-h00119     hex=ffff, string=.., s=-1, s>=-1, S=65535, S>=65535
     2018-10-16 00:39:14   scan-h00120     hex=ffff, string=.., s=-1, s>=-1, S=65535, S>=65535
     2018-10-16 00:39:16   scan-h00121     hex=ffff, string=.., s=-1, s>=-1, S=65535, S>=65535
     2018-10-16 00:39:19   scan-h00122     hex=0000, string=.., s=0, s>=0, S=0, S>=0
     2018-10-16 00:30:00   scanId-3-Response-h100 0


Vielen Dank.
Jörg
LaCrossGW 868MHz:WT470+TFA+TX37-IT+EMT7110+W136+WH25A HP1003+WH2621
SignalD(CC1101):Bresser+WS-0101(868MHz WH1080)+Velux KLF200+MAX!+HM-MOD-UART:Smoke HM-SEC-SD+VITOSOLIC 200 RESOL VBUS-LAN+SolarEdge SE5K(Modbus)+Sonnen!eco8(10kWh)+TD3511+DRT710M(Modbus)+ZigBee+Z-Wave+MQTT+vitoconnect

StefanStrobel

#137
Hallo Jörg,

Um Strings aus mehreren Registern auszulesen bietet sich der Unpack-Code a* an.
Als Länge gibst Du die Anzahl der Register an.
Bei Bedarf decode/encode, aber Umlaute sind in Deinem Beispiel vermutlich kein Thema.
Eine Expression, in der nur $val drinsteht ist übrigens völlig ünerflüsssig.

Ergänzung: ich würde je auch noch die Register, zu denen es einen Scale-Faktor im darauf folgenden Register gibt, in einem gemeinsamen Reading lesen, wie ich es im SolarEdge-Thread geschrieben habe.

Gruß
    Stefan

Benni

#138
Zitat von: pejonp am 16 Oktober 2018, 00:48:54
wie kann ich diese Register auslesen ? siehe auch hier (https://forum.fhem.de/index.php/topic,80767.msg846354.html#msg846354).
Wie komme ich zum String. unpack/pack irgendwas ?!

scan-h00004  => SolarEdge
scan-h00020  => SE5K
scan-h00044 ...
scan-h00052 ...

Guckst du auch hier: https://wiki.fhem.de/wiki/SolarEdge_SE10k#SunSpec_.28SolarEdge.29  ;)

gb#

pejonp

#139
Hallo,

Das mit dem (a4) .... (a16) habe ich ja versucht aber leider ohne Ergebnis werde es aber bei Gelegenheit noch einmal probieren.

Beim register h0000 benutzt ich (a4) dabei wird der String rückwärts dargestellt.->nSSu richtig ist: SunS

Pejonp
LaCrossGW 868MHz:WT470+TFA+TX37-IT+EMT7110+W136+WH25A HP1003+WH2621
SignalD(CC1101):Bresser+WS-0101(868MHz WH1080)+Velux KLF200+MAX!+HM-MOD-UART:Smoke HM-SEC-SD+VITOSOLIC 200 RESOL VBUS-LAN+SolarEdge SE5K(Modbus)+Sonnen!eco8(10kWh)+TD3511+DRT710M(Modbus)+ZigBee+Z-Wave+MQTT+vitoconnect

StefanStrobel

Hallo,

für solche Fälle ist revRegs da :-)
Damit wird die Reihenfolge der Register umgedreht.

Gruss
   Stefan

pejonp

Hallo Stefan,

vielen Dank. aber ich stehe trotzem noch auf dem Schlauch. Wie rufe ich es auf ?  (4a) ?

Mit dem saveAsModule hat geklappt. Da muss ich nur noch etwas anpassen.

Jörg
LaCrossGW 868MHz:WT470+TFA+TX37-IT+EMT7110+W136+WH25A HP1003+WH2621
SignalD(CC1101):Bresser+WS-0101(868MHz WH1080)+Velux KLF200+MAX!+HM-MOD-UART:Smoke HM-SEC-SD+VITOSOLIC 200 RESOL VBUS-LAN+SolarEdge SE5K(Modbus)+Sonnen!eco8(10kWh)+TD3511+DRT710M(Modbus)+ZigBee+Z-Wave+MQTT+vitoconnect

StefanStrobel

Hallo,

ich habe bei meiner Wärmepumpe für mehrere Strings einen Datentyp definiert und die Konfiguration dadurch vereinfacht:


attr WP dev-type-VT_String-decode cp850
attr WP dev-type-VT_String-encode utf8
attr WP dev-type-VT_String-expr $val =~ s/[\00]+//gr
attr WP dev-type-VT_String-len 8
attr WP dev-type-VT_String-revRegs 0
attr WP dev-type-VT_String-unpack a*


definiert den Typ VT_String mit Länge 8 (bei Dir wäre das 2), setzt a* (wirklich mit Stern) als unpack-Code, Konvertierung der Sonderzeichen (bei Dir vermutlich unnötig). revRegs 0 (wenn die Reihenfolge der Register umgedreht werden soll, dann auf 1 setzen) und eine Expr um 0-Bytes am Ende des Strings zu entfernen.

für das jeweilige Objekt reicht dann ein


attr WP obj-h4689-reading FirmwareVersion
attr WP obj-h4689-type VT_String

attr WP obj-h4817-reading FirmwareDate
attr WP obj-h4817-type VT_String


Die Alternative ist es ohne Datentyp direkt zu konfigurieren, dann muss man das allerdings bei jedem Objekt einzeln angeben:

attr SP obj-h40000-reading C_SunSpec_ID
attr SP obj-h40000-len 4
attr SP obj-h40000-unpack a4


bei Bedarf noch


attr SP obj-h40000-revRegs 1


das a4 oder a* kann man in Klammern setzen, muss man aber nicht.

Gruss
   Stefan


pejonp

Hallo Stefan,

vielen Dank, hat geklappt.
Jörg
LaCrossGW 868MHz:WT470+TFA+TX37-IT+EMT7110+W136+WH25A HP1003+WH2621
SignalD(CC1101):Bresser+WS-0101(868MHz WH1080)+Velux KLF200+MAX!+HM-MOD-UART:Smoke HM-SEC-SD+VITOSOLIC 200 RESOL VBUS-LAN+SolarEdge SE5K(Modbus)+Sonnen!eco8(10kWh)+TD3511+DRT710M(Modbus)+ZigBee+Z-Wave+MQTT+vitoconnect

StefanStrobel

Hier nochmal ein kleines Update mit Bugfix.
Wenn die Verbindung verloren wurde, wird auch der update-Timer gestoppt. In der vorigen Version ist er dann beim reconnect nicht mehr gestartet worden. Das ist jetzt behoben.

Gruss
   Stefan

kingmathers

#145
Vielen Dank fürs Update! Habe es eingespielt und werde berichten, ob die Verbindungsabbrüche damit weiterhin auftreten.

Edit: Habe jetzt seit 2 Tagen keine Probleme mehr.
Raspberry Pi B+, FS20, 1-Wire, HM
FHEM Home Control (App für Windows 10): https://forum.fhem.de/index.php/topic,49891.0.html
FHEM Arduino Library: https://forum.fhem.de/index.php/topic,94093.0.html

predi-ger-many

Hallo,

ich habe eine Heizung, welche ModbusTCP Master kann.

Aktuell habe ich das ModbusTCP-CC Modul im Einsatz. Funktioniert. Würde aber gern umstellen auf ModbusAttr.

Definition mit ModbusTCP_CC

Zitat
define ModbusTCP_Server ModbusTCP_CC 1502
attr ModbusTCP_Server alias ModbusTCP Server
attr ModbusTCP_Server group IO Devices

define ModbusTCP_10_40001 dummy
attr ModbusTCP_10_40001 alias ModbusTCP_10_40001 - Wohnzimmer Temp Soll
attr ModbusTCP_10_40001 comment MBR:10,1,H
attr ModbusTCP_10_40001 group ModbusTCP - Device 10 - Holding Registers

define ModbusTCP_10_40002 dummy
attr ModbusTCP_10_40002 alias ModbusTCP_10_40002 - Wohnzimmer Temp Ist
attr ModbusTCP_10_40002 comment MBR:10,2,H
attr ModbusTCP_10_40002 group ModbusTCP - Device 10 - Holding Registers

Das funktioniert.

Config mit ModbusAttr V1

Zitat
define MB_Heizung  ModbusAttr 10 slave global:1505 TCP

attr MB_Heizung room Heizanlage Modbus Neu

attr MB_Heizung obj-h40001-reading MY_40001
attr MB_Heizung obj-h40002-reading MY_40002

Config mit ModbusAttr V2

Zitat
define MB_Heizung  ModbusAttr 10 slave global:1502 TCP

attr MB_Heizung room Heizanlage Modbus Neu

attr MB_Heizung obj-h1-reading MY_40001
attr MB_Heizung obj-h2-reading MY_40002

Wenn ich mit dem Radzio Modusbus Simulator auf die alte Implementation verbinde... alles okay.
Wenn ich auf die neue Implemation verbinde... Error... egal ob v1 oder v2
An den Ports liegt es nicht... habe mal testweise getauscht. Slave ID habe ich auch mehrere ausprobiert

Hab ich nen Blackout? Muss ich noch was anderes konfigurieren, dass zumindest mal der Connect funktioniert?



StefanStrobel

Hallo  predi-ger-many,

bitte setze doch mal verbose auf 5 und poste den Auszug aus dem Log vom Beginn des Requests bis zum Fehler, damit ich sehen kann, was genau passiert / was für ein Fehler in welchem Zustand auftritt.

Gruss / Thanx
   Stefan

predi-ger-many

#148
Zitat
attr global verbose 5

define MB_SLAVE_51 ModbusAttr 51 slave global:1551 TCP
attr MB_SLAVE_51 room Heizanlage Modbus Neu
attr MB_SLAVE_51 obj-h1-reading MY_51_1
attr MB_SLAVE_51 obj-h2-reading MY_51_2
define MB_SLAVE_51_FileLog FileLog ./log/MB_SLAVE_51-%Y.log MB_SLAVE_51

define MB_SLAVE_52 ModbusAttr 52 slave global:1552 TCP
attr MB_SLAVE_52 room Heizanlage Modbus Neu
attr MB_SLAVE_52 obj-h40001-reading MY_52_1
attr MB_SLAVE_52 obj-h40002-reading MY_52_2
define MB_SLAVE_52_FileLog FileLog ./log/MB_SLAVE_52-%Y.log MB_SLAVE_52

... zwei Slaves, da ich nicht weiß, ob obj-h1 oder obj-h40001 richtig ist.

Die Logs...

Zitat
2018-10-31_19:28:03 MB_SLAVE_51 opened

Zitat
2018-10-31_19:28:03 MB_SLAVE_52 opened

Der Radzio Simulator sagt immer Timeout. Kein Connect. Ich würde sagen, dass der Slave gar nicht gestartet wird.

Gleiches Ergebnis, wenn ich global:port durch IP:port ersetze

FHEM Log
Zitat
2018.10.31 19:40:19 4: Connection accepted from MB_SLAVE_51_192.168.1.224_51688
2018.10.31 19:40:19 4: MB_SLAVE_51: HandleServerConnection accepted new TCP connection as device MB_SLAVE_51_192.168.1.224_51688
2018.10.31 19:40:19 5: Starting notify loop for global, 1 event(s), first is DEFINED MB_SLAVE_51_192.168.1.224_51688
2018.10.31 19:40:19 5: End notify loop for global
2018.10.31 19:40:19 5: Starting notify loop for global, 1 event(s), first is ATTR MB_SLAVE_51_192.168.1.224_51688 room Connections
2018.10.31 19:40:19 5: End notify loop for global
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: read buffer: 000000000006330300000002
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: ParseFrameStart (TCP) extracted id 51, fCode 3, dlen 6 and data 00000002
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: HandleRequest called from Read
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: ParseRequest called from HandleRequest
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: HandleRequest, request: id 51, fCode 3, type h, len 2, Current read buffer: 000000000006330300000002, Id 51, fCode 3
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: CreateResponse called from HandleRequest
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: PackObj called from CreateResponse with h 0 and valuesLen 2
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: PackObj doesn't have reading or expr information for h0
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: PackObj packed 0 with pack code n to 0000
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: PackObj padded / cut object to 0000
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: PackObj moves to next object, skip 1 to h1, counter=1
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: PackObj ObjInfo for h1: reading=MY_51_1, expr=, format=, len=1, map=, unpack=n
2018.10.31 19:40:19 4: MB_SLAVE_51_192.168.1.224_51688: PackObj for h1 is using reading MY_51_1 of device MB_SLAVE_51_192.168.1.224_51688 with value
2018.10.31 19:40:19 1: PERL WARNING: Argument "" isn't numeric in pack at ./FHEM/98_Modbus.pm line 3256.
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: PackObj packed  with pack code n to 0000
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: PackObj padded / cut object to 0000
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: PackObj counter reached 2
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: PackObj full data string is 00000000
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: PackObj padded / cut data to 00000000
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: prepare response pdu
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: PackFrame called from CreateResponse id 51, pdu 8302
2018.10.31 19:40:19 1: PERL WARNING: Use of uninitialized value $tid in pack at ./FHEM/98_Modbus.pm line 3395.
2018.10.31 19:40:19 4: MB_SLAVE_51_192.168.1.224_51688: CreateResponse sends fc 3 to id 51, for h 0, len 2, device MB_SLAVE_51_192.168.1.224_51688 (TCP), pdu 8302, V 4.0.13 - 26.10.2018
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: Send 000000000003338302
2018.10.31 19:40:19 4: MB_SLAVE_51_192.168.1.224_51688: RequestDone, request: id 51, fCode 3, type h, len 2 for device MB_SLAVE_51_192.168.1.224_51688, Current read buffer: 000000000006330300000002, Id 51, fCode 3, response: id 51, fCode 3, type h, len 2, value 00000000
2018.10.31 19:40:19 5: MB_SLAVE_51_192.168.1.224_51688: DropFrame - drop 000000000006330300000002

98_Modbus.pm und 98_Modbus.pm die letzten Versionen hier aus dem Thread

StefanStrobel

Hallo,

Im Log sieht man, dass ein function code 3 Request für id 51, holding register 0 mit Länge 2 eingeht.
Da für Regster 0 kein Objekt definiert ist, nur für Register 1, erzeugt das Modul eine Error-Response mit Fehlercode 2. (PDU 8302).

Gruß
    Stefan