@ricorico94 to update your install run:
sudo make install
sudo systemctl restart mysgw.service
@ricorico94 to update your install run:
sudo make install
sudo systemctl restart mysgw.service
@pii Try to connect the IRQ pin from the radio to another GPIO on your Orange Pi, for example the GPIO2.
#define MY_RFM95_IRQ_PIN 2
@pii --my-rfm95-cs-pin and --my-rfm95-irq-pin options are not currently supported by the configure script.
Until we fix this, could you please try adding the following to your examples_linux/mysgw.cpp (before the #include <MySensors.h>)
#define MY_RFM95_CS_PIN 13
#define MY_RFM95_IRQ_PIN 10
#define MY_RFM95_FREQUENCY RFM95_915MHZ
and run the make command again.
The two patches to fix ethernet stability have been merger into the development branch, and also some changes to the gateway logging. I updated the build instructions to reflect the changes.
@masmat This is my mosquitto.log
1521680648: mosquitto version 1.4.10 (build date Fri, 22 Dec 2017 08:19:25 +0000) starting
1521680648: Config loaded from /etc/mosquitto/mosquitto.conf.
1521680648: Opening ipv4 listen socket on port 1883.
1521680648: Opening ipv6 listen socket on port 1883.
1521762617: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1521763549: New connection from 127.0.0.1 on port 1883.
1521763549: New client connected from 127.0.0.1 as mygateway1 (c1, k15, u'rpi').
A socket error message:
1521764339: Socket error on client mygateway1, disconnecting.
shows only if I stop/exit mysgw.
@gohan Sorry to hear that, mysgw doesn't change any system files, a simple reboot and rebuild of the gateway should be enough to resume communication in a case of more serious error.
@mvader The gateway will respond with an I_VERSION every time a controller connected to port 5003 sends an I_VERSION request.
@masmat I did a test with the following configuration:
Raspberry Pi 1 with Raspbian (2017-11-29-raspbian-stretch-lite)
pi@raspberrypi:~/MySensors $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 9.1 (stretch)
Release: 9.1
Codename: stretch
MySensors master branch - Protocol version - 2.2.0
./configure --my-transport=nrf24 --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=m ygateway1 --my-mqtt-user=rpi --my-mqtt-password=password
Mosquitto version 1.4.10 (build date Fri, 22 Dec 2017 08:19:25 +0000) [installed from apt-get]
pi@raspberrypi:~/MySensors $ cat /etc/mosquitto/mosquitto.conf
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
allow_anonymous false
password_file /etc/mosquitto/passwordfile
include_dir /etc/mosquitto/conf.d
Added the mosquitto user (user=rpi, password=password) with:
sudo mosquitto_passwd -c /etc/mosquitto/passwordfile rpi
It didn't show any error to connect to the MQTT broker:
pi@raspberrypi:~/MySensors $ sudo ./bin/mysgw -d
mysgw: Starting gateway...
mysgw: Protocol version - 2.2.0
mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0
mysgw: TSF:LRT:OK
mysgw: TSM:INIT
mysgw: TSF:WUR:MS=0
mysgw: TSM:INIT:TSP OK
mysgw: TSM:INIT:GW MODE
mysgw: TSM:READY:ID=0,PAR=0,DIS=0
mysgw: MCO:REG:NOT NEEDED
mysgw: MCO:BGN:STP
mysgw: MCO:BGN:INIT OK,TSP=1
mysgw: GWT:RMQ:MQTT RECONNECT
mysgw: connected to 127.0.0.1
mysgw: GWT:RMQ:MQTT CONNECTED
mysgw: GWT:TPS:TOPIC=mysensors-out/0/255/0/0/18,MSG SENT
mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
mysgw: TSF:MSG:PINGED,ID=5,HP=1
mysgw: TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=32,pt=5,l=4,sg=0:500
mysgw: GWT:TPS:TOPIC=mysensors-out/5/255/3/0/32,MSG SENT
mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=33,pt=5,l=4,sg=0:4951
mysgw: GWT:TPS:TOPIC=mysensors-out/5/255/3/0/33,MSG SENT
mysgw: TSF:MSG:READ,5-5-0,s=1,c=1,t=37,pt=4,l=4,sg=0:36053
mysgw: GWT:TPS:TOPIC=mysensors-out/5/1/1/0/37,MSG SENT
mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=32,pt=5,l=4,sg=0:500
mysgw: GWT:TPS:TOPIC=mysensors-out/5/255/3/0/32,MSG SENT
mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=33,pt=5,l=4,sg=0:5000
mysgw: GWT:TPS:TOPIC=mysensors-out/5/255/3/0/33,MSG SENT
mysgw: TSF:MSG:READ,5-5-0,s=1,c=1,t=37,pt=4,l=4,sg=0:36055
mysgw: GWT:TPS:TOPIC=mysensors-out/5/1/1/0/37,MSG SENT
mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=32,pt=5,l=4,sg=0:500
mysgw: GWT:TPS:TOPIC=mysensors-out/5/255/3/0/32,MSG SENT
mysgw: TSF:MSG:READ,5-5-0,s=255,c=3,t=33,pt=5,l=4,sg=0:5000
mysgw: GWT:TPS:TOPIC=mysensors-out/5/255/3/0/33,MSG SENT
mysgw: TSF:MSG:READ,5-5-0,s=1,c=1,t=37,pt=4,l=4,sg=0:36055
mysgw: GWT:TPS:TOPIC=mysensors-out/5/1/1/0/37,MSG SENT
@gieljnssns One way is to replace the changed files, in this case EthernetServer.cpp for the first patch and EthernetClient.cpp for the second patch.
You can download from:
https://raw.githubusercontent.com/marceloaqno/MySensors/linux-fix-stability/drivers/Linux/EthernetServer.cpp
https://raw.githubusercontent.com/marceloaqno/MySensors/linux-fix-stability/drivers/Linux/EthernetClient.cpp
Here is a step-by-step:
git clone https://github.com/mysensors/MySensors.git
cd MySensors
curl https://raw.githubusercontent.com/marceloaqno/MySensors/linux-fix-stability/drivers/Linux/EthernetServer.cpp -o drivers/Linux/EthernetServer.cpp
curl https://raw.githubusercontent.com/marceloaqno/MySensors/linux-fix-stability/drivers/Linux/EthernetClient.cpp -o drivers/Linux/EthernetClient.cpp
from here just run ./configure with your options and then make
@masmat What is the mqtt broker / version you are using?
@otto001 The second patch can be applied without the first one.
@gieljnssns The fixes I mentioned above haven't yet been applied to the development branch. Eventually they will be, but I'm still doing some testing.
@otto001 After a few hours running the reconnect script, I noticed several error messages in my gateway log:
accept(): Too many open files
The problem was that the gateway wasn't releasing the socket descriptor after each disconnection of the controller. After reaching the limit (mine was 1036) the controller can't connect.
I'm not entirely sure that this problem is related to what you're having. You can check how many file descriptors currently opened by the gateway with the command below
sudo lsof -u root |grep mysgw |wc -l
The fix:
https://github.com/marceloaqno/MySensors/commit/a40d4441b7460225100398ff6f2581c2b0df36ea
@otto001 In a new attempt to trigger this problem, I am using a script that will force the fhem controller to reconnect every 30s to the gateway (built with mysensors master branch, unpatched), and sends me a note in case of high CPU usage:
I'll leave it running for a few days to see what happens.
Here is the script, if anyone is interested:
#!/bin/sh
while true; do
(echo "set mysgw disconnect"; echo "quit") | telnet localhost 7072 > /dev/null 2>&1
sleep 1
(echo "set mysgw connect"; echo "quit") | telnet localhost 7072 > /dev/null 2>&1
sleep 1
cpu_percent=$(ps -C "mysgw" -o %cpu=)
cpu_percent=${cpu_percent%%.*}
if [ "$cpu_percent" -ge 90 ]
then
echo "ALERT: HIGH CPU USAGE"
# pushbullet script from https://gist.github.com/outadoc/189bd3ccbf5d6e0f39e4
/home/pi/pushbullet.sh "RPi1: HIGH CPU USAGE"
exit
fi
sleep 30
done
@otto001 I'm trying to reproduce this problem, but so far I've got nothing beyond the normal behavior of mysgw.
I tried with a RPi1 and RPi3 using the fhem controller with the latest raspbian.
@otto001 I think I found the problem. I wrote a fix for it:
https://github.com/marceloaqno/MySensors/commit/ca8865d8e1fe1b08195943fae1640d5fddb81924
Please, could all of you who experienced this issue post the configuration options you used to build the gateway?
This would help to investigate the problem.
@syna It is empty because it's a message of type I_ID_REQUEST that your node is sending. You need to set up a controller to distribute IDs or you can set it manually by adding this to your node's sketch:
#define MY_NODE_ID X
where X is a unique number from 1 to 254.
@affordabletech Playing with custom transport isn't that hard. Here is an unfinished example if you want to follow this path (sorry, I did it in a hurry, so maybe it isn't very self explanatory):
https://github.com/marceloaqno/MySensors/commit/696d0d3993d88b2dc4565db6cb12f57a461372ad
I think there has never been much interest in creating an ethernet transport before, given the fact that mysensors don't support multiple transports. But there is some work being done to change that.
Building a node-to-node network using Ethernet with a standard client-server topology wouldn't be an easy task, I don't know how you intend to do it, but MQTT could help you with that.
@alowhum yes, to use MY_SIGNING_SIMPLE_PASSWD feature, add the following to your list of configure options:
... --my-signing=password --my-signing-password=<PASSWORD>