xPhcLog, log events on the PHC module bus
- Biland
- Offline
- Senior Boarder
- Beiträge: 34
- Dank erhalten: 0
After Harald sent me the setting of his nport (thank you Harald) I adjust the settings of my nport to the same one.
After that I connected the nport with the phc system and started xphclog but after some actions of switches the system hang up again.
Then I removed the cable for xwrc from the nport and restart the phc system. Next I started xphclog again and toggled some swichtes. But then I was very surprised. There was no logging possible. Xphclog got no signals. Then I connected the cable for xwrc during xphclog was running and toggled some switches again. Now the system worked nice – no hang up – fine logging …
Even after a restart or reconnection of the cables the xphclog works fine and the PHC system didn’t crash.
But what was the root cause for the problem? I don’t understand the problem.
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Biland
- Offline
- Senior Boarder
- Beiträge: 34
- Dank erhalten: 0
On Openhab2 I have add an item like this:
Switch Light_GF_Kitchen "Küche" (GF_Living, Info) { http=">[ON:GET:http://192.168.1.28:9999/icontrol.dll?ccmd=omd.1.out2.on] >[OFF:GET:http://192.168.1.28:9999/icontrol.dll?ccmd=omd.1.out2.off]", mqtt="<[mosquitto:myHouse/sta/omd.1.out.2:state:ON:1], <[mosquitto:myHouse/sta/omd.1.out.2:state:OFF:0]" }
I am sure that mosquitto is running well because I am using some Sonoff Wlanswitches by mosquitto too.
The log looks like this:
root@raspberrypi:/# /xwrc/xphclog/xphclogd.raspi --ini /xwrc/xphclog/xphclogd.ini
+ xPhcLogd (Linux/RbPI) ------ v4.0.0.7, Jul 2 2018, Jo Simons (c) 2007-2018
+ =============================================================================
Press CTRL-C to quit...
2019-01-15,18:56:27,00090000,A,version=4.0.0.7,Jul 2 2018
2019-01-15,18:56:27,00090010,A,legend:
2019-01-15,18:56:27,00090011,A, o0=out0-7,o1=out8-15
2019-01-15,18:56:27,00090012,A, i0=in0-7,i1=in8-15
2019-01-15,18:56:27,00090013,A, l0=out0,l1=out1,l2=out2,l3=out3 (amd/ebd/dim)
------ here I switch the lights off and on by using OH --------------
2019-01-15,18:57:00,00010210,M,omd.1.out2.off
2019-01-15,18:57:00,00010240,M,omd.1.modAck,o0=104
2019-01-15,18:57:08,00010210,M,omd.1.out2.on
2019-01-15,18:57:08,00010240,M,omd.1.modAck,o0=108
------ here I switch the lights off and on by using my xwrc "http visualisation --------------
2019-01-15,18:57:21,00010210,M,omd.1.out2.toggle
2019-01-15,18:57:21,00010240,M,omd.1.modAck,o0=104
2019-01-15,18:57:21,00010210,M,omd.0.status
2019-01-15,18:57:21,00010240,M,omd.0.modAck,o0=65
2019-01-15,18:57:23,00010210,M,omd.1.out2.toggle
2019-01-15,18:57:23,00010240,M,omd.1.modAck,o0=108
2019-01-15,18:57:23,00010210,M,omd.0.status
2019-01-15,18:57:23,00010240,M,omd.0.modAck,o0=65
------ here I switch the lights off and on by using hardware switch --------------
2019-01-15,18:57:30,00010130,M,imd.0.in3.ingt0
2019-01-15,18:57:30,00010150,M,imd.0.stmAck
2019-01-15,18:57:30,00010210,M,omd.1.out2.toggle
2019-01-15,18:57:30,00010240,M,omd.1.modAck,o0=104
2019-01-15,18:57:31,00010130,M,imd.0.in3.ingt0
2019-01-15,18:57:31,00010150,M,imd.0.stmAck
2019-01-15,18:57:31,00010210,M,omd.1.out2.toggle
2019-01-15,18:57:31,00010240,M,omd.1.modAck,o0=108
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- simonjo
- Autor
- Offline
- Gold Boarder
- Beiträge: 148
- Dank erhalten: 55
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- haribo
- Offline
- Senior Boarder
- Beiträge: 68
- Dank erhalten: 12
I'm missing the publish entries in the logfile like these:
2019-01-13,22:43:02,00010210,CPhclogd::_decodeEnhMod,omd.1.out2.toggle
2019-01-13,22:43:02,00010010,CPhclogd::_decodeEnhModPublish,topic=myHouse/cmd/omd.1.out2,payload=toggle
2019-01-13,22:43:02,00010200,CPhclogd::_decodeEnhModPublish,err=0
2019-01-13,22:43:02,00010220,CPhclogd::_decodeEnhMod,mod-ack
I think mosquitto doesn't receive messages vom xhpclogd. When you send commands with OH2 the status of the items is internaly updated.
You can trace mqtt with the following command:
root@raspberrypi:~# mosquitto_sub -d -t '#'
Client mosqsub/29368-raspberry received PUBLISH (d0, q0, r0, m0, 'myHouse/cmd/omd.7.out2', ... (6 bytes))
toggle
Client mosqsub/29368-raspberry received PUBLISH (d0, q0, r0, m0, 'myHouse/evt/omd.7', ... (2 bytes))
on
Client mosqsub/29368-raspberry received PUBLISH (d0, q0, r0, m0, 'myHouse/sta/omd.7.out.2', ... (1 bytes))
1
Client mosqsub/29368-raspberry received PUBLISH (d0, q0, r0, m0, 'myHouse/cmd/dim.1', ... (6 bytes))
status
If you only see messages from Sonoff you have to check your configuration.
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Biland
- Offline
- Senior Boarder
- Beiträge: 34
- Dank erhalten: 0
thanks for your feedback.
I try to trace mqtt and get following log:
[17:47:53] openhabian@openHABianPi:~$ mosquitto_sub -d -t '#'
Client mosqsub/2233-openHABian sending CONNECT
Client mosqsub/2233-openHABian received CONNACK
Connection Refused: not authorised.
Client mosqsub/2233-openHABian sending CONNECT
Client mosqsub/2233-openHABian received CONNACK
Connection Refused: not authorised.
Client mosqsub/2233-openHABian sending CONNECT
Client mosqsub/2233-openHABian received CONNACK
Connection Refused: not authorised.
Client mosqsub/2233-openHABian sending CONNECT
Client mosqsub/2233-openHABian received CONNACK
Connection Refused: not authorised.
^C
Here some information regarding my setup:
Raspi 1: Xwrc and xphclog / IP:192.168.1.28
xphclog.ini:
; PHC logger daemon settings
;
[phclogd]
; xPhcLogd has 2 logging modes: 0=raw, 1=enhanced, default=1
; 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=1
; xPhcLogd 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.1.28
locport=7111
; xPhcLogd 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;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
modules=imd.0-1;omd.2-3;jrm.4-5
; MQTT publish nodeid, identifies your PHC system, string upto 32 chars, default="xphclogd"
; used to compose topic in publish msgs:
; topic=<nodeid>/sta/<mod>.<addr>.<chn><nbr> ,data=0..255
; topic=<nodeid>/evt/<mod>.<addr>[.<chn><nbr>],data=<event>
; topic=<nodeid>/cmd/<mod>.<addr>[.<chn><nbr>],data=<cmd>[.<parms>]
; topic=<nodeid>/boo/<mod>.<addr> ,data=<boot-cfg>
nodeid=myHouse
; publish flags, bitwise OR of following values:
; 1: publish module status updates
; 2: publish module events
; 4: publish module commands
; 8: publish module boot info
publish=7
;
; MQTT client settings for remote broker
;
[mqttcd]
; MQTT broker remote ip address, default=127.0.0.1
;remaddr=212.72.74.21
;remaddr=85.119.83.194
remaddr=192.168.1.56
; MQTT broker remote ip port, default=1883
remport=1883
; MQTT connect username if needed to connect to broker, optional, no default
username=1234
; MQTT connect password if needed to connect to broker, optional, no default
password=1234
; MQTT connect clientid used during connect to broker, default="CMqttcd/1.0"
clientid=myHouse
Raspi 2: openhabian / IP: 192.168.1.56
On Raspi 2 there is running openhab with MQTT Binding.
mqtt.cfg:
# Define your MQTT broker connections here for use in the MQTT Binding or MQTT
# Persistence bundles. Replace <broker> with an ID you choose.
#
# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
broker.url=tcp://localhost:1883
# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a random default is generated.
broker.clientId=openhab2
# Optional. True or false. If set to true, allows the use of clientId values
# up to 65535 characters long. Defaults to false.
# NOTE: clientId values longer than 23 characters may not be supported by all
# MQTT servers. Check the server documentation.
#<broker>.allowLongerClientIds=false
# Optional. User id to authenticate with the broker.
#<broker>.user=<user>
# Optional. Password to authenticate with the broker.
#<broker>.pwd=<password>
# Optional. Set the quality of service level for sending messages to this broker.
# Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2
# (Deliver exactly once). Defaults to 0.
#<broker>.qos=<qos>
# Optional. True or false. Defines if the broker should retain the messages sent to
# it. Defaults to false.
#<broker>.retain=<retain>
# Optional. True or false. Defines if messages are published asynchronously or
# synchronously. Defaults to true.
#<broker>.async=<async>
# Optional. Defines the last will and testament that is sent when this client goes offline
# Format: topic:message:qos:retained <br/>
#<broker>.lwt=<last will definition>
broker.user=1234
broker.pwd=1234
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- simonjo
- Autor
- Offline
- Gold Boarder
- Beiträge: 148
- Dank erhalten: 55
modules=jrm.4;jrm.5
2) can you start xphclogd with extra parameter: --loglevel 0xFFFFFFFF
Put the logging here so I can check what is going wrong
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Biland
- Offline
- Senior Boarder
- Beiträge: 34
- Dank erhalten: 0
here is a log of my system:
root@raspberrypi:~# /xwrc/xphclog/xphclogd.raspi --ini /xwrc/xphclog/xphclogd.ini --loglevel 0xFFFFFFFF
+ xPhcLogd (Linux/RbPI) ------ v4.0.0.7, Jul 2 2018, Jo Simons (c) 2007-2018
+ =============================================================================
Press CTRL-C to quit...
2019-01-17,18:20:57,00090000,A,version=4.0.0.7,Jul 2 2018
2019-01-17,18:20:57,00090010,A,legend:
2019-01-17,18:20:57,00090011,A, o0=out0-7,o1=out8-15
2019-01-17,18:20:57,00090012,A, i0=in0-7,i1=in8-15
2019-01-17,18:20:57,00090013,A, l0=out0,l1=out1,l2=out2,l3=out3 (amd/ebd/dim)
2019-01-17,18:21:17,00010210,M,omd.1.status
2019-01-17,18:21:17,00010240,M,omd.1.modAck,o0=108
2019-01-17,18:21:17,00010210,M,omd.0.status
2019-01-17,18:21:17,00010240,M,omd.0.modAck,o0=65
2019-01-17,18:21:18,00010210,M,omd.1.out6.toggle
2019-01-17,18:21:18,00010240,M,omd.1.modAck,o0=44
2019-01-17,18:21:18,00010210,M,omd.0.status
2019-01-17,18:21:18,00010240,M,omd.0.modAck,o0=65
2019-01-17,18:21:19,00010210,M,omd.1.out6.toggle
2019-01-17,18:21:19,00010240,M,omd.1.modAck,o0=108
2019-01-17,18:21:19,00010210,M,omd.0.status
2019-01-17,18:21:19,00010240,M,omd.0.modAck,o0=65
2019-01-17,18:21:31,00010130,M,imd.0.in1.outlt1
2019-01-17,18:21:31,00010150,M,imd.0.stmAck
2019-01-17,18:21:31,00010210,M,omd.1.out6.toggle
2019-01-17,18:21:31,00010240,M,omd.1.modAck,o0=44
2019-01-17,18:21:31,00010130,M,imd.0.in1.outlt1
2019-01-17,18:21:31,00010150,M,imd.0.stmAck
2019-01-17,18:21:31,00010210,M,omd.1.out6.toggle
2019-01-17,18:21:31,00010240,M,omd.1.modAck,o0=108
And a log of my MQTT Binding of the Raspberry with Openhab:
[18:23:27] openhabian@openHABianPi:~$ mosquitto_sub -d -t '#'
Client mosqsub/15882-openHABia sending CONNECT
Client mosqsub/15882-openHABia received CONNACK
Connection Refused: not authorised.
Client mosqsub/15882-openHABia sending CONNECT
Client mosqsub/15882-openHABia received CONNACK
Connection Refused: not authorised.
Client mosqsub/15882-openHABia sending CONNECT
Client mosqsub/15882-openHABia received CONNACK
Connection Refused: not authorised.
Client mosqsub/15882-openHABia sending CONNECT
Client mosqsub/15882-openHABia received CONNACK
Connection Refused: not authorised.
^C
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Biland
- Offline
- Senior Boarder
- Beiträge: 34
- Dank erhalten: 0
After uninstall an new installation of mqtt the status update of ligths in my OH works fine! Thanks a lot for your support!
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Biland
- Offline
- Senior Boarder
- Beiträge: 34
- Dank erhalten: 0
How can I adjust that xphclog will start automatical after rebooting my raspi?
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- haribo
- Offline
- Senior Boarder
- Beiträge: 68
- Dank erhalten: 12
look at
raspberry.tips/raspberrypi-einsteiger/ra...rogrammen-einrichten
and attached sample file (remove extension .txt).
Harald
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Biland
- Offline
- Senior Boarder
- Beiträge: 34
- Dank erhalten: 0
Long time go since I was active here. First I want to wish you happy eastern.
I hope that you or somebody can help me... on my Raspberry i have Update Openhab to Version 2.5 this means that the mqtt structure is a little bit different.
My Sonoffs are working find. Also i am able to switch on and off the lights of my PHC system by HTTP. But the status dont update by xphclog and mqtt. hope that you can help me....
Here are my settings:
;
[phclogd]
; xPhcLogd has 2 logging modes: 0=raw, 1=enhanced, default=1
; 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=1
; xPhcLogd 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.1.75
locport=7111
; xPhcLogd 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;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
modules=imd.1;omd.2;jrm.3
; MQTT publish nodeid, identifies your PHC system, string upto 32 chars, default="xphclogd"
; used to compose topic in publish msgs:
; topic=<nodeid>/sta/<mod>.<addr>.<chn><nbr> ,data=0..255
; topic=<nodeid>/evt/<mod>.<addr>[.<chn><nbr>],data=<event>
; topic=<nodeid>/cmd/<mod>.<addr>[.<chn><nbr>],data=<cmd>[.<parms>]
; topic=<nodeid>/boo/<mod>.<addr> ,data=<boot-cfg>
nodeid=myHouse
; publish flags, bitwise OR of following values:
; 1: publish module status updates
; 2: publish module events
; 4: publish module commands
; 8: publish module boot info
publish=7
;
; MQTT client settings for remote broker
;
[mqttcd]
; MQTT broker remote ip address, default=127.0.0.1
;remaddr=212.72.74.21
;remaddr=85.119.83.194
remaddr=192.168.1.75
; MQTT broker remote ip port, default=1883
remport=1883
; MQTT connect username if needed to connect to broker, optional, no default
username=openhabian
; MQTT connect password if needed to connect to broker, optional, no default
;password=openhabian
; MQTT connect clientid used during connect to broker, default="CMqttcd/1.0"
clientid=myHouse
Here are my items:
and an Item of Sonoff:
and the Thing for the Sonoff:
Bridge mqtt:broker:broker "MQTT" [ host="192.168.1.75", port=1883, secure=false, username="openhabian", clientID="openhab" ]
{
Thing topic shelly-flur "shelly Flur" {
Channels:
Type switch : Power "Licht" [ stateTopic="stat/sonoff-LichtEingang/POWER", commandTopic="cmnd/sonoff-LichtEingang/POWER"]
} }
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Jan
- Offline
- Junior Boarder
- Beiträge: 17
- Dank erhalten: 2
What MQTT binding of OpenHAB are you using?
I also tried to convert my setup to the new MQTT binding structure but didn't succeed. The asymmetrical structure of the command (>http and <mqtt) doesn't seem to fit in the new concept.
Therefore I installed the legacy binding MQTT (1.x) and kept the old structure and this works fine, also with OH 2.5. But I'm afraid that this old binding will not be kept/supported forever. So if somebody knows how to convert the PHC steering to the new MQTT structure I would be thankful.
Also, I don't know if you can use the old and new binding together.
Br,
Jan
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Biland
- Offline
- Senior Boarder
- Beiträge: 34
- Dank erhalten: 0
I hope you had a nice Easter.
After a few tries, I got it working.
Here my *.items / *.things (MQTT Binding 2.5.1):
/*
Erdgeschoss
*/
Switch Light_GF_Kitchen "Deckenleuchte Esstisch" (GF_Living, Info) { http=">[ON:GET:http://192.168.1.75:9999/icontrol.dll?ccmd=omd.1.out2.on] >[OFF:GET:http://192.168.1.75:9999/icontrol.dll?ccmd=omd.1.out2.off]", channel="mqtt:topic:broker:peha-phc:DLESST" }
Bridge mqtt:broker:broker "MQTT" [ host="192.168.1.75", port=1883, secure=false, username="openhabian", clientID="openhab" ]
{
Thing topic peha-phc "PHC" {
Channels:
Type switch : DLESST "Deckenleuchte Wohnzimmer" [ stateTopic="myHouse/sta/omd.1.out.2"]
}}
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Jan
- Offline
- Junior Boarder
- Beiträge: 17
- Dank erhalten: 2
Thank you very much for the example, with that I started to convert my OH2 setup to latest MQTT version.
I successfully created Type 'switch' channels but didn't succeed with the Type 'contact' channels (works only when I create them as a Type 'string'). Do you have an example for that?
Kind regards,
Jan
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- BNBN
- Offline
- Fresh Boarder
- Beiträge: 2
- Dank erhalten: 1
I've tried to use xphclogd and was finally (after one week) successfull. This were my two pitfalls:
I use a Moxa nport 5210 for xwrc (port1) and for xphclogd (port2) I use the setup of Harald (thx for the input). The wiring was a bit tricky. This works for me: xwrc is connected to the upper right part of the STM 940 and port 2 is connected to the SPV lower left part. I only have connected the RX cable to the B connection as my XWRC on port 1 already has a GND connection.
The next part is the software setup. The locaddr is the ip address of the raspberry where xphclogd is running not the nport ip address. After that the software starts and logs the data from the phc system.
BR
Bjoern
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Aktuelle Seite:
- Startseite
- Forum
- PHC-Forum
- Visualisierung
- xPhcLog, log events on the PHC module bus