Neue Versionen und Support zum Modbus-Modul

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

Vorheriges Thema - Nächstes Thema

StefanStrobel

Hallo Roger,

aus irgendeinem Grund ignoriert er bei Dir die PDULEXP.
Probier es doch bitte nochmal mit der angehängten Version - da habe ich ein paar Logs aktiviert.
Zudem noch die aktuelle utils-Datei - evt. hast Du da eine andere. die gehört in lib/FHEM/HTTPMOD.

Gruss
   Stefan

eldrik

Zitat von: hasenhirn am 23 Oktober 2021, 12:11:18
Hallo und guten Morgen :-)

als erstes einmal danke an Stefan für das tolle Modbus-Modul und den super Support!!!

Nun zu meinem "Problem":
Nach einem Firmwareupdate kann meine Keba-Wallbox Modbus  ;D

Ich habe mich jetzt mal an die Umsetzung gemacht und dank dem Wiki, den Beiträgen und dem Forum bin ich ( wie ich finde ) schon ganz gut voran gekommen. An einer Stelle hakt es aber und da bräuchte ich einen guten Tipp.
Bei der Adresse 5014 - Enable/Disable charging station steht 0: Disable charging station und 1: Enable charging station.
Leider ist das der Punkt an dem ich nicht weiter komme. Die Wallbox läuft immer durch und ich bekomme den Ladevorgang nicht unterbrochen  >:(
Alle anderen Funktionen sind ok und bringen die Werte die ich erwarte.
Als Konfiguration habe ich schon obj-h05014-reading und obj-c05014-reading versucht wobei bei obj-c05014-reading die Fehlermeldung "Timeout in Readanswer" kommt.
Hier mal eine paar Informationen über meine Konfiguration und die Logeinträge.

defmod Keba_Stellplatz ModbusAttr 1 10 192.168.1.22:502 TCP
attr Keba_Stellplatz dev-h-defPoll 1
attr Keba_Stellplatz event-min-interval .*:60
attr Keba_Stellplatz event-on-change-reading .*
attr Keba_Stellplatz obj-h01000-len 2
attr Keba_Stellplatz obj-h01000-map 0:booting, 1:not ready for charging, 2:ready for chargin, 3:charging, 4:error, 5:charging process interrupted
attr Keba_Stellplatz obj-h01000-reading Chargingstate
attr Keba_Stellplatz obj-h01000-unpack N
attr Keba_Stellplatz obj-h01004-len 2
attr Keba_Stellplatz obj-h01004-map 0:no cable is plugged, 1:Cable is connected to charging station, 3:Cabel is connected to the charging station and locked, 5:Cable is connected to the charging station and the EV, 7:Cable is connected to the charging station and the EV an locked
attr Keba_Stellplatz obj-h01004-reading Cablestate
attr Keba_Stellplatz obj-h01004-unpack N
attr Keba_Stellplatz obj-h01006-len 2
attr Keba_Stellplatz obj-h01006-map 0:No error
attr Keba_Stellplatz obj-h01006-reading Error_code
attr Keba_Stellplatz obj-h01006-unpack N
attr Keba_Stellplatz obj-h01008-expr $val / 1000
attr Keba_Stellplatz obj-h01008-format %.3f A
attr Keba_Stellplatz obj-h01008-len 2
attr Keba_Stellplatz obj-h01008-reading Charging_current_phase_1
attr Keba_Stellplatz obj-h01008-unpack N
attr Keba_Stellplatz obj-h01010-expr $val / 1000
attr Keba_Stellplatz obj-h01010-format %.3f A
attr Keba_Stellplatz obj-h01010-len 2
attr Keba_Stellplatz obj-h01010-reading Charging_current_phase_2
attr Keba_Stellplatz obj-h01010-unpack N
attr Keba_Stellplatz obj-h01012-expr $val / 1000
attr Keba_Stellplatz obj-h01012-format %.3f A
attr Keba_Stellplatz obj-h01012-len 2
attr Keba_Stellplatz obj-h01012-reading Charging_current_phase_3
attr Keba_Stellplatz obj-h01012-unpack N
attr Keba_Stellplatz obj-h01014-len 2
attr Keba_Stellplatz obj-h01014-reading Serialnumber
attr Keba_Stellplatz obj-h01014-unpack N
attr Keba_Stellplatz obj-h01016-len 2
attr Keba_Stellplatz obj-h01016-reading Producttype
attr Keba_Stellplatz obj-h01016-unpack N
attr Keba_Stellplatz obj-h01018-len 2
attr Keba_Stellplatz obj-h01018-reading Firmwareversion
attr Keba_Stellplatz obj-h01018-unpack N
attr Keba_Stellplatz obj-h01020-expr $val / 1000
attr Keba_Stellplatz obj-h01020-format %.3f W
attr Keba_Stellplatz obj-h01020-len 2
attr Keba_Stellplatz obj-h01020-reading Active_power
attr Keba_Stellplatz obj-h01020-unpack N
attr Keba_Stellplatz obj-h01036-expr $val / 1000
attr Keba_Stellplatz obj-h01036-format %.3f kWh
attr Keba_Stellplatz obj-h01036-len 2
attr Keba_Stellplatz obj-h01036-reading Total_energy
attr Keba_Stellplatz obj-h01036-unpack N
attr Keba_Stellplatz obj-h01040-format %.1f V
attr Keba_Stellplatz obj-h01040-len 2
attr Keba_Stellplatz obj-h01040-reading Voltage_phase_1
attr Keba_Stellplatz obj-h01040-unpack N
attr Keba_Stellplatz obj-h01042-format %.1f V
attr Keba_Stellplatz obj-h01042-len 2
attr Keba_Stellplatz obj-h01042-reading Voltage_phase_2
attr Keba_Stellplatz obj-h01042-unpack N
attr Keba_Stellplatz obj-h01044-format %.1f V
attr Keba_Stellplatz obj-h01044-len 2
attr Keba_Stellplatz obj-h01044-reading Voltage_phase_3
attr Keba_Stellplatz obj-h01044-unpack N
attr Keba_Stellplatz obj-h01046-expr $val / 10
attr Keba_Stellplatz obj-h01046-format %.1f %
attr Keba_Stellplatz obj-h01046-len 2
attr Keba_Stellplatz obj-h01046-reading Powerfactor
attr Keba_Stellplatz obj-h01046-unpack N
attr Keba_Stellplatz obj-h01100-expr $val / 1000
attr Keba_Stellplatz obj-h01100-format %d A
attr Keba_Stellplatz obj-h01100-len 2
attr Keba_Stellplatz obj-h01100-reading Max_charging_current
attr Keba_Stellplatz obj-h01100-unpack N
attr Keba_Stellplatz obj-h01110-expr $val / 1000
attr Keba_Stellplatz obj-h01110-format %d A
attr Keba_Stellplatz obj-h01110-len 2
attr Keba_Stellplatz obj-h01110-reading Max_supported_current
attr Keba_Stellplatz obj-h01110-unpack N
attr Keba_Stellplatz obj-h05004-expr $val / 1000
attr Keba_Stellplatz obj-h05004-format %.3f A
attr Keba_Stellplatz obj-h05004-max 63
attr Keba_Stellplatz obj-h05004-min 6
attr Keba_Stellplatz obj-h05004-reading Set_charging_current
attr Keba_Stellplatz obj-h05004-set 1
attr Keba_Stellplatz obj-h05004-setexpr $val * 1000
attr Keba_Stellplatz obj-h05010-reading Set_energy
attr Keba_Stellplatz obj-h05010-set 1
attr Keba_Stellplatz obj-h05010-unpack N
attr Keba_Stellplatz obj-h05012-reading Unlock_plug
attr Keba_Stellplatz obj-h05012-set 1
attr Keba_Stellplatz obj-h05014-reading Enable/Disable_charging_station
attr Keba_Stellplatz obj-h05014-set 1
attr Keba_Stellplatz verbose 5

setstate Keba_Stellplatz opened
setstate Keba_Stellplatz 2021-10-23 11:58:57 Active_power 4205.857 W
setstate Keba_Stellplatz 2021-10-23 11:58:56 Cablestate Cable is connected to the charging station and the EV an locked
setstate Keba_Stellplatz 2021-10-23 11:58:56 Charging_current_phase_1 6.107 A
setstate Keba_Stellplatz 2021-10-23 11:58:56 Charging_current_phase_2 6.112 A
setstate Keba_Stellplatz 2021-10-23 11:58:56 Charging_current_phase_3 6.115 A
setstate Keba_Stellplatz 2021-10-23 11:58:56 Chargingstate charging
setstate Keba_Stellplatz 2021-10-23 11:58:44 Enable/Disable_charging_station 0
setstate Keba_Stellplatz 2021-10-23 11:58:56 Error_code No error
setstate Keba_Stellplatz 2021-10-23 11:58:57 Firmwareversion 50993920
setstate Keba_Stellplatz 2021-10-23 11:58:58 Max_charging_current 6 A
setstate Keba_Stellplatz 2021-10-23 11:58:58 Max_supported_current 16 A
setstate Keba_Stellplatz 2021-10-23 11:58:58 Powerfactor 99.5 %
setstate Keba_Stellplatz 2021-10-23 11:58:57 Producttype 314121
setstate Keba_Stellplatz 2021-10-23 11:58:57 Serialnumber 22218033
setstate Keba_Stellplatz 2021-10-23 11:54:48 Set_charging_current 6.000 A
setstate Keba_Stellplatz 2021-10-23 11:58:57 Total_energy 1127.018 kWh
setstate Keba_Stellplatz 2021-10-23 11:58:57 Voltage_phase_1 229.0 V
setstate Keba_Stellplatz 2021-10-23 11:58:57 Voltage_phase_2 230.0 V
setstate Keba_Stellplatz 2021-10-23 11:58:57 Voltage_phase_3 230.0 V
setstate Keba_Stellplatz 2021-10-23 11:56:14 state opened


Hier gibt es die Programmieranleitung zur Keba-Wallbox:
https://www.keba.com/download/x/dea7ae6b84/kecontactp30modbustcp_pgen.pdf

Ich hoffe mit den Informationen kann mir jemand weiter helfen  :)

