Using mqttGateway2.pl for Serial to MQTT on RaspberryPI
-
Try typing
"uname -m"into your console (that hosts the gateway). If it does not say
"armv6l" or "armv7l" (edit: correction)
then the Makefile will not include -lrf24-bcm in the LDFLAGS (libraries include). If this is the problem then what hardware are you making the gateway on? -
Try typing
"uname -m"into your console (that hosts the gateway). If it does not say
"armv6l" or "armv7l" (edit: correction)
then the Makefile will not include -lrf24-bcm in the LDFLAGS (libraries include). If this is the problem then what hardware are you making the gateway on? -
Hi, i tried to make the script work but i couldnt. did anybody make it work? I used the serial gateway option, installed all the libraries.
. thankspi@raspberrypi:/ $ sudo ./mqttGateway2.pl --serial /dev/ttyUSB0
Subroutine main::inet_aton redefined at /usr/share/perl/5.20/Exporter.pm line 66.
at ./mqttGateway2.pl line 42.
given is experimental at ./mqttGateway2.pl line 267.
when is experimental at ./mqttGateway2.pl line 269.
when is experimental at ./mqttGateway2.pl line 270.
when is experimental at ./mqttGateway2.pl line 271.
when is experimental at ./mqttGateway2.pl line 272.
Smartmatch is experimental at ./mqttGateway2.pl line 313.
Smartmatch is experimental at ./mqttGateway2.pl line 332.
given is experimental at ./mqttGateway2.pl line 400.
when is experimental at ./mqttGateway2.pl line 402.
when is experimental at ./mqttGateway2.pl line 411.
Name "main::fh" used only once: possible typo at ./mqttGateway2.pl line 207.
can't create /var/run/mqttMySensors/Gateway__dev_ttyUSB0: No existe el fichero o el directorio at ./mqttGateway2.pl line 452.
What does it means?
Thanks -
@Yveaux Keep on getting this error
-
Hi, i tried to make the script work but i couldnt. did anybody make it work? I used the serial gateway option, installed all the libraries.
. thankspi@raspberrypi:/ $ sudo ./mqttGateway2.pl --serial /dev/ttyUSB0
Subroutine main::inet_aton redefined at /usr/share/perl/5.20/Exporter.pm line 66.
at ./mqttGateway2.pl line 42.
given is experimental at ./mqttGateway2.pl line 267.
when is experimental at ./mqttGateway2.pl line 269.
when is experimental at ./mqttGateway2.pl line 270.
when is experimental at ./mqttGateway2.pl line 271.
when is experimental at ./mqttGateway2.pl line 272.
Smartmatch is experimental at ./mqttGateway2.pl line 313.
Smartmatch is experimental at ./mqttGateway2.pl line 332.
given is experimental at ./mqttGateway2.pl line 400.
when is experimental at ./mqttGateway2.pl line 402.
when is experimental at ./mqttGateway2.pl line 411.
Name "main::fh" used only once: possible typo at ./mqttGateway2.pl line 207.
can't create /var/run/mqttMySensors/Gateway__dev_ttyUSB0: No existe el fichero o el directorio at ./mqttGateway2.pl line 452.
What does it means?
Thanks -
@cingolanifede said:
/var/run/mqttMySensors/Gateway__dev_ttyUSB0: No existe el fichero o el directorio at
This path doesn't exist. Create it, or change the path.
All others are warnings, due to an incompatible perl version you're using.@Yveaux ok. Thanks. I did it. But i am having a different problem now. I have serial gateway running fine. I installed mosquitto and try to follow different steps from the forum and I dont know how to make this work.K cant make the connection beetwen openhab--mosquitto-script--serial gateway. Can you help me ? Is there any post where this is done? Thanks in advance.
-
@Yveaux ok. Thanks. I did it. But i am having a different problem now. I have serial gateway running fine. I installed mosquitto and try to follow different steps from the forum and I dont know how to make this work.K cant make the connection beetwen openhab--mosquitto-script--serial gateway. Can you help me ? Is there any post where this is done? Thanks in advance.
@cingolanifede I don't have a step by step description for your solution. Searching (and reading) the forum sounds like a good start. If you give us a clear description of what seems to be working and what not, or where you get stuck, it's easier to help.
-
@cingolanifede I don't have a step by step description for your solution. Searching (and reading) the forum sounds like a good start. If you give us a clear description of what seems to be working and what not, or where you get stuck, it's easier to help.
@Yveaux 1) The script is running. It reads from serial port, this is what I get, then it crashes, and says broken pipe.
20160509-10:48:33 RX: [0;0;3;0;9;read: 30-30-0 s=1,c=1,t=16,pt=2,l=2,sg=1:1] fr=000 ci=000 c=C_INTERNAL st=I_LOG_MESSAGE noack 'read: 30-30-0 s=1,c=1,t=16,pt=2,l=2,sg=1:1' -> Publish to broker 'MyMQTT/0/0/I_LOG_MESSAGE':'read: 30-30-0 s=1,c=1,t=16,pt=2,l=2,sg=1:1'
20160509-10:48:33 RX: [30;1;1;0;16;1 ] fr=030 ci=001 c=C_SET st=V_TRIPPED noack '1' -> Publish to broker 'MyMQTT/30/1/V_TRIPPED':'1'
20160509-10:48:43 Exception: Error: Tubería rota20160509-10:48:43 Restarting...
20160509-10:48:43 trying to restore subscriptions====2)On openhab log I get this========
2016-05-09 10:48:33.189 [ERROR] [o.i.t.m.i.MqttBrokerConnection] - MQTT connection to broker was lost
org.eclipse.paho.client.mqttv3.MqttException: Se ha perdido la conexión
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:138) [mqtt-client-0.4.0.jar:na]
at java.lang.Thread.run(Thread.java:744) [na:1.8.0]
Caused by: java.io.EOFException: null
at java.io.DataInputStream.readByte(DataInputStream.java:267) ~[na:1.8.0]
at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:56) ~[na:na]
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:100) [mqtt-client-0.4.0.jar:na]
... 1 common frames omitted
2016-05-09 10:48:33.191 [ERROR] [o.i.t.m.i.MqttBrokerConnection] - MQTT connection to 'mysensor' was lost: Se ha perdido la conexión : ReasonCode 32109 : Cause : null
2016-05-09 10:48:33.193 [INFO ] [o.i.t.m.i.MqttBrokerConnection] - Starting connection helper to periodically try restore connection to broker 'mysensor'On openhab.cfg i put this and i have the addons installed
mqtt:mysensor.url=tcp://192.168.1.109:1883
mqtt:mysensor.clientId=mysA simple switch setting
Switch node2_sw1 "sw1" (node2,all) {mqtt=">[mysensor:MyMQTT/30/10/V_LIGHT:command:ON:1],>[mysensor:MyMQTT/30/10/V_LIGHT:command:OFF:0]"}I think the problem is that i am not setting mosquitto well beetwen openhab and your script. I tested an example publishing and i get the message. Do I have to change conf.d file? or setting?
Thanks.
-
@Yveaux I made improvement:
I am using mosquitto_sub to read what the script posted. Thats ok.pi@domotic /opt/domotic/runtime $ mosquitto_sub -d -t MyMQTT/30/1/V_TRIPPED
Client mosqsub/3629-domotic sending CONNECT
Client mosqsub/3629-domotic received CONNACK
Client mosqsub/3629-domotic sending SUBSCRIBE (Mid: 1, Topic: MyMQTT/30/1/V_TRIPPED, QoS: 0)
Client mosqsub/3629-domotic received SUBACK
Subscribed (mid: 1): 0
Client mosqsub/3629-domotic received PUBLISH (d0, q0, r1, m0, 'MyMQTT/30/1/V_TRIPPED', ... (1 bytes))
1
Client mosqsub/3629-domotic received PUBLISH (d0, q0, r0, m0, 'MyMQTT/30/1/V_TRIPPED', ... (1 bytes))
0
Client mosqsub/3629-domotic sending PINGREQ
Client mosqsub/3629-domotic received PINGRESP
Client mosqsub/3629-domotic sending PINGREQ
Client mosqsub/3629-domotic received PINGRESP
Client mosqsub/3629-domotic sending PINGREQ
Client mosqsub/3629-domotic received PINGRESPThe thing is when I start openhab this happens, it crashes and i get this error. What could it be?
2016-05-09 11:56:52.216 [ERROR] [o.i.t.m.i.MqttBrokerConnection] - MQTT connection to broker was lost
org.eclipse.paho.client.mqttv3.MqttException: Se ha perdido la conexión
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:138) [mqtt-client-0.4.0.jar:na]
at java.lang.Thread.run(Thread.java:744) [na:1.8.0]
Caused by: java.io.EOFException: null
at java.io.DataInputStream.readByte(DataInputStream.java:267) ~[na:1.8.0]
at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:56) ~[na:na]
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:100) [mqtt-client-0.4.0.jar:na]
... 1 common frames omitted
2016-05-09 11:56:52.219 [ERROR] [o.i.t.m.i.MqttBrokerConnection] - MQTT connection to 'mysensor' was lost: Se ha perdido la conexión : ReasonCode 32109 : Cause : null
2016-05-09 11:56:52.220 [INFO ] [o.i.t.m.i.MqttBrokerConnection] - Starting connection helper to periodically try restore connection to broker 'mysensor' -
The script is running for months without issues on my place; both for serial and Ethernet gateway. I am not using the script in combination with a raspberry pi. Maybe there is an issue with the version of mosquitto and/or AnyEvent::MQTT.
I remember other people having issues in combination with raspberry pi - search the forum. -
The script is running for months without issues on my place; both for serial and Ethernet gateway. I am not using the script in combination with a raspberry pi. Maybe there is an issue with the version of mosquitto and/or AnyEvent::MQTT.
I remember other people having issues in combination with raspberry pi - search the forum.@Yveaux Thanks again. I used a phyton script. Now is working.
-
Not sure I'm doing this right way, but changing this line:
fh => $serialDevice->{'HANDLE'},to this line
fh => new_from_fd IO::Handle ($serialDevice->{FD}, "w"),Fixed
Filehandle GEN0 opened only for inputbug for me on RPi 2. Fix works because of$serialDevice->{'HANDLE'}is opened as read only in SerialDevice and should not be used for write:# a handle object for ioctls: read-only ok $self->{HANDLE} = new_from_fd IO::Handle ($self->{FD}, "r");
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login