💬 Building a Raspberry Pi Gateway
-
I am new to Linux and hopefully have an easy question...
I have followed the build instructions and everything seems to be working well so far. One issue I'm having is getting node-red to see the usb port (/dev/ttyUSB020). I did some searching online and found that if I run the following command node-red will see the port and things start working.sudo chmod 666 /dev/ttyUSB020The problem is that each time I reboot the Pi the command needs to be run again. Does anyone have any ideas on how I can resolve this so I don't need to run the command each time the system is booted? Thanks in advance.
-
@petewill or you can compile the gateway as ethernet or mqtt that are both supported by node-red, making life a little easier
@gohan Sorry, I did not see your reply earlier. I tried an ethernet gateway in node-red a while ago and could never get it to work with Vera. There was some port conflicts or something. I have never played with mqtt. I need to learn it at some point but I am hoping to finish this project so I can move on to some others. :) Do you think I will gain significant advantages by using that over a serial/usb gateway?
-
From a node-red perspective, IMHO, mqtt is easier to handle even without specific mysensors nodes, but it all depends what you need to do. I played with it some months ago but I got stuck when I had to start using javascript as I still don't know that language, but it was quite easy to link mysensors values to the dashboard without actually touching any code.
-
From a node-red perspective, IMHO, mqtt is easier to handle even without specific mysensors nodes, but it all depends what you need to do. I played with it some months ago but I got stuck when I had to start using javascript as I still don't know that language, but it was quite easy to link mysensors values to the dashboard without actually touching any code.
-
I compiled the gateway for spi1 because I have a display using spi0. Two problems I came across:
- the master branch doesn't work. It compiles, it seems to work but it never receives anything.
- the development branch works but I needed to define the right cs-pin even if I redirected the pin in config.txt (with
dtoverlay=spi1-1cs,cs0_pin=16)
The following configure worked for me:
./configure --spi-driver=SPIDEV --spi-spidev-device=/dev/spidev1.0 --my-rf24-cs-pin=36 --my-rf24-ce-pin=33 --my-rf24-irq-pin=31 -
For the ones having problems with the stable build (Version 2.1.1), always getting "mysgw: !TSM:INIT:TSP FAIL":
Seems there is a bug, you have to install "development" (Version 2.2.0)
Maybe someone adds an note on top of the tutorial, so others won´t also spend hours in searching for the problem on their Pi/Hardware. -
So far it looks to me it is something related to the latest versions of Linux since it was working on older releases
-
@gohan ah okay wasn´t aware of it, as the dev channel worked I assumed the bug at MySensors.
However, would be awesome if there were a little hint in the tutorial. Took plenty of time to find out it was an software incompability ;) -
Today my rPi gateway (2.1.1 stable) completely stopped working as a service (cli surprisingly worked), I thought that could be some debian update so I switched to devel, but when building it I get this:
LINUX_ARCH_RASPBERRYPI -DMY_PORT=5003 -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=18 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/BCM/bcm2835.c -o build/drivers/BCM/bcm2835.o
drivers/BCM/bcm2835.c: In function ‘bcm2835_delayMicroseconds’:
drivers/BCM/bcm2835.c:441:40: error: expected ‘)’ before ‘PRIu64’
printf("bcm2835_delayMicroseconds %" PRIu64 "\n", micros);
^
drivers/BCM/bcm2835.c:441:40: warning: spurious trailing ‘%’ in format [-Wformat=]
Makefile:102: recipe for target 'build/drivers/BCM/bcm2835.o' failed
make: *** [build/drivers/BCM/bcm2835.o] Error 1Is this normal? I used the same configure was working before.
-
Today my rPi gateway (2.1.1 stable) completely stopped working as a service (cli surprisingly worked), I thought that could be some debian update so I switched to devel, but when building it I get this:
LINUX_ARCH_RASPBERRYPI -DMY_PORT=5003 -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=18 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/BCM/bcm2835.c -o build/drivers/BCM/bcm2835.o
drivers/BCM/bcm2835.c: In function ‘bcm2835_delayMicroseconds’:
drivers/BCM/bcm2835.c:441:40: error: expected ‘)’ before ‘PRIu64’
printf("bcm2835_delayMicroseconds %" PRIu64 "\n", micros);
^
drivers/BCM/bcm2835.c:441:40: warning: spurious trailing ‘%’ in format [-Wformat=]
Makefile:102: recipe for target 'build/drivers/BCM/bcm2835.o' failed
make: *** [build/drivers/BCM/bcm2835.o] Error 1Is this normal? I used the same configure was working before.
@Sergio-Rius a fix is available at https://github.com/mysensors/MySensors/pull/983
It is a one line change so you can just add it manually
-
Thaaanksss! I'll give it a go :)
-
@mfalkvidd Mmmmm... that worked, but now I'm always getting "mysgw: !TSM:INIT:TSP FAIL" as stated avobe. But I'm on development.
Wait, seems that after the 8'th intent it's working. I'll let him go and see. -
I'm afraid that after some time it stops working. I get in Domoticz:
2017-11-12 19:17:01.744 MySensors: trying to connect to: 127.0.0.1:5003
2017-11-12 19:17:02.744 TCP: Connection problem (Unable to connect to specified IP/Port)
2017-11-12 19:17:02.744 TCP: Reconnecting in 30 seconds...Over and over again.
$ sudo systemctl status mysgw.service
● mysgw.service - MySensors Gateway daemon
Loaded: loaded (/etc/systemd/system/mysgw.service; enabled)
Active: failed (Result: signal) since dom 2017-11-12 19:16:53 CET; 5min ago
Process: 491 ExecStart=/usr/local/bin/mysgw (code=killed, signal=SEGV)
Main PID: 491 (code=killed, signal=SEGV)
nov 12 19:16:47 Domoticz systemd[1]: Started MySensors Gateway daemon.
nov 12 19:16:48 Domoticz mysgw[491]: Starting gateway...
nov 12 19:16:48 Domoticz mysgw[491]: Protocol version - 2.2.0-rc.1
nov 12 19:16:53 Domoticz systemd[1]: mysgw.service: main process exited, code=killed, status=11/SEGV
nov 12 19:16:53 Domoticz systemd[1]: Unit mysgw.service entered failed state.But it seems Domoticz being crashing it.
If I do restart the service, Domoticz picks it and works for a while.2017-11-12 19:24:17.562 TCP: Connection problem (Unable to connect to specified IP/Port)
2017-11-12 19:24:17.562 TCP: Reconnecting in 30 seconds...
2017-11-12 19:24:47.565 TCP: Reconnecting...
2017-11-12 19:24:47.565 MySensors: connected to: 127.0.0.1:5003
2017-11-12 19:24:48.566 MySensors: Gateway Ready...
2017-11-12 19:24:48.566 MySensors: Gateway Version: 2.2.0-rc.1
2017-11-12 19:24:49.566 MySensors: Gateway Version: 2.2.0-rc.1Is there any further log for exactly seeing what is the crash cause?
EDIT: Also it seems that there's any comunication at all. I only get internal heartbeats on MysController.
-
@gohan Yep! I exactly ran this command:
git clone https://github.com/mysensors/MySensors.git --branch development && cd MySensorsI'm now powering off my rPi for changing the PA+LNA radio for a standard one and bypassing the power regulator.
EDIT: I've done the above tasks and still getting strange things. It may be Domoticz as:
2017-11-12 19:44:37.634 MySensors: trying to connect to: 127.0.0.1:5003
2017-11-12 19:44:37.638 RFXCOM: Using serial port: /dev/ttyUSB0
2017-11-12 19:44:38.213
2017-11-12 19:44:38.288 Error: RFXCOM: Invalid data received!....
2017-11-12 19:44:38.635 MySensors: connected to: 127.0.0.1:5003
2017-11-12 19:44:38.635 MySensors: Gateway Ready...
2017-11-12 19:44:39.635 MySensors: Gateway Version: 2.2.0-rc.1
2017-11-12 19:44:39.635 MySensors: Gateway Version: 2.2.0-rc.1
...
2017-11-12 20:26:00.153 Error: Scheduler thread seems to have ended unexpectedly
2017-11-12 20:26:00.154 Error: MySGW_NRF hardware (9) thread seems to have ended unexpectedly
2017-11-12 20:26:00.154 Error: RFXCOM hardware (15) thread seems to have ended unexpectedly
2017-11-12 20:26:00.154 Error: RFXCOM hardware (15) nothing received for more than 30 Minutes!....
2017-11-12 20:26:01.155 Error: Restarting: RFXCOM
2017-11-12 20:26:01.707 RFXCOM: Serial Worker stopped...
2017-11-12 20:26:02.722 RFXCOM: Using serial port: /dev/ttyUSB0
2017-11-12 20:26:03.297
2017-11-12 20:26:03.372 Error: RFXCOM: Invalid data received!....
2017-11-12 20:26:16.745 (RFXCOM) Temp + Humidity (Biblioteca [TH])
2017-11-12 20:26:48.745 Error: PROXY: timeout occurred, reconnecting
2017-11-12 20:26:54.716 (MySGW_NRF) Temp (Temp)
2017-11-12 20:26:54.717 (MySGW_NRF) Temp + Humidity (TempHum)
...
and stabilized