LG

Thomas

da ich mich, für meine Modbus TCP Integration meiner Keba P30 Deutschland Edition, bei diesem Codebeispiel bedient hatte, hier eine Ergänzung, dass Anfang dieses Jahres eine neue Firmware herausgekommen ist, mit der sich über das X2 Interface der Box ein Phasenumschalter (von Keba, S10, kann man aber auch genauso gut nachbauen) bedienen lässt was in Kombination mit solaren Überschuss, für den ein oder anderen Interessant sein könnte.

Folgende Attribute braucht es zusätzlich:

attr Keba_Stellplatz obj-h01550-len 2
attr Keba_Stellplatz obj-h01550-map 0:disabled, 1:OCPP, 2:REST, 3:Modbus TCP, 4:UDP
attr Keba_Stellplatz obj-h01550-reading Phase_switching_source
attr Keba_Stellplatz obj-h01550-unpack N
attr Keba_Stellplatz obj-h01552-len 2
attr Keba_Stellplatz obj-h01552-map 0:1Phasig, 1:3Phasig
attr Keba_Stellplatz obj-h01552-reading Phase_switching_state
attr Keba_Stellplatz obj-h01552-unpack N
attr Keba_Stellplatz obj-h05050-reading Set_phase_switch_toggle
attr Keba_Stellplatz obj-h05050-set 1
attr Keba_Stellplatz obj-h05052-reading Trigger_phase_switch
attr Keba_Stellplatz obj-h05052-set 1


Greetz
Eldrik

Roger

#1097
Zitat von: StefanStrobel am 17 Februar 2023, 10:20:46
Hallo Roger,
aus irgendeinem Grund ignoriert er bei Dir die PDULEXP.
Probier es doch bitte nochmal mit der angehängten Version - da habe ich ein paar Logs aktiviert.
Zudem noch die aktuelle utils-Datei - evt. hast Du da eine andere. die gehört in lib/FHEM/HTTPMOD.
Gruss Stefan

