Topic-icon xPhcLog, log events on the PHC module bus

Mehr
15 Aug 2015 12:06 - 17 Aug 2015 22:32 #1 von simonjo
xPhcLog, log events on the PHC module bus wurde erstellt von simonjo
This tool lets you log the packets sent between STM and modules, unzip attached file to your Raspi and give it execute rights.

xPhcLog can use an RS232-to-USB convertor, an RS232-to-IP or RS485-to-IP module connected to your module bus.

The RS232-to-IP/RS485-to-IP modules should be set up to send UDP packets to your Raspi's IP address and port on which xPhcLog is listening. Make sure it sends each byte without any delays or buffering.

When using an RS232-to-IP convertor, connect it's ground input to the PHC module bus 'A' wire, and it's RX input to the PHC module bus 'B' wire.

Run "./xphclog.raspi -?" to get help on using this tool.
Letzte Änderung: 17 Aug 2015 22:32 von simonjo.
Folgende Benutzer bedankten sich: ansgar75

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
17 Aug 2015 22:36 #2 von simonjo
Updating to version 1.0.5.3 with support for enhanced logging mode, in this mode xphclog takes a look at multiple packets on the PHC module bus and determines exactly what they are and mean.

Enhanced mode could be used to extract realtime module status and feed it into OpenHAB.

Attached zip file includes a sample ini-file + Windows (xphclog.exe) and Raspi (xphclog.raspi) versions.

./xphclog.raspi -? gives you help info, the sample ini-file contains even some more info.

Take a look at the --modules option to specify the modules in your system, that way you get correct logging.
Anhänge:
Folgende Benutzer bedankten sich: ansgar75

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
24 Okt 2015 14:12 #3 von simonjo
Hallo,

Would it be helpful if xphclog could publish the actual status of inputs/outputs to a broker. OpenHab can then use this information with it's mqtt binding.

You can reply in German, I can read it, but writing is more difficult...

mvg, Jo
Anhänge:
Folgende Benutzer bedankten sich: Eckert258

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
26 Okt 2015 15:24 #4 von Andreas
Hello Jo,


I'm using MQTT to connect my PHCGateway (something similar to your xphclog) to OpenHAB which is working very good.
I think, MQTT is a very good mechansim for communicationg between different components of OpenHAB. The biggest advantage is that you don't need to implement a specific binding for OpenHAB.

Currently I'm working on an Arduino scetch which is collecting a lot of sensor data (temperature, barometric pressure, humidity, ...) and which is sending them via MQTT to OpenHAB.


Andreas

PHC STM V2, EMD,AMD,JRM und DIM-Module, Wind, Regen und Sonnen-Sensor, Visualisierung mit OpenHAB

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
26 Okt 2015 21:30 #5 von simonjo
Andreas,

At work we are looking at building a Wireless Sensor Network that connects to a gateway on a Raspi to collect the data and send it to openhab using MQTT... on that same Raspi. 1 colleague already gave a small demo few weeks ago, looking good, but work in progress.

What does your PHCGateway actually do and how does it interface to a PHC system?

Do you have any quick start info for making an openhab binding? that might be interesting to do.


mvg, Jo

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • ansgar75
  • ansgar75s Avatar
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Stay hungry, stay foolish! - Steve Jobs
Mehr
04 Nov 2015 20:37 #6 von ansgar75
Hello Jo,

Thank you for distributing your tools.
Can I use a ComPort-Server and connect it to the front RS232-interface of my STM-V2 module? Or do I need to contact it like you have desribed in the first post?

I have another question about the correct setup of the last part in the 'xphclog.ini' file:
30 ; xPhcLog will apply default message decoding per module class as follows:
31 ;  class 0: default=imd, contains imd,imw,tab,et0
32 ;  class 1: default=uim, contains uim,utm,bwm,et1,mcc
33 ;  class 2: default=omd, contains omd,jrm
34 ;  class 3: default=amd, contains amd,fui,fu2
35 ;  class 4: default=ebs, contains ebs,ebr,ebd
36 ;  class 5: default=dim, contains dim
37 ;
38 ; This might lead to wrong output, so one can override specific module types, syntax:   
39 ;   modules=<mod>.<addr> *[;<mod>.<addr>]
40 ;
41 ; Where:
42 ;  mod  : imd,imw,tab,et0,uim,utm,bwm,et1,mcc,omd,jrm,amd,fui,fu2,ebs,ebr,ebd,dim
43 ;  addr : 0-31
44 ;
45 modules=imd.0;imw.1;tab.2;et0.3;uim.0;utm.1;bwm.2;et1.3;mcc.4;omd.0;jrm.1;amd.0;fui.1;fu2.2;ebs.0;ebr.1;ebd.2;dim.0
46 ;

What do I need to put into line 45 exactly?
I don't really understand the syntax of this line.


Thank you
Ansgar