Hi Stefan,
utils-Datei nach lib/FHEM/HTTPMOD kopiert.
Ist aber nicht besser geworden.  :(

Hier das Log:

2023.02.17 16:27:47.325 3: HA_PZEM_B1: attr dev-fc66Request-unpack none set
2023.02.17 16:27:47.353 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 dev-fc66Request-unpack none
2023.02.17 16:27:47.364 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A
2023.02.17 16:27:47.364 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.17 16:27:47.385 3: HA_PZEM_B1: attr dev-fc66Response-unpack none set
2023.02.17 16:27:47.411 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 dev-fc66Response-unpack none
2023.02.17 16:27:47.420 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A
2023.02.17 16:27:47.421 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.17 16:27:47.442 3: HA_PZEM_B1: attr dev-fc66Response-fieldExpr-PDULEXP 1 set
2023.02.17 16:27:47.468 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 dev-fc66Response-fieldExpr-PDULEXP 1
2023.02.17 16:27:47.477 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A
2023.02.17 16:27:47.478 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.17 16:27:47.485 3: HA_PZEM_B1: attr obj-h9042-reading Reset set
2023.02.17 16:27:47.511 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 obj-h9042-reading Reset
2023.02.17 16:27:47.520 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A
2023.02.17 16:27:47.521 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.17 16:27:47.532 3: HA_PZEM_B1: attr obj-h9042-set 1 set
2023.02.17 16:27:47.557 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 obj-h9042-set 1
2023.02.17 16:27:47.567 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.17 16:27:47.568 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.17 16:27:47.582 3: HA_PZEM_B1: attr obj-h9042-overrideFCwrite 66 set
2023.02.17 16:27:47.608 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 obj-h9042-overrideFCwrite 66
2023.02.17 16:27:47.617 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.17 16:27:47.618 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.17 16:27:47.635 3: HA_PZEM_B1: attr dev-fc194Response-unpack none set
2023.02.17 16:27:47.661 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 dev-fc194Response-unpack none
2023.02.17 16:27:47.670 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.17 16:27:47.671 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.17 16:27:47.691 3: HA_PZEM_B1: attr dev-fc194Response-fieldExpr-PDULEXP 1 set
2023.02.17 16:27:47.718 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 dev-fc194Response-fieldExpr-PDULEXP 1
2023.02.17 16:27:47.727 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.17 16:27:47.728 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.17 16:27:47.736 3: HA_PZEM_B1: attr obj-h9194-reading Reset_Fehler set
2023.02.17 16:27:47.761 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 obj-h9194-reading Reset_Fehler
2023.02.17 16:27:47.771 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.17 16:27:47.772 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.17 16:27:47.786 3: HA_PZEM_B1: attr obj-h9194-overrideFCread 194 set
2023.02.17 16:27:47.812 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 obj-h9194-overrideFCread 194
2023.02.17 16:27:47.822 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.17 16:27:47.823 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.17 16:27:57.774 4: HA_PZEM_B1: set called with Reset (h9042) setVal = 1
2023.02.17 16:27:57.775 5: HA_PZEM_B1: GetSetChecks with force
2023.02.17 16:27:57.775 5: HA_PZEM_B1: GetSetChecks returns success
2023.02.17 16:27:57.778 5: HA_PZEM_B1: set packed hex 31 with n to hex 0001
2023.02.17 16:27:57.780 4: HA_PZEM_B1: DoRequest called from SetLDFn created new request, read buffer empty,
request: id 1, write fc 66 h9042, len 1, value 0001, master device HA_PZEM_B1, reading Reset (set Reset)
2023.02.17 16:27:57.781 5: HA_Modbus_1: QueueRequest called from DoRequest with h9042, qlen 0 from master HA_PZEM_B1 through io device HA_Modbus_1
2023.02.17 16:27:57.782 5: HA_Modbus_1: ProcessRequestQueue called from QueueRequest as direct:HA_Modbus_1, qlen 1, force, request: request: id 1, write fc 66 h9042, len 1, value 0001, master device HA_PZEM_B1, reading Reset (set Reset), queued 0.00 secs ago
2023.02.17 16:27:57.783 5: HA_Modbus_1: checkDelays clientSwitchDelay is not relevant
2023.02.17 16:27:57.783 5: HA_Modbus_1: checkDelays busDelayRead, last activity on bus was 71.045 secs ago, required delay is 1
2023.02.17 16:27:57.784 5: HA_Modbus_1: checkDelays sendDelay, last send to same device was 71.118 secs ago, required delay is 0.1
2023.02.17 16:27:57.784 5: HA_Modbus_1: checkDelays commDelay, last communication with same device was 71.043 secs ago, required delay is 0.1
2023.02.17 16:27:57.785 3: HA_Modbus_1: Send custom request function code 66: request fields:  values:  results in packed pdu 42
2023.02.17 16:27:57.786 4: HA_Modbus_1: ProcessRequestQueue (V4.5.1 - 14.2.2023) qlen 1, sending 01428011 via /dev/ttyUSB0@9600,8,0,2, read buffer empty,
request: id 1, write fc 66 h9042, len 1, value 0001, master device HA_PZEM_B1, reading Reset (set Reset), queued 0.00 secs ago,
response: no id, no fcode
2023.02.17 16:27:57.787 5: HA_Modbus_1: Send called from ProcessRequestQueue
2023.02.17 16:27:57.787 5: HA_Modbus_1: Profiling Send, before Idle, now is 16:27:57.787, Send started at 16:26:46.662, Idle started at 16:26:46.759
2023.02.17 16:27:57.788 5: HA_Modbus_1: Profiling add 71.028 to sum for Idle (now is 16:27:57.787, start for Idle was 16:26:46.759)
2023.02.17 16:27:57.788 5: DevIo_SimpleWrite HA_Modbus_1: 01428011
2023.02.17 16:27:57.791 5: HA_Modbus_1: Profiling Wait, before Send, now is 16:27:57.790, Wait started at 16:26:46.665, Send started at 16:27:57.787
2023.02.17 16:27:57.791 5: HA_Modbus_1: Profiling add 0.003 to sum for Send (now is 16:27:57.790, start for Send was 16:27:57.787)
2023.02.17 16:27:57.793 5: HA_Modbus_1: ReadAnswer called from SetLDFn
2023.02.17 16:27:57.794 5: HA_Modbus_1: Profiling Read, before Wait, now is 16:27:57.793, Read started at 16:26:46.668, Wait started at 16:27:57.790
2023.02.17 16:27:57.794 5: HA_Modbus_1: Profiling add 0.003 to sum for Wait (now is 16:27:57.793, start for Wait was 16:27:57.790)
2023.02.17 16:27:57.795 5: HA_Modbus_1: ReadAnswer remaining timeout is 1.98667407035828
2023.02.17 16:27:57.873 5: HA_Modbus_1: ReadAnswer got: 01
2023.02.17 16:27:57.874 5: HA_Modbus_1: ParseFrameStart called from ReadAnswer protocol RTU expecting id 1
2023.02.17 16:27:57.875 5: HA_Modbus_1: ReadAnswer got no valid frame after HandleFrameStart, wait for more data
2023.02.17 16:27:57.875 5: HA_Modbus_1: ReadAnswer remaining timeout is 1.9062659740448
2023.02.17 16:27:57.876 5: HA_Modbus_1: ReadAnswer got: 014280
2023.02.17 16:27:57.876 5: HA_Modbus_1: ParseFrameStart called from ReadAnswer protocol RTU expecting id 1
2023.02.17 16:27:57.877 5: HA_Modbus_1: ReadAnswer got no valid frame after HandleFrameStart, wait for more data
2023.02.17 16:27:57.877 5: HA_Modbus_1: ReadAnswer remaining timeout is 1.90452098846436
2023.02.17 16:27:57.877 5: HA_Modbus_1: ReadAnswer got: 01428011
2023.02.17 16:27:57.878 5: HA_Modbus_1: ParseFrameStart called from ReadAnswer protocol RTU expecting id 1
2023.02.17 16:27:57.879 4: HA_Modbus_1: ParseFrameStart (RTU, master) extracted id 1, fCode 66 and potential data
2023.02.17 16:27:57.879 5: HA_Modbus_1: HandleResponse called from ReadAnswer
2023.02.17 16:27:57.879 5: HA_Modbus_1: ParseResponse called from HandleResponse
2023.02.17 16:27:57.880 3: HA_Modbus_1: parse custom response function code 66: data:  with unpack code none to fields  results in values:
2023.02.17 16:27:57.881 1: PERL WARNING: Use of uninitialized value in addition (+) at /opt/fhem/FHEM/98_Modbus.pm line 4441.
2023.02.17 16:27:57.882 1: PERL WARNING: Use of uninitialized value in addition (+) at /opt/fhem/FHEM/98_Modbus.pm line 2579.
2023.02.17 16:27:57.882 4: HA_Modbus_1: HandleResponse error, current frame / read buffer: 01428011, id 1, fCode 66,
request: id 1, write fc 66 h9042, len 1, value 0001, master device HA_PZEM_B1, reading Reset (set Reset), queued 0.10 secs ago, sent 0.10 secs ago,
response: id 1, fc 66, len 1, error: Invalid checksum 4280 received. Calculated 7e80
2023.02.17 16:27:57.883 5: HA_Modbus_1: ResetExpect for HandleResponse from response to idle
2023.02.17 16:27:57.884 5: HA_Modbus_1: Profiling Idle, before Read, now is 16:27:57.883, Idle started at 16:26:46.759, Read started at 16:27:57.793
2023.02.17 16:27:57.884 5: HA_Modbus_1: Profiling add 0.090 to sum for Read (now is 16:27:57.883, start for Read was 16:27:57.793)
2023.02.17 16:27:57.885 5: HA_Modbus_1: DropFrame called from ReadAnswer - drop 01428011


Immer noch Invalid checksum. Habe auch mal PDULEXP auf 0 oder 2 gestellt --> gleiches Ergebnis.

Edit: Hatte eine alte utils erwischt. Nun die aktuelle kopiert --> aber gleiches Ergebnis: Invalid checksum
//Roger
Zotac, BBB, RPIs mit 10*FHEM
2*HM-LAN, 2*JeeLink, 2*RS485, SignalESP
HomeMatic, PCA301 Komponenten, ModBus: Stromzähler, Fronius WR, Shelly

StefanStrobel

Hallo Roger,

ich glaube ich habe den Fehler gefunden.
Bei meinen Tests habe ich eine TCP-Verbindung verwendet und da gibt es nur ein Device.
Anbei eine neue Version.

Gruß
   Stefan

Roger

Hi Stefan,
es wir langsam besser. Hier das Log:

2023.02.19 00:24:59.428 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.19 00:24:59.429 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.19 00:25:11.522 3: HA_PZEM_B1: attr dev-fc66Request-unpack none set
2023.02.19 00:25:11.548 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 dev-fc66Request-unpack none
2023.02.19 00:25:11.558 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.19 00:25:11.559 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.19 00:25:11.578 3: HA_PZEM_B1: attr dev-fc66Response-unpack none set
2023.02.19 00:25:11.603 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 dev-fc66Response-unpack none
2023.02.19 00:25:11.614 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.19 00:25:11.615 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.19 00:25:11.634 3: HA_PZEM_B1: attr dev-fc66Response-fieldExpr-PDULEXP 1 set
2023.02.19 00:25:11.660 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 dev-fc66Response-fieldExpr-PDULEXP 1
2023.02.19 00:25:11.670 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.19 00:25:11.670 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.19 00:25:11.677 3: HA_PZEM_B1: attr obj-h9042-reading Reset set
2023.02.19 00:25:11.703 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 obj-h9042-reading Reset
2023.02.19 00:25:11.713 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.19 00:25:11.713 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.19 00:25:11.724 3: HA_PZEM_B1: attr obj-h9042-set 1 set
2023.02.19 00:25:11.750 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 obj-h9042-set 1
2023.02.19 00:25:11.760 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.19 00:25:11.760 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.19 00:25:11.775 3: HA_PZEM_B1: attr obj-h9042-overrideFCwrite 66 set
2023.02.19 00:25:11.801 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 obj-h9042-overrideFCwrite 66
2023.02.19 00:25:11.811 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.19 00:25:11.812 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.19 00:25:11.829 3: HA_PZEM_B1: attr dev-fc194Response-unpack none set
2023.02.19 00:25:11.854 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 dev-fc194Response-unpack none
2023.02.19 00:25:11.864 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.19 00:25:11.865 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.19 00:25:11.934 3: HA_PZEM_B1: attr dev-fc194Response-fieldExpr-PDULEXP 1 set
2023.02.19 00:25:11.959 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 dev-fc194Response-fieldExpr-PDULEXP 1
2023.02.19 00:25:11.969 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.19 00:25:11.970 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.19 00:25:11.977 3: HA_PZEM_B1: attr obj-h9194-reading Reset_Fehler set
2023.02.19 00:25:12.003 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 obj-h9194-reading Reset_Fehler
2023.02.19 00:25:12.013 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.19 00:25:12.014 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.19 00:25:12.036 3: HA_PZEM_B1: attr obj-h9194-overrideFCread 194 set
2023.02.19 00:25:12.061 3: Noti_Global_RPi3, Notify Zweck: Notify fuer global, Name: global, Ereignis: ATTR HA_PZEM_B1 obj-h9194-overrideFCread 194
2023.02.19 00:25:12.071 5: HA_PZEM_B1: UpdateSetList: setList=reconnect:noArg saveAsModule createAttrsFromParseInfo interval reread:noArg stop:noArg start:noArg close:noArg scanStop:noArg scanModbusObjects sendRaw scanModbusId inactive active Alarm_Threshold_Voltage_high Alarm_Threshold_Voltage_low Modbus_ID Shunt__A:100A,50A,200A,300A Reset
2023.02.19 00:25:12.072 5: HA_PZEM_B1: UpdateSetList: getList=Voltage__V:noArg Current__A:noArg Power__W:noArg Energy__kWh:noArg
2023.02.19 00:25:18.227 4: HA_PZEM_B1: set called with Reset (h9042) setVal = 1
2023.02.19 00:25:18.228 5: HA_PZEM_B1: GetSetChecks with force
2023.02.19 00:25:18.229 5: HA_PZEM_B1: GetSetChecks returns success
2023.02.19 00:25:18.231 5: HA_PZEM_B1: set packed hex 31 with n to hex 0001
2023.02.19 00:25:18.234 4: HA_PZEM_B1: DoRequest called from SetLDFn created new request, read buffer empty,
request: id 1, write fc 66 h9042, len 1, value 0001, master device HA_PZEM_B1, reading Reset (set Reset)
2023.02.19 00:25:18.235 5: HA_Modbus_1: QueueRequest called from DoRequest with h9042, qlen 0 from master HA_PZEM_B1 through io device HA_Modbus_1
2023.02.19 00:25:18.236 5: HA_Modbus_1: ProcessRequestQueue called from QueueRequest as direct:HA_Modbus_1, qlen 1, force, request: request: id 1, write fc 66 h9042, len 1, value 0001, master device HA_PZEM_B1, reading Reset (set Reset), queued 0.00 secs ago
2023.02.19 00:25:18.237 5: HA_Modbus_1: checkDelays clientSwitchDelay is not relevant
2023.02.19 00:25:18.237 5: HA_Modbus_1: checkDelays sendDelay, last send to same device was 54.661 secs ago, required delay is 0.1
2023.02.19 00:25:18.237 5: HA_Modbus_1: checkDelays commDelay, last communication with same device was 54.584 secs ago, required delay is 0.1
2023.02.19 00:25:18.238 5: HA_Modbus_1: checkDelays busDelayRead, last activity on bus was 54.586 secs ago, required delay is 1
2023.02.19 00:25:18.239 3: HA_Modbus_1: Send custom request function code 66: request fields:  values:  results in packed pdu 42
2023.02.19 00:25:18.240 4: HA_Modbus_1: ProcessRequestQueue (V4.5.3 - 18.2.2023) qlen 1, sending 01428011 via /dev/ttyUSB0@9600,8,0,2, read buffer empty,
request: id 1, write fc 66 h9042, len 1, value 0001, master device HA_PZEM_B1, reading Reset (set Reset), queued 0.00 secs ago,
response: no id, no fcode
2023.02.19 00:25:18.240 5: HA_Modbus_1: Send called from ProcessRequestQueue
2023.02.19 00:25:18.241 5: HA_Modbus_1: Profiling Send, before Idle, now is 00:25:18.241, Send started at 00:24:23.572, Idle started at 00:24:23.671
2023.02.19 00:25:18.242 5: HA_Modbus_1: Profiling add 54.570 to sum for Idle (now is 00:25:18.241, start for Idle was 00:24:23.671)
2023.02.19 00:25:18.242 5: DevIo_SimpleWrite HA_Modbus_1: 01428011
2023.02.19 00:25:18.244 5: HA_Modbus_1: Profiling Wait, before Send, now is 00:25:18.244, Wait started at 00:24:23.576, Send started at 00:25:18.241
2023.02.19 00:25:18.245 5: HA_Modbus_1: Profiling add 0.003 to sum for Send (now is 00:25:18.244, start for Send was 00:25:18.241)
2023.02.19 00:25:18.246 5: HA_Modbus_1: ReadAnswer called from SetLDFn
2023.02.19 00:25:18.247 5: HA_Modbus_1: Profiling Read, before Wait, now is 00:25:18.247, Read started at 00:24:23.579, Wait started at 00:25:18.244
2023.02.19 00:25:18.248 5: HA_Modbus_1: Profiling add 0.003 to sum for Wait (now is 00:25:18.247, start for Wait was 00:25:18.244)
2023.02.19 00:25:18.248 5: HA_Modbus_1: ReadAnswer remaining timeout is 1.98718190193176
2023.02.19 00:25:18.328 5: HA_Modbus_1: ReadAnswer got: 01
2023.02.19 00:25:18.329 5: HA_Modbus_1: ParseFrameStart called from ReadAnswer protocol RTU expecting id 1
2023.02.19 00:25:18.329 5: HA_Modbus_1: ReadAnswer got no valid frame after HandleFrameStart, wait for more data
2023.02.19 00:25:18.330 5: HA_Modbus_1: ReadAnswer remaining timeout is 1.90549302101135
2023.02.19 00:25:18.330 5: HA_Modbus_1: ReadAnswer got: 01428011
2023.02.19 00:25:18.331 5: HA_Modbus_1: ParseFrameStart called from ReadAnswer protocol RTU expecting id 1
2023.02.19 00:25:18.331 4: HA_Modbus_1: ParseFrameStart (RTU, master) extracted id 1, fCode 66 and potential data
2023.02.19 00:25:18.332 5: HA_Modbus_1: HandleResponse called from ReadAnswer
2023.02.19 00:25:18.332 5: HA_Modbus_1: ParseResponse called from HandleResponse
2023.02.19 00:25:18.334 1: PERL WARNING: Use of uninitialized value in concatenation (.) or string at /opt/fhem/FHEM/98_Modbus.pm line 2523.
2023.02.19 00:25:18.334 5: HA_Modbus_1: exprHash key PDULEXP is
2023.02.19 00:25:18.336 5: HA_PZEM_B1: perl expression eval evaluated package main; my $response = $oRef->{'$response'};1 to 1
2023.02.19 00:25:18.336 5: HA_Modbus_1: extra field PDULEXP after expr (1) is 1
2023.02.19 00:25:18.336 3: HA_Modbus_1: parse custom response function code 66: data:  with unpack code none to fields  results in values:
2023.02.19 00:25:18.337 5: HA_Modbus_1: CheckChecksum (called from ParseResponse): 8011 is valid
2023.02.19 00:25:18.338 5: HA_Modbus_1: Profiling Fhem, before Read, now is 00:25:18.337, Fhem started at 00:24:23.653, Read started at 00:25:18.247
2023.02.19 00:25:18.339 5: HA_Modbus_1: Profiling add 0.091 to sum for Read (now is 00:25:18.337, start for Read was 00:25:18.247)
2023.02.19 00:25:18.339 4: HA_Modbus_1: HandleResponse done, current frame / read buffer: 01428011, id 1, fCode 66,
request: id 1, write fc 66 h9042, len 1, value 0001, master device HA_PZEM_B1, reading Reset (set Reset), queued 0.10 secs ago, sent 0.10 secs ago,
response: id 1, fc 66, len 1
2023.02.19 00:25:18.340 5: HA_Modbus_1: ResetExpect for HandleResponse from response to idle
2023.02.19 00:25:18.341 5: HA_Modbus_1: Profiling Idle, before Fhem, now is 00:25:18.340, Idle started at 00:24:23.671, Fhem started at 00:25:18.337
2023.02.19 00:25:18.341 5: HA_Modbus_1: Profiling add 0.003 to sum for Fhem (now is 00:25:18.340, start for Fhem was 00:25:18.337)
2023.02.19 00:25:18.342 5: HA_Modbus_1: DropFrame called from ReadAnswer - drop 01428011


Es ist zwar kein Invalid checksum mehr zu sehen, aber der Frame wird trotzdem gedroppt und kein Reading angelegt.
Ich habe mal mit PDULEXP 0 und 2 probiert - hat er übernommen, aber bei 0 Frame gedropped und bei 2 timeout.

Danke für Deine Mühen.
//Roger
Zotac, BBB, RPIs mit 10*FHEM
2*HM-LAN, 2*JeeLink, 2*RS485, SignalESP
HomeMatic, PCA301 Komponenten, ModBus: Stromzähler, Fronius WR, Shelly

StefanStrobel

Hallo Roger,

das sieht doch gut aus.
PDULEXP 1 ist korrekt, das ist die erwartete Länge der Response ohne Checksumme und die besteht ja nur aus dem function code. Wenn PDULEXP 1 ist, solltest Du es inzwischen sogar weglassen können.
Dass kein Reading erzeugt wird liegt daran, dass die Response vom Gerät keine Daten enthält.
Was für ein Reading hättest Du denn gerne? So was wie fc66LastResponse valid?

Gruß
    Stefan


Roger

#1101
ZitatWas für ein Reading hättest Du denn gerne? So was wie fc66LastResponse valid?
Hi Stefan,
am liebsten etwas konfigurierbares.  ;D
Es gibt ja noch den FC 0xC2=194, welcher kommen soll, wenn beim Rücksetzen was schief ging. Da sollte dann was anderes drin stehen. Notfalls "no data".
Ich denke mal, dann ist auch die Meldung "Frame gedropped" weg.

So habe ich die Reading definiert:

# Definition send FC 0x42=66(decimal) zum Zuruecksetzen der Energie
attr HA_PZEM_B1 dev-fc66Request-unpack none
# Definition Empfang FC 0x42=66(decimal): Energie erfolgreich zurueckgesetzt
attr HA_PZEM_B1 dev-fc66Response-unpack none
attr HA_PZEM_B1 dev-fc66Response-fieldExpr-PDULEXP 1
# virtuelles Holding Register zum erfolgreichen Zuruecksetzen der Energie
attr HA_PZEM_B1 obj-h9042-reading Reset
attr HA_PZEM_B1 obj-h9042-set 1
attr HA_PZEM_B1 obj-h9042-overrideFCwrite 66
# Definition Empfang FC 0xC2=194(decimal): Fehler beim Zuruecksetzen der Energie
attr HA_PZEM_B1 dev-fc194Response-unpack none
attr HA_PZEM_B1 dev-fc194Response-fieldExpr-PDULEXP 1
# virtuelles Holding Register bei Fehler Zuruecksetzen der Energie
attr HA_PZEM_B1 obj-h9194-reading Reset_Fehler
attr HA_PZEM_B1 obj-h9194-overrideFCread 194


Kannst Du denn noch was sinnvolles gegen den notwendigen Parameter beim SET-Befehl machen?

//Roger
Zotac, BBB, RPIs mit 10*FHEM
2*HM-LAN, 2*JeeLink, 2*RS485, SignalESP
HomeMatic, PCA301 Komponenten, ModBus: Stromzähler, Fronius WR, Shelly

StefanStrobel

Hallo Roger,

Zitat von: Roger am 19 Februar 2023, 09:55:51
Es gibt ja noch den FC 0xC2=194, welcher kommen soll, wenn beim Rücksetzen was schief ging. Da sollte dann was anderes drin stehen. Notfalls "no data".
Ich denke mal, dann ist auch die Meldung "Frame gedropped" weg.
Function codes dürfen nicht größer als 127 sein.
Wenn ein Slave einen Fehler melden möchte, dann antwortet er mit dem function code des Request +128. Da gibt es dann keine Zuweisung zu Objekten.

Zitat
Kannst Du denn noch was sinnvolles gegen den notwendigen Parameter beim SET-Befehl machen?

obj-...-noArg, z.B.

attr Master obj-h9042-noArg 1


anbei die neue Version.

wenn Du beim custom function code eine Expression für VALUES definierest, dann meint das Modul, dass in der Response Daten für das angefragte Objekt waren und setzt das Reading. Im Fehlerfall wird wie üblich kein Reading gesetzt.

Z.B.

attr Master dev-fc66Response-fieldExpr-VALUES pack ('n', 1)


Gruß
    Stefan

Roger

Hi Stefan,
alles geht.  :) set-Befehl ohne Parameter, das Reading wird angelegt - aber es kommt noch "DropFrame".
Aber vielleicht interpretiere ich es auch falsch und es ist gar kein Fehler.

ZitatFunction codes dürfen nicht größer als 127 sein.
Wenn ein Slave einen Fehler melden möchte, dann antwortet er mit dem function code des Request +128. Da gibt es dann keine Zuweisung zu Objekten.
Wie würde man denn einen solchen Fehler sehen? Nur im Log oder wird auch ein Reading/state gesetzt worauf man in einem notify reagieren kann?

Nur eine Warnung zu sehen: PERL WARNING: Use of uninitialized value in concatenation (.) or string at /opt/fhem/FHEM/98_Modbus.pm line 2532
Hier das Log:

2023.02.19 22:44:07.368 4: HA_PZEM_B1: set called with Reset (h9042)
2023.02.19 22:44:07.369 3: HA_PZEM_B1: set with noArg for Reset, using value 1
2023.02.19 22:44:07.369 5: HA_PZEM_B1: GetSetChecks with force
2023.02.19 22:44:07.370 5: HA_PZEM_B1: GetSetChecks returns success
2023.02.19 22:44:07.372 5: HA_PZEM_B1: set packed hex 31 with n to hex 0001
2023.02.19 22:44:07.375 4: HA_PZEM_B1: DoRequest called from SetLDFn created new request, read buffer empty,
request: id 1, write fc 66 h9042, len 1, value 0001, master device HA_PZEM_B1, reading Reset (set Reset)
2023.02.19 22:44:07.375 5: HA_Modbus_1: QueueRequest called from DoRequest with h9042, qlen 0 from master HA_PZEM_B1 through io device HA_Modbus_1
2023.02.19 22:44:07.376 5: HA_Modbus_1: ProcessRequestQueue called from QueueRequest as direct:HA_Modbus_1, qlen 1, force, request: request: id 1, write fc 66 h9042, len 1, value 0001, master device HA_PZEM_B1, reading Reset (set Reset), queued 0.00 secs ago
2023.02.19 22:44:07.377 5: HA_Modbus_1: checkDelays clientSwitchDelay is not relevant
2023.02.19 22:44:07.378 5: HA_Modbus_1: checkDelays sendDelay, last send to same device was 158.941 secs ago, required delay is 0.1
2023.02.19 22:44:07.378 5: HA_Modbus_1: checkDelays commDelay, last communication with same device was 158.864 secs ago, required delay is 0.1
2023.02.19 22:44:07.379 5: HA_Modbus_1: checkDelays busDelayRead, last activity on bus was 158.865 secs ago, required delay is 1
2023.02.19 22:44:07.380 3: HA_Modbus_1: Send custom request function code 66: request fields:  values:  results in packed pdu 42
2023.02.19 22:44:07.380 4: HA_Modbus_1: ProcessRequestQueue (V4.5.4 - 19.2.2023) qlen 1, sending 01428011 via /dev/ttyUSB0@9600,8,0,2, read buffer empty,
request: id 1, write fc 66 h9042, len 1, value 0001, master device HA_PZEM_B1, reading Reset (set Reset), queued 0.00 secs ago,
response: no id, no fcode
2023.02.19 22:44:07.381 5: HA_Modbus_1: Send called from ProcessRequestQueue
2023.02.19 22:44:07.382 5: HA_Modbus_1: Profiling Send, before Idle, now is 22:44:07.381, Send started at 22:41:28.432, Idle started at 22:41:28.584
2023.02.19 22:44:07.383 5: HA_Modbus_1: Profiling add 158.797 to sum for Idle (now is 22:44:07.381, start for Idle was 22:41:28.584)
2023.02.19 22:44:07.383 5: DevIo_SimpleWrite HA_Modbus_1: 01428011
2023.02.19 22:44:07.385 5: HA_Modbus_1: Profiling Wait, before Send, now is 22:44:07.385, Wait started at 22:41:28.436, Send started at 22:44:07.381
2023.02.19 22:44:07.386 5: HA_Modbus_1: Profiling add 0.003 to sum for Send (now is 22:44:07.385, start for Send was 22:44:07.381)
2023.02.19 22:44:07.387 5: HA_Modbus_1: ReadAnswer called from SetLDFn
2023.02.19 22:44:07.388 5: HA_Modbus_1: Profiling Read, before Wait, now is 22:44:07.388, Read started at 22:41:28.439, Wait started at 22:44:07.385
2023.02.19 22:44:07.389 5: HA_Modbus_1: Profiling add 0.003 to sum for Wait (now is 22:44:07.388, start for Wait was 22:44:07.385)
2023.02.19 22:44:07.389 5: HA_Modbus_1: ReadAnswer remaining timeout is 1.98696684837341
2023.02.19 22:44:07.467 5: HA_Modbus_1: ReadAnswer got: 01
2023.02.19 22:44:07.468 5: HA_Modbus_1: ParseFrameStart called from ReadAnswer protocol RTU expecting id 1
2023.02.19 22:44:07.468 5: HA_Modbus_1: ReadAnswer got no valid frame after HandleFrameStart, wait for more data
2023.02.19 22:44:07.469 5: HA_Modbus_1: ReadAnswer remaining timeout is 1.90718698501587
2023.02.19 22:44:07.470 5: HA_Modbus_1: ReadAnswer got: 014280
2023.02.19 22:44:07.470 5: HA_Modbus_1: ParseFrameStart called from ReadAnswer protocol RTU expecting id 1
2023.02.19 22:44:07.471 5: HA_Modbus_1: ReadAnswer got no valid frame after HandleFrameStart, wait for more data
2023.02.19 22:44:07.471 5: HA_Modbus_1: ReadAnswer remaining timeout is 1.90493488311768
2023.02.19 22:44:07.472 5: HA_Modbus_1: ReadAnswer got: 01428011
2023.02.19 22:44:07.472 5: HA_Modbus_1: ParseFrameStart called from ReadAnswer protocol RTU expecting id 1
2023.02.19 22:44:07.472 4: HA_Modbus_1: ParseFrameStart (RTU, master) extracted id 1, fCode 66 and potential data
2023.02.19 22:44:07.473 5: HA_Modbus_1: HandleResponse called from ReadAnswer
2023.02.19 22:44:07.473 5: HA_Modbus_1: ParseResponse called from HandleResponse
2023.02.19 22:44:07.475 1: PERL WARNING: Use of uninitialized value in concatenation (.) or string at /opt/fhem/FHEM/98_Modbus.pm line 2532.
2023.02.19 22:44:07.475 5: HA_Modbus_1: exprHash key PDULEXP is
2023.02.19 22:44:07.476 5: HA_Modbus_1: exprHash key VALUES is
2023.02.19 22:44:07.477 5: HA_PZEM_B1: perl expression eval evaluated package main; my $response = $oRef->{'$response'};1 to 1
2023.02.19 22:44:07.477 5: HA_Modbus_1: extra field PDULEXP after expr (1) is 1
2023.02.19 22:44:07.478 5: HA_PZEM_B1: perl expression eval evaluated package main; my $response = $oRef->{'$response'};pack('n',1) to 
2023.02.19 22:44:07.479 5: HA_Modbus_1: extra field VALUES after expr (pack('n',1)) is 
2023.02.19 22:44:07.479 3: HA_Modbus_1: parse custom response function code 66: data:  with unpack code none to fields  results in values:
2023.02.19 22:44:07.480 5: HA_Modbus_1: CheckChecksum (called from ParseResponse): 8011 is valid
2023.02.19 22:44:07.481 5: HA_Modbus_1: Profiling Fhem, before Read, now is 22:44:07.480, Fhem started at 22:41:28.515, Read started at 22:44:07.388
2023.02.19 22:44:07.481 5: HA_Modbus_1: Profiling add 0.093 to sum for Read (now is 22:44:07.480, start for Read was 22:44:07.388)
2023.02.19 22:44:07.482 5: HA_Modbus_1: now parsing response data objects, master is HA_PZEM_B1 relay is undefined
2023.02.19 22:44:07.482 5: HA_PZEM_B1: ParseDataString called from HandleResponse with data hex 0001, type h, adr 9042, op write
2023.02.19 22:44:07.483 5: HA_PZEM_B1: SplitDataString called from ParseDataString with data hex 0001, type h, adr 9042, valuesLen 1, op write
2023.02.19 22:44:07.484 5: HA_PZEM_B1: CreateDataObjects called from ParseDataString with objList h9042
2023.02.19 22:44:07.484 5: HA_PZEM_B1: CreateDataObjects sortedList h9042
2023.02.19 22:44:07.485 5: HA_PZEM_B1: CreateParseInfoCache called
2023.02.19 22:44:07.487 5: HA_PZEM_B1: CreateDataObjects unpacked 0001 with n to 1
2023.02.19 22:44:07.487 4: HA_PZEM_B1: CreateDataObjects assigns value 1 to Reset
2023.02.19 22:44:07.524 3: Noti_PZEM, Notify Zweck: Notify: PZEM DC-Modul, Name: HA_PZEM_B1, Ereignis: Reset: 1
2023.02.19 22:44:07.531 5: HA_PZEM_B1: ParseDataString created 1 readings
2023.02.19 22:44:07.532 4: HA_Modbus_1: HandleResponse done, current frame / read buffer: 01428011, id 1, fCode 66,
request: id 1, write fc 66 h9042, len 1, value 0001, master device HA_PZEM_B1, reading Reset (set Reset), queued 0.16 secs ago, sent 0.16 secs ago,
response: id 1, fc 66, h9042, len 1, values 0001
2023.02.19 22:44:07.532 5: HA_Modbus_1: ResetExpect for HandleResponse from response to idle
2023.02.19 22:44:07.533 5: HA_Modbus_1: Profiling Idle, before Fhem, now is 22:44:07.533, Idle started at 22:41:28.584, Fhem started at 22:44:07.480
2023.02.19 22:44:07.534 5: HA_Modbus_1: Profiling add 0.053 to sum for Fhem (now is 22:44:07.533, start for Fhem was 22:44:07.480)
2023.02.19 22:44:07.535 5: HA_Modbus_1: DropFrame called from ReadAnswer - drop 01428011