Peha PHC V3 seit 2017 (vorher V2 seit 2009) im Neubau - MCC - JRM - EMD - AMD - DIM - UIM - FUI - Module
IP-Symcon Smarthome Software auf Intel NUC mit Ubuntu 20.04LTS (Einbindung von PHC tlw. über Webinterface der V3)

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
04 Nov 2015 22:36 #7 von simonjo
Ansgar,

1) For xPhcLog to work it must be connected to the module bus, this is RS485 and connects the modules and the STM. The RS232 port in the front of the STM is another bus called the external bus, it connects the STM to a PC. These are 2 different things.

You will need to connect your comport server to the modules bus as described.

2) About line 45 in xphclog.ini...
PHC modules are divided into classes (0...5) and each class is assigned a range of module addresses, class 0=0-31, class 1=32-63, class 2=64-95, etc... Per class, multiple module types are allowed, for example class 2 has module types omd and jrm.

Module types of the same class may send packets in different formats. And sometimes multiple module types of the same class send the same format. So it becomes difficult for xPhcLog to determine exactly what is being sent across the module bus, some help is needed.

Therefor xPhcLog has a list that maps the module address to a module type, so it knows how to decode a message to/from that module. Per class there is a default module type which is used if you don't specify line 45.

If your PHC system has different module types installed, then you need to specify this in line 45.

Example: you have 4 output modules (omd.0-3) and 2 jrm modules (jrm.4-5), then a line with: 'modules=jrm.4;jrm.5' is enough, since the default module type for class 2=omd

So the rule is simple: if you have modules installed that are different from the default per class, then specify these in line 45.


regards, Jo
Folgende Benutzer bedankten sich: ansgar75

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • ansgar75
  • ansgar75s Avatar
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Stay hungry, stay foolish! - Steve Jobs
Mehr
05 Nov 2015 10:11 #8 von ansgar75
Jo,

thank you very much.
I was a little bit confused :blink:. But now I think that's clear ;).

Ansgar

Peha PHC V3 seit 2017 (vorher V2 seit 2009) im Neubau - MCC - JRM - EMD - AMD - DIM - UIM - FUI - Module
IP-Symcon Smarthome Software auf Intel NUC mit Ubuntu 20.04LTS (Einbindung von PHC tlw. über Webinterface der V3)

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
16 Sep 2016 23:48 - 18 Sep 2016 19:52 #9 von simonjo
Hi all,

Here is the latest version 4.0.0.4 of xPhcLogd, in the zip file included are: Windows version (xphclogd.exe), Linux x86 version (xphclogd.x86) and Raspi version (xphclogd.raspi).

What is new?
- small fixes in the decoding due to additional tests (thx P.)
- enhanced logging mode
- optional reporting to MQTT broker
- use of ini file supported
- separate logging files
-> application: xphclogd_yyyymmdd_hhmmss.log
-> modulebus reporting: xphclogd_report_yyyymmdd_hhmmss.log
Anhänge:
Letzte Änderung: 18 Sep 2016 19:52 von simonjo.
Folgende Benutzer bedankten sich: Jürgen, piet

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
19 Sep 2016 14:31 #10 von piet
Hi Jo,

thanks a lot for the updated version of xPHCLog :)

Piet

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
29 Nov 2016 20:14 - 29 Nov 2016 20:17 #11 von haribo
Hi Jo,

it would be grateful to get some help to get xPhcLog work.

I did the following:
  1. I connected an USB2RS232-Converter to the control module as described in your sample ini file: serial port ground (Pin5) to +A and RX (Pin2) to -B
    root@raspberrypi:/home/pi/xphclog# lsusb
    Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
    Bus 001 Device 004: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
    root@raspberrypi:/home/pi/xphclog# ls -l /dev/ttyUSB0
    crw-rw---T 1 root dialout 188, 0 Nov 29 19:43 /dev/ttyUSB0
  2. I startet xphclog.raspi --ini xphclog.ini
  3. I did a tail -f on the log file xphclog_xx.log
  4. I toggled some lights
  5. All I see is the following:
  6. 2016-11-29,19:32:24,001C0000,CApp::InitLogging,xPhcLog (Linux/RbPI), v1.0.5.3, Aug 17 2015, Jo Simons (c) 2007-2015

    This is my ini file:
root@raspberrypi:/home/pi/xphclog# cat xphclog.ini
;
; PHC logger daemon settings
;
[phclogd]

; xPhcLog has 2 logging modes: 0=raw, 1=enhanced, default=0
;   raw      : log each packet as it arrives, some packets may have one or 2 meanings
;   enhanced : multiple packets are analyzed to determine the exact meaning
mode=0


; xPhcLog will capture logging data either via a serial port device or a UDP socket
;
; option 1: device to use for capturing, i.e. COM1, /dev/ttyUSB0
;           connect serial port ground to 'A' wire of PHC module bus
;           connect serial port RX     to 'B' wire of PHC module bus
;device=\\.\COM1
;device=\\.\COM11
device=/dev/ttyUSB0