Vielen, vielen Dank.
Wie geht es nun weiter? Kommt das ins offizielle Modul und ich benötige exclude_from_update nicht mehr? Wann?
//Roger
Zotac, BBB, RPIs mit 10*FHEM
2*HM-LAN, 2*JeeLink, 2*RS485, SignalESP
HomeMatic, PCA301 Komponenten, ModBus: Stromzähler, Fronius WR, Shelly

StefanStrobel

Hallo Roger,

die Änderungen kommen sicher ins offizielle Modul, aber bevor ich das einchecke möchte ich die neuen Features noch ein wenig optimieren, testen und dokumentieren. Das wird noch ein paar Wochen dauern.

Gruß
   Stefan

Roger

Hi Stefan,
also warte ich mal ab - es geht ja alles. Vielen vielen Dank.  :)

ZitatZitat
Function codes dürfen nicht größer als 127 sein.
Wenn ein Slave einen Fehler melden möchte, dann antwortet er mit dem function code des Request +128. Da gibt es dann keine Zuweisung zu Objekten.
Wie würde man denn einen solchen Fehler sehen? Nur im Log oder wird auch ein Reading/state gesetzt worauf man in einem notify reagieren kann?
Wie würde man denn einen solchen Fehler sehen? Nur im Log oder wird auch ein Reading/state gesetzt worauf man in einem notify reagieren kann?
Kannst Du hier noch einen Hinweis geben?

Wenn Du mit Tests & Doku weiter bist --> teste ich wieder gern.
Vielen vielen Dank.  :)
//Roger
Zotac, BBB, RPIs mit 10*FHEM
2*HM-LAN, 2*JeeLink, 2*RS485, SignalESP
HomeMatic, PCA301 Komponenten, ModBus: Stromzähler, Fronius WR, Shelly

bismosa

Hallo!

Ich könnte mal ein wenig "Starthilfe" gebrauchen. Für mich ist das Thema Modbus ganz neu.
Ich habe einen Wechselrichter von Deye (sun 600 g3). Dieser lässt sich per Modbus auf Port 8899 TCP auslesen.
Ich habe ein Python-Script gefunden, das die Werte "problemlos" ausliest und als MQTT bereit stellt.
https://github.com/kbialek/deye-inverter-mqtt
Hier ist auch eine Liste der Modbus-Adressen (HEX).

Mir wäre es lieber, wenn ich es mit FHEM direkt umsetzen könnte. Von daher mache ich derzeit die ersten Versuche mit ModbusAttr.

Bisher habe ich nur die Definition
5 0 192.168.1.139:8899 TCP
Und habe versucht einen "scanModbusObjects" durchzuführen. Ich habe jedoch nur folgende Logeinträge:
2023.02.21 17:11:41 3: WP: Timeout waiting for a modbus response, read buffer empty,
request: id 3, scanobj fc 3 h131, len 1, tid 141, master device WP (scan objs), queued 21.21 secs ago, sent 2.00 secs ago