; option 2: listener socket to receive UDP packets from RS232-to-IP convertor
;           connect RS232 port ground to 'A' wire of PHC module bus
;           connect RS232 port RX     to 'B' wire of PHC module bus
;           make sure the convertor sends each byte it receives on RS232 side
;             as a UDP packet to <locaddr>:<locport> without delay or caching
;locaddr=192.168.0.100
;locport=4001


; xPhcLog will apply default message decoding per module class as follows:
;  class 0: default=imd, contains imd,imw,tab,et0
;  class 1: default=uim, contains uim,utm,bwm,et1,mcc
;  class 2: default=omd, contains omd,jrm
;  class 3: default=amd, contains amd,fui,fu2
;  class 4: default=ebs, contains ebs,ebr,ebd
;  class 5: default=dim, contains dim
;
; This might lead to wrong output, so one can override specific module types, syntax:
;   modules=<mod>.<addr> *[;<mod>.<addr>]
;
; Where:
;  mod  : imd,imw,tab,et0,uim,utm,bwm,et1,mcc,omd,jrm,amd,fui,fu2,ebs,ebr,ebd,dim
;  addr : 0-31
;
#modules=imd.0;imd.1;imd.2;imd.3;omd.0;omd.1;omd.2;omd.3;omd.7;dim.0
modules=omd.0

;
root@raspberrypi:/home/pi/xphclog#





I varied a lot with tho modules param and i switched Pins 2/3 of the serial connection several times.
Nothing happens.
Have I connected the right bus?
Is it right to use an RS232-converter (instead of a RS485 one)?

What else could went wrong?

Thanks a lot for your help.

Regards Harald
Anhänge:
Letzte Änderung: 29 Nov 2016 20:17 von haribo.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
29 Nov 2016 22:53 #12 von simonjo
Hi Harald,

I would like you to do this:

1) upgrade to version 4.0.0.4 attached here. Just unzip the zip file to a temp directory and copy xphclogd.raspi to the directory you are using now. Give xphclogd.raspi execute rights (chmod +x xphclogd.raspi)

2) start xphclogd with an extra parm --loglevel 0xFFFFFFFF


Send me the logfile

regards, Jo
Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
30 Nov 2016 20:49 - 30 Nov 2016 21:49 #13 von haribo
Hi Jo,

thanks a lot for your support.

I followed your instructions:
pi@raspberrypi ~/xphclog $ ./xphclogd.raspi --loglevel 0xFFFFFFFF

+ xPhcLogd   (Linux/RbPI) ------ v4.0.0.4, Sep 16 2016, Jo Simons (c) 2007-2016
+ =============================================================================
Press CTRL-C to quit...
2016-11-30,19:53:22,00090000,A,version=4.0.0.4,Sep 16 2016
2016-11-30,19:53:22,00090010,A,legend:
2016-11-30,19:53:22,00090011,A,  o0=out0-7,o1=out8-15
2016-11-30,19:53:22,00090012,A,  i0=in0-7,i1=in8-15
2016-11-30,19:53:22,00090013,A,  l0=out0,l1=out1,l2=out2,l3=out3 (amd/ebd/dim)
^CCTRL-C pressed,terminating app
- 0 (Success)
pi@raspberrypi ~/xphclog $

After starting xphclogd I toggled a lot of lights in order to create traffic
on the module bus. But there is nothing indicating traffic in the log file.

Obviously there is no traffic or I'm not able to catch it.

I did the following:

  • I separated the proper working USB2RS232-Converter-based serial connection from the RPI to the RS232-Port of the control module

  • I plugged the DSUB9-Connector into a DSUB9 female connector with two wires
    (Pin2 RX and Pin5 GND), that are connected to the RS485-Connector of the
    control module (Pin2->B, Pin5->A)

  • in addition I tested with Pin3->B, Pin5-A (NULL-MODEM?)

Any idea?

  • wiring problem?

  • voltage level problem?

  • do I need a RS485->USB converter?

  • should I try the windows version?

  • wrong mode of xphclogd?

  • I won't give up ;-)

    Regards, Harald
    Anhänge:
    Letzte Änderung: 30 Nov 2016 21:49 von haribo.

    Bitte Anmelden oder Registrieren um der Konversation beizutreten.

    Mehr
    30 Nov 2016 21:37 #14 von simonjo
    Harald,

    I don't see any port being opened...

    You need to start xphclogd as follows:

    xphclog.raspi --ini xphclog.ini --loglevel 0xFFFFFFFF


    This will show us more

    Bitte Anmelden oder Registrieren um der Konversation beizutreten.

    Mehr
    30 Nov 2016 21:52 #15 von haribo
    Jo,

    I just realized that my attachments were not present (due to the file extention .log).
    I renamed them to .txt and attached them right now (see my previous post).
    This should show you more.

    Regards, Harald

    Bitte Anmelden oder Registrieren um der Konversation beizutreten.

    Powered by Kunena Forum