Also bisher konnte ich dem Ganzen keine Daten entlocken.
In der Python Version scheint es wichtig zu sein, dass die Seriennummer vom Logger in der Config angegeben wird.
Ich habe aber noch nicht verstanden wofür? Wird diese benötigt um überhaupt Daten auslesen zu können? Wie kann ich das dann im Modul machen?

Kann mir hier jemand Starthilfe geben?

Gruß
Bismosa
1x nanoCUL 433MHz (SlowRF Intertechno) für Fenstersensoren
1x nanoCUL 868Mhz für MAX (9x HT 1xWT)
1x ZigBee CUL
Weiteres: Squeezebox server, Kindle Display, ESP8266, Löterfahrung, ...

pejonp

@bismosa

hier mal der Anfang

define PWP ModbusAttr 5 30 192.168.1.139:8899 TCP     // Modbusnummer + Zeitintervall + IP

oder

define PWP ModbusAttr 3 60 192.168.1.139:8899 RTU

attr PWP dev-h-combine 10
attr PWP dev-h-defPoll 1
attr PWP obj-h60-reading day_energy            // Adresse 0x3c
attr PWP obj-h60-len 4                                    // Länge noch feststellen
attr PWP obj-h60-unpack (a4)                         // Parameter zum entpacken  ... n oder F> oder f> ...
....



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

bismosa

Hallo!

Danke für die Starthilfe  :)

Leider bekomme ich keine Daten ausgelesen. Auszug aus dem Log:

2023.02.22 09:29:28 3: WP: Timeout waiting for a modbus response, read buffer empty, id 86, fCode 222, tid 42241,
request: id 3, read fc 3 h60, len 4, tid 142, master device WP, reading day_energy (getUpdate for day_energy len 4), queued 2.13 secs ago, sent 2.00 secs ago
2023.02.22 09:30:28 3: WP: Timeout waiting for a modbus response, read buffer empty, id 86, fCode 222, tid 42241,
request: id 3, read fc 3 h60, len 4, tid 58, master device WP, reading day_energy (getUpdate for day_energy len 4), queued 2.01 secs ago, sent 2.00 secs ago
2023.02.22 09:31:28 3: WP: Timeout waiting for a modbus response, read buffer empty, id 86, fCode 222, tid 42241,
request: id 3, read fc 3 h60, len 4, tid 170, master device WP, reading day_energy (getUpdate for day_energy len 4), queued 2.10 secs ago, sent 2.05 secs ago
2023.02.22 09:32:28 3: WP: Timeout waiting for a modbus response, read buffer empty, id 86, fCode 222, tid 42241,
request: id 3, read fc 3 h60, len 4, tid 35, master device WP, reading day_energy (getUpdate for day_energy len 4), queued 2.08 secs ago, sent 2.00 secs ago


Dafür bekomme ich gelegentlich solche Einträge:

2023.02.22 09:29:18 3: WP: readfn got data while EXPECT was set to idle: a5010010475356de9747f800b515
2023.02.22 09:33:18 3: WP: readfn got data while EXPECT was set to idle: a5010010475559de9747f800ba15


Gibt es denn so etwas wie ein Login? Ich vermute das es noch irgendwie mit der Seriennummer zusammen hängen könnte?
In dem Python Modul wird ein "request_frame" für Abfragen gebildet:
https://github.com/kbialek/deye-inverter-mqtt/blob/0e6d1ecf24ad498b5f50ee98c4f4b2868a0c20b4/deye_modbus.py#L50
Dort wird dann u.a. auch die Inverter Seriennummer verwendet.
Oder liege ich hier völlig falsch?

Gruß
Bismosa
1x nanoCUL 433MHz (SlowRF Intertechno) für Fenstersensoren
1x nanoCUL 868Mhz für MAX (9x HT 1xWT)
1x ZigBee CUL
Weiteres: Squeezebox server, Kindle Display, ESP8266, Löterfahrung, ...

pejonp

@Bismosa

Häng mal deine Konfiguration hier an
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