💬 Building a Raspberry Pi Gateway
-
@Christian-Simonsen start the gateway with debug enabled:
mysGateway -d
-
@Christian-Simonsen If you don't have debug enabled you could also just use:
tail -f /dev/ttyUSB20
My port is named ttyUSB20. You should substitute whatever you have named your port.
-
Thanks I'll test it. But it seems like I've jumped over a step or two. Or something isn't working. Nothing happened when I wrote "Make" in Terminal, so I jumped over this step. I guess that might be the problem.
Do I have to configure (./configure -help) or can I use the default values when I connect the NRF24L01 to the GPIO pins?
-
@b0rmann what happened? Did you fixed the problem you described in your last message?
-
it's my problem. accidentally disconnected power from nrf24 on running gw
-
@marceloaqno I have it completely working now. A Raspberry Pi PulseCounter for water/gas/electricity consumption measurements with ethernet/mqtt. I can post my code here if you want.
Minor detail:
millis() / 1000;
should be
millis() * 1000;
to get micros()
-
@ericvdb Congrats! oops, sorry about my mistake.
-
This post is deleted!
-
Seems I'm closing in to working solution. I didn't understand how to use the ./configure element before now. However I ended up with these configurations
pi@raspberrypi:~ $ ./MySensors/configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --my-radio=nrf24 --my-rf24-irq-pin=15 [SECTION] Detecting target machine. [OK] machine detected: SoC=BCM2836, Type=Rpi2, CPU=armv7l, REV=a01041. [OK] init system detected: systemd [SECTION] Saving configuration. [SECTION] Cleaning previous builds. make: *** No rule to make target 'clean'. Stop. [OK] Finished. pi@raspberrypi:~ $ sudo ./MySensors/examples_linux/mysGateway -d mysGateway: Starting gateway... mysGateway: Protocol version - 2.0.1-beta mysGateway: MCO:BGN:INIT GW,CP=RNNG--Q,VER=2.0.1-beta mysGateway: TSF:LRT:OK mysGateway: TSM:INIT mysGateway: TSM:INIT:TSP OK mysGateway: TSM:INIT:GW MODE mysGateway: TSM:READY mysGateway: MCO:REG:NOT NEEDED mysGateway: MCO:BGN:STP mysGateway: MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1 mysGateway: TSM:READY:NWD REQ mysGateway: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: mysGateway: TSF:SRT:OK
Based on this it seem to all be ok on the Raspberry Pi side.. So I uploaded the "MockMySensors" sketch to my Arduino Uno with NRF24 connected. Below is the code and failure message I get from the Arduino. Do I need to set a gateway address or something?
Starting sensor (RNNNA-, 2.0.0) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=254) TSM:FPAR TSP:MSG:SEND 254-254-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 254-254-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 254-254-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 254-254-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: !TSM:FPAR:FAIL !TSM:FAILURE TSM:PDT```
-
Thanks for adding signing.
I want to use my rPi to generate random soft serials for my sensors.
Could all three "gen" commands output the line to put in SecurityPersonalizer.ino like it does when using the "set" commands?
-
@Christian-Simonsen you need to be within the MySensors folders to execute commands configure and make.
I recommend you to test that everything is working before using the option --my-rf24-irq-pin=15Like this:
cd MySensors ./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --my-radio=nrf24 make sudo ./examples_linux/mysGateway -d
-
-
@marceloaqno said:
cd MySensors
./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --myThanks for letting me know, didn't know that not running it from the specific folder would have an impact.
I reconfigured it as you recommended. and restarted the gateway, with the result below.
pi@raspberrypi:~/MySensors $ sudo ./examples_linux/mysGateway -d mysGateway: Starting gateway... mysGateway: Protocol version - 2.0.1-beta mysGateway: MCO:BGN:INIT GW,CP=RNNG---,VER=2.0.1-beta mysGateway: TSF:LRT:OK mysGateway: TSM:INIT mysGateway: TSM:INIT:TSP OK mysGateway: TSM:INIT:GW MODE mysGateway: TSM:READY mysGateway: MCO:REG:NOT NEEDED mysGateway: MCO:BGN:STP mysGateway: MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,14!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,14!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7
What is the best way to test if the gateway work? What sketch should I use on the arduino? and how do I see in Terminal that the mysGateway receive the transfer successfully?
-
very interesting data...
journalctl -u mysgateway --since 13:15 | grep MSG:READ
Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-3-0,s=3,c=1,t=23,pt=2,l=2,sg=0:97 Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-3-0,s=4,c=1,t=23,pt=2,l=2,sg=0:6 Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=3,c=1,t=23,pt=2,l=2,sg=0:97 Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=0,c=1,t=0,pt=7,l=5,sg=0:24.6 Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=4,c=1,t=23,pt=2,l=2,sg=0:6 Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=3,c=1,t=23,pt=2,l=2,sg=0:97 Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-3-0,s=0,c=1,t=0,pt=7,l=5,sg=0:12.7 Oct 21 13:16:31 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=0,c=1,t=0,pt=7,l=5,sg=0:12.7 Oct 21 13:16:31 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=4,c=1,t=23,pt=2,l=2,sg=0:6 Oct 21 13:17:17 pi mysGateway[30406]: TSF:MSG:READ,2-2-0,s=251,c=1,t=0,pt=7,l=5,sg=0:24.5 Oct 21 13:17:17 pi mysGateway[30406]: TSF:MSG:READ,2-2-0,s=167,c=1,t=0,pt=7,l=5,sg=0:24.6 Oct 21 13:17:18 pi mysGateway[30406]: TSF:MSG:READ,2-10-0,s=251,c=1,t=0,pt=7,l=5,sg=0:24.5 Oct 21 13:17:18 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=0,c=1,t=0,pt=7,l=5,sg=0:12.7 Oct 21 13:17:18 pi mysGateway[30406]: TSF:MSG:READ,2-10-0,s=167,c=1,t=0,pt=7,l=5,sg=0:24.6 Oct 21 13:17:18 pi mysGateway[30406]: TSF:MSG:READ,2-10-0,s=251,c=1,t=0,pt=7,l=5,sg=0:24.5 Oct 21 13:17:19 pi mysGateway[30406]: TSF:MSG:READ,10-10-0,s=12,c=1,t=0,pt=7,l=5,sg=0:34 Oct 21 13:17:19 pi mysGateway[30406]: TSF:MSG:READ,10-10-0,s=14,c=1,t=0,pt=7,l=5,sg=0:24
node 2
sensor 167 - dht18b20 indoor
sensor 251 - dht18b20 indoornode 3
sensor 0 - dht18b20 outdoor
sensor 3 - light (0..100)
sensor 4 - light (0..100)questions:
why node 2 and node 3 send messages directly and via node 10?24.6 - is actual value from 2/251, but gateway receive this value from 3/0 How is it possible?
Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=0,c=1,t=0,pt=7,l=5,sg=0:24.6
-
Hi,
Is there anyone here that can give me some one-to-one support this evening to setup the Raspberry Pi + NRF24L01 as a gateway with MyController, and a Arduino Uno + NRF24L01 as Sensor node. I'm stuck after trying various things over the past week, so looks like I need some additional skills/knowledge to get the first setup working.
Maybe we can use Skype or some other medium. I will gladly pay a bit for this support if anyone is interested. I have some free time from 18:00 CET - 23:30 CET today...
-
hi, the gateway works but how display sensors in domoticz?
Thank you very much
-
@nico you need a sensor to send data to GW and assuming you have GW added to Domoticz, Domoticz will add up corresponding values to "Devices"
-
I have a gateway and 1 sensor ,obviously.
I have added serial GW but anyone sensor appear, i'm sure that the sensor works, and the gateway also (see with the command mysGateway -d).
Can you have any idea ? Thank you
-
@nico I would suggest you open up a different post in the Troubleshooting section regarding this matter
1 post GW and sensor logs
2. How do you know that the GW was added to Domoticz? Logs please?
-
You can pretty much test out using any of the arduino examples here:
https://github.com/mysensors/MySensors/tree/development/examples
Each one will present itself to the gateway when it starts up and you will see the presentation in the debug log. Make sure to run:
https://github.com/mysensors/MySensors/tree/development/examples/ClearEepromConfig
on the arduino first to make sure it starts with a fresh eeprom. After you select an Arduino sketch to test it with (seriously it doesn't matter which one you try) make sure to look at the sketch and add:
// Enable and select radio type attached #define MY_RADIO_NRF24 #define MY_NODE_ID 4
For MY_NODE_ID you can select any number. Just make sure that each new sensor node that you create has a different node number so like start out at MY_NODE_ID 1 and when you make another sensor node you can #define MY_NODE_ID 2 and so on.
Next load it up to the Arduino, open the serial monitor, and see what happens. If you watch the serial monitor on the arduino you will see it present itself to the gateway and then you can confirm it in the debug log on the raspberry pi.
I think it is pretty normal to have the problems you are having. I uninstalled and reinstalled the gateway 3 times on the Raspberry Pi before I finally got it all figured out. Once you get it running it is a glorious thing.
-
mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7
looks like a power issue with the nrf24 module.
-
@b0rmann Can you provide a full debug log of all involved nodes?
-
Can I attach one or more DallasTemp sensors on the Raspberry Pi gateway?
-
@marceloaqno said:
mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7
looks like a power issue with the nrf24 module.
Ok,
I've tested with the Voltmeter and the NRF24L01 module do get a steady 3.26 V. Both the gateway module and the Arduino sensor node...
Im now building a few extra sensor nodes, so I can test without the Raspberry pi. Hopefully I can atleast get them talking based on Arduinos first. Before testing the Raspberry Pi.
-
@Patrik-Söderström said:
Can I attach one or more DallasTemp sensors on the Raspberry Pi gateway?
I haven't seen anyone doing anything similar so it might require some work. But almost anything is possible given enough work
-
Has anyone else had an issue with getting a sensor node to reconnect after a lost connection? I can see it attempting to reconnect but even though it is back within range of the gateway it won't reestablish the connection. If I reset the node it re-establishes the connection without any problem. This is the cycle that it gets stuck in:
TSM:FPAR TSP:MSG:SEND 3-3-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 0-0-3 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=3) TSM:UPL TSP:PING:SEND (dest=0) !TSP:MSG:SEND 3-3-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=fail:1 TSP:CHKUPL:FAIL (hops=255) !TSM:UPL:FAIL TSM:FPAR TSP:MSG:SEND 3-3-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: !TSP:SEND:TNR !TSP:SEND:TNR !TSP:SEND:TNR !TSP:SEND:TNR !TSP:SEND:TNR !TSP:SEND:TNR TSM:FPAR TSP:MSG:SEND 3-3-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 0-0-3 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=3) TSM:UPL TSP:PING:SEND (dest=0) !TSP:MSG:SEND 3-3-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=fail:1 TSP:CHKUPL:FAIL (hops=255) !TSM:UPL:FAIL TSM:FPAR TSP:MSG:SEND 3-3-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: !TSP:SEND:TNR !TSP:SEND:TNR !TSP:SEND:TNR !TSP:SEND:TNR !TSP:SEND:TNR !TSP:SEND:TNR```
-
@Christian-Simonsen multimeter will not detect issues with the power feed (noise or unstable). It just says that you voltage under zero load is 3.3V.
-
Appears things are changing, please update wiki:
Warning: --my-radio is deprecated, please use --my-transport
-
@mfalkvidd Alright The thing is that I have my Raspberry Pi as a Gateway today near my server rack and would like to measure the temperatur. Maybe I just get a Nano to do the work for me. Just would have been great to use the Raspberry.
-
@Patrik-Söderström You can probably connect a temperature sensor to the gpio pins and have your controller read the sensor (without using MySensors)
-
@carlyler Thanks for pointing that out.
-
@jerseyguy1996 Are you using a decoupling capacitor?
-
@marceloaqno Yes its 220 uF. It was all I had handy. I read somewhere that this may be a problem specific to the arduino nano. I may give it a try with the pro mini. Although I'm not sure what that may have to do with it.
Edit: I tried the same sketch on an arduino pro mini and it worked fine. When I simulated a loss of connection by walking out of range of the gateway it immediately reestablished the connection when I got back within range. The only difference is that the pro mini is running at 8 mhz whereas the nano runs at 16 mhz. Not sure how that affects things.
-
Hello everyone. Is there a way to reduce the number of Heartbeat messages the gateway produces by itself? Using MYSController to analyze the data traffic, I see every 10 seconds a Heartbeat - would like to reduce this once everything is working as expected to maybe every 5 or 10 minutes...
-
Just sleep longer. It sends one heartbeat every time the node wakes up.
-
I have exactly the same error
mysGateway: !TSF:MSG:LEN,0!=7
Have you been able to resolve that problem yet? I have tried multiple radios with different capacitors and powersources grounded to the Raspberry Pi.
thanks
-
Sadly not. I ended up creating an serial gateway (arduino with NRF24L01 and a USB connector) and connected this to the Raspberry Pi, rather than connecting the NRF24L01 directly to the GPIO pins. This worked perfectly straight away.
-
Too stubborn to give up, yet.
If i find a resolution I will let you know
-
I would like to try this, but my pins19-23 are already used by other hardware. Has anyone tried using the SPI1 Pins?
-
@dopeeye I had this issue and unfortunately changed several things at once and got rid of it. However, one thing I noticed was I had different versions of mySensors in my library directory since I downloaded the examples package. Therefore the sensor was likely compiling on a different version than the Gateway. You might want to check that.
If you could post more of your logs (sensor and gateway) it might help.
-
When running as a service, is there a way to watch the debug log?
-
Any ETA on support for RFM69 ? Need to extend my coverage
-
Done:
- git clone https://github.com/mysensors/MySensors.git
- ./configure --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=mygateway1
- make.
Got error:
In file included from ./MySensors.h:287:0,
from examples_linux/mysGateway.cpp:70:
./drivers/RF24/RF24.cpp: In function âuint8_t RF24_spiMultiByteTransfer(uint8_t, uint8_t*, uint8_t, bool)â:
./drivers/RF24/RF24.cpp:65:22: error: âNOPâ was not declared in this scope
*ptx++ = NOP ;
^
Makefile:46: recipe for target 'examples_linux/mysGateway.o' failed
make: *** [examples_linux/mysGateway.o] Error 1
Any idea?
-
@alesc looks like this commit in the development branch broke the code.
Do
git checkout master
before running configure should get the code to the latest stable release.
EDIT: Sorry, that won't work because the Raspberry Pi stuff didn't exist when MySensors 2.0 was released. You'll have to do git pull instead, to get tekka's fix.
-
@alesc @mfalkvidd Thanks for reporting, fixed: https://github.com/mysensors/MySensors/pull/635
-
Hi Everyone !
Big thumb up for the amount of work supplied !!!
After being more or less successful with openHAB1 I had a go with openHAB2 today, via a online install....
But no success with the "mysGateway" install : should i go back to serial gateway with an arduino ?
Thanks a lot for your help
-
@ben999 try again, because it works great. I assume by online install you mean apt-get; I too had trouble when trying this. However, I tried again following @TimO instructions here:
wiki, then everything came up nicely. I feel it is some permission issue that I have not tried to figure out yet.
-
@ericvdb when running as a service, debug messages are masked and aren't shown in the system logs, but it would be a good idea to have a way to connect to gateway perhaps using telnet and watch the logs. I'll work on something.
-
@carlyler
Thanks a lot for your message, hope is back on my side
Actually I had a go with openHABian (i didn't make it clear in my previous message, sorry)
The install itself couldn't be easier : OS+openHAB installed in one go, just by formatting SD Card with a tiny img file. One hour later and voilà !
So that could be the source of my trouble?
I will go with the link you supplied tonight and let you know (lookslike it is a manual install... scary!!)
Thank you again for your support
-
@ben999 if you have not already, read through the MySensors OH2 thread. I noticed a recent post by @TimO that talks about setting some permissions and that might be the issue. Otherwise, the manual install is not bad as he gives you step-by-step; I am a new to all this and managed to get it to work...
-
@carlyler
Smashing
Thanks a lot for that hint... I remember reading that...
Linux is so damn rigid
Thank you again for your help
-
Either its not stated or I cannot see it, but i was wondering... Is this version 2 voor de rPi?
At the moment I am using MySensors version 1.5 with Pimatic as controller. And I would like to use v2.
-
@ben999 Yes, version 2
-
I feel a bit sorry to come back here for my own little troubles...
1- So i installed openhab2 on RPi3 with a fresh SDCard
2- I followed tobof 's excellent step-by-step howto
3- I installed mysGateway
4- Withpi@raspberrypi:~/MySensors $ sudo ./examples_linux/mysGateway -d
i can see that my motion sensor and my RPi gateway get on well... they do speak to each other, right ?mysGateway: Starting gateway... mysGateway: Protocol version - 2.0.1-beta mysGateway: MCO:BGN:INIT GW,CP=RNNG---,VER=2.0.1-beta mysGateway: TSF:LRT:OK mysGateway: TSM:INIT mysGateway: TSM:INIT:TSP OK mysGateway: TSM:INIT:GW MODE mysGateway: TSM:READY mysGateway: MCO:REG:NOT NEEDED mysGateway: MCO:BGN:STP mysGateway: MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1 mysGateway: TSF:MSG:READ,1-1-0,s=1,c=1,t=16,pt=0,l=1,sg=0:1 mysGateway: TSF:MSG:READ,1-1-0,s=1,c=1,t=16,pt=0,l=1,sg=0:0 mysGateway: TSF:MSG:READ,1-1-0,s=1,c=1,t=16,pt=0,l=1,sg=0:1 mysGateway: TSF:MSG:READ,1-1-0,s=1,c=1,t=16,pt=0,l=1,sg=0:0
5-in
things/demo.things"
I put this.Bridge mysensors:bridge-ser:gateway [ serialPort="/dev/pts/2", sendDelay=200 ] { }
Right away, it worked (king of the world!) and i could see that bridge in paperUI !!!
But i got that after a reboot of RPiopenhab> Failed to connect on port: /dev/pts/2 exception: gnu.io.NoSuchPortException at gnu.io.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:273) at gnu.io.NRSerialPort.connect(NRSerialPort.java:48) at org.openhab.binding.mysensors.protocol.serial.MySensorsSerialConnection.<init>(MySensorsSerialConnection.java:52) at org.openhab.binding.mysensors.handler.MySensorsBridgeHandler.initialize(MySensorsBridgeHandler.java:63) at org.eclipse.smarthome.core.thing.internal.ThingManager$9$1.call(ThingManager.java:764) at org.eclipse.smarthome.core.thing.internal.ThingManager$9$1.call(ThingManager.java:1) at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:177) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
Wrong serial port ?
Juste to make it clear : mysGateway bit of software is the magic that makes RPi believe that there's an arduino acting as a gateway on USB and collects the NRF24 info through GPio ?
-
@ben999 said:
Wrong serial port ?
Likely
/dev/pts/x are pseudo-terminals , not serial ports.On my (old) Pi running Raspbian the serial port is /dev/ttyAMA0
You could run something likedmesg |grep -i tty
to get an idea of serial ports on your Pi.
-
@Yveaux thanks a lot for your answer. Understanding linux is a slow and painful process
Here is the output from your command :
dmesg |grep -i tty
pi@raspberrypi:~ $ dmesg |grep -i tty [ 0.000000] Kernel command line: 8250.nr_uarts=0 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2709.boardrev=0xa02082 bcm2709.serial=0xcc3e67e3 smsc95xx.macaddr=B8:27:EB:3E:67:E3 bcm2708_fb.fbswap=1 bcm2709.uart_clock=48000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait [ 0.001337] console [tty1] enabled [ 1.772114] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
What a mess...
ttyAMA0 is the one !!!
Thanks @Yveaux you got me on the right path !!! Goto next step!
-
I just did a fresh install of pimatic and MsGateway on the pi. But pimatic does not seem to get de messages. i started the gateway via the daemon method, is there a way to see if the sensor is reaching the gateway?
-
@b0rmann
Do you still using the rs485 usb "dongle" to connect the rs485 nodes to the rpi? Do you attached some more nodes to your rs485 rpi Gateway?
Is it stable?
How do you do the configuration for it?
-
@JahFyahh To view messages being exchanged with the sensors, run the gateway in debug mode:
mysGateway -d
-
@marceloaqno thank you for the reply, I tried that and I receive "mysGateway: acce[t: Bad file descriptor" Any idea what this means?
-
@JahFyahh Could you provide the full debug log?
-
Hi team,
First of all, thanks for this amazing project and this doc.
I'm trying to use arduino nanos with Raspberry Pi 2 as a gateway: I can get it working when I configure the Raspberry Pi using serial gateway, however, it does not work using MQTT with latest version from git.
The error message is:
"mysGateway: accept: Bad file descriptor"I followed all explanations given on this page.
Any idea?
Thanks again
-
@manul Which MQTT broker are you using? Did you try to update it?
-
I wanted to use the mysGateway with a USB/RS485 converter.
Here is my config: ./configure --my-gateway=ethernet --my-port=5003 --my-transport=rs485 --my-rs485-serial-port=/dev/ttyUSB0 my-rs485-baudrate=57600
make does it's job, but after i start the gateway it says:
mysGateway: Starting gateway....
mysGateway: Protocol version - 2.0.1-beta
mysGateway: MCO:BGN:INIT GW,CP=RSNG---,VER=2.0.1-beta
mysGateway: TSM:INIT
mysGateway: TSM:INIT:TSP OK
mysGateway: TSM:INIT: GW Mode
mysGateway: TSM:READYafter that it stopped to work.
Whats wrong in my configuration?
-
@hausinger Have you checked if /dev/ttyUSB0 is receiving any data?
-
The RPi port has just received a new update that changes some important things related to the location and name of the gateway binary and services:
mysGateway was renamed to mysgw
mysgateway service was renamed to mysgwNow, after successfully running the make command, you will find the gateway file under ./bin/mygw
Also, before installing the new version you need to manually remove the old one:
If you are using systemd
sudo systemctl disable mysgateway.service sudo rm /etc/systemd/system/mysgateway.service sudo rm /usr/local/bin/mysGateway
If you are using sysvinit
sudo update-rc.d -f mysgateway remove sudo rm /etc/init.d/mysgateway sudo rm /usr/local/bin/mysGateway
-
@marceloaqno said:
@hausinger Have you checked if /dev/ttyUSB0 is receiving any data?
Thank you for your answer. I don't know, how to check that? The wiring to my nodes is correct, the serial port is correct (dmesg says that).
Could you confirm, that my configuration from my last post is correct?
-
@hausinger
Your configuration is correct. To check the serial, install the screen package (if you haven't already done so) and run:screen /dev/ttyUSB0 57600
You should see some strange characters being printed.
I did a quick test here with your setup and found out that there is a bug with the gateway when the rs485 baud rate is set to 57600. With 9600 it works fine. I'll try to fix this.
-
@hausinger You forgot "--" for my-rs485-baudrate=57600 in your configuration.
It should be:./configure --my-gateway=ethernet --my-port=5003 --my-transport=rs485 --my-rs485-serial-port=/dev/ttyUSB0 --my-rs485-baudrate=57600
-
@marceloaqno said:
@hausinger You forgot "--" for my-rs485-baudrate=57600 in your configuration.
It should be:./configure --my-gateway=ethernet --my-port=5003 --my-transport=rs485 --my-rs485-serial-port=/dev/ttyUSB0 --my-rs485-baudrate=57600
Hi @marceloaqno
Thank you for your answers. Yes, i saw this, but I did the "--", i forgot it in the last post, because I can't use copy & paste on my raspberry (remote Desktop).Did this configuration work on your System?
Are you sure, that my configuration is ok? (with the "--")
Whats the normal behavior when i start the mysGateway with debug (mysGateway -d)? If i type the starting command in the terminal, the Gateway gives me the Messages (from my last post) and thats it (not more). I can now type a new commandI'm now not at home (Business trip), if I get home, i will try your "Screen" command
-
I followed the instruction above to make a mysgw file, but no file was generated.
-
@jmmorgan83 do you think there is any information you can share might help us help you?
-
I reset everything and ran it again. It did generate the file this time. Thanks, - Now to test it.
-
Has anyone gotten the raspberry pi gateway to work with Openhab on the same raspberry pi? I have both the virtual and mqtt gateways working, but I can get either one to communicate with Openhab.
-
@hausinger said:
@marceloaqno said:
@hausinger You forgot "--" for my-rs485-baudrate=57600 in your configuration.
It should be:./configure --my-gateway=ethernet --my-port=5003 --my-transport=rs485 --my-rs485-serial-port=/dev/ttyUSB0 --my-rs485-baudrate=57600
Hi @marceloaqno
Thank you for your answers. Yes, i saw this, but I did the "--", i forgot it in the last post, because I can't use copy & paste on my raspberry (remote Desktop).Did this configuration work on your System?
Are you sure, that my configuration is ok? (with the "--")
Whats the normal behavior when i start the mysGateway with debug (mysGateway -d)? If i type the starting command in the terminal, the Gateway gives me the Messages (from my last post) and thats it (not more). I can now type a new commandI'm now not at home (Business trip), if I get home, i will try your "Screen" command
So I'm at home today and make some Test.
The screen comand gives me some strange characters, thats ok I think.But if i start the Gateway, I only get the same messages as shown in my other post.
Here are 2 Pics that show you, how it look like.
I also tried to make the gw with a baudrate of 9600, but still the same issues.!
-
Has anyone been able to get this to successfully work with a Vera?
-
Have been running MySensors for some time now with a EthernetGW running on Arduino. To clean-up the installation, I'm trying to get the Gateway running on my Raspberry instead but something stops the make process.
pi@raspberrypi ~/MySensors $ ./configure --my-gateway=ethernet --my-port=5003 --my-transport=nrf24 [SECTION] Detecting target machine. [OK] machine detected: SoC=BCM2836, Type=Rpi2, CPU=armv7l, REV=a01041. [OK] init system detected: sysvinit [SECTION] Saving configuration. [SECTION] Cleaning previous builds. [OK] Finished. pi@raspberrypi ~/MySensors $ make gcc -MT build/drivers/Linux/log.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_ARCH_RASPBERRYPI -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/RPi -c drivers/Linux/log.c -o build/drivers/Linux/log.o cc1: error: bad value (cortex-a7) for -mtune switch Makefile:102: recipe for target 'build/drivers/Linux/log.o' failed make: *** [build/drivers/Linux/log.o] Error 1
Any hints what I have done wrong ?
-
Issue solved, manual update of compiler from 4.6,3 -> 4.7.2 enables the make process. Similar problem also reported in post.
Using
- sudo apt-get update
- sudo apt-get upgrade
does not upgrade compiler. I used instruction according to How to upgrade GCC to 4.7+.
-
@RogerB68 I had the same situation. I have removed the mtune parameter from the config file and compilation went fine. I don't know what it affects though.
-
I created a virtual serial port using this ./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway. I can see the port in the dev folder, but when I run dmesg I do not see it listed and therefore my openhab can not find it. How can I fix this?
-
@hausinger After the command:
sudo ./bin/mysgw -d
It wasn't supposed to go back to bash, the gateway would wait for new messages.
I'm not sure what's going on with your setup because I tested your configuration options here and it worked.
-
@jmmorgan83 You may need another name for the port, such as
./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020
-
@marceloaqno
Unfortunately, no luck:(.
-
@marceloaqno said:
@hausinger After the command:
sudo ./bin/mysgw -d
It wasn't supposed to go back to bash, the gateway would wait for new messages.
I'm not sure what's going on with your setup because I tested your configuration options here and it worked.Thank you for your answer. What can I do now? Can I check, that this port is unused? And how can I check this?
Or is there another problem?
-
FYI: I do not think the Rpi gateway works with Openhab on the same unit. I have tried both the virtual serial port and mqtt, and neither will work with Openhab 1.83.
-
This post is deleted!
-
This post is deleted!
-
Hi all,
So I built this and all seems to be well. But.....how do I test it properly?
I also installed pidome and have that able to 'see' the MSYGW, but it advises to only add it if it is working.
So how to know if mysgw is working OK? Is there somewhere a step-by-step way to do this?
-
@skywatch try to run it with "mysgw -d" .
Enabling debug mode you can see on console every message and diagnostics...
-
sudo ./bin/mysgw -d and sudo ./bin/mysgw -h now both give 'command not found' - which is odd as they were both working eariler ???
A reboot makes no difference. Although after reboot I see mysgw running in 'top' but even stopping that service and trying sudo mysgw -d again doesn't seem to work.Any idea whats wrong? Any suggestions to get this going?
-
if you did
make install
the mysgw executable is in /usr/local/bin directory then you have to launch it with:
/usr/local/bin/mysgw -d
-
That doesn't appear anywhere on this tutorial, so maybe it needs adding for completion?
Anyway the output is now......
pi@PiDomePi:~ $ sudo /usr/local/bin/mysgw -d
mysgw: Starting gateway...
mysgw: Protocol version - 2.0.1-beta
mysgw: MCO:BGN:INIT GW,CP=RNNG--Q,VER=2.0.1-beta
mysgw: TSF:LRT:OK
mysgw: TSM:INIT
mysgw: TSM:INIT:TSP OK
mysgw: TSM:INIT:GW MODE
mysgw: TSM:READY
mysgw: MCO:REG:NOT NEEDED
mysgw: MCO:BGN:STP
mysgw: MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1When i did build install I missed out bit for the leds, can I just re-run the ./config and 'make' then 'make install' again? Or will that cause problems??
I just think that the lights will be useful in the early stages of getting this running...Thanks for the help, no way would I have got that without you!
-
You're welcome !
you can (re)run configure, make, make install when you want,
but I suggest to stop the mysgw executable before launch "make install"
-
Thank you!
-
Can I just check that this is OK? .....
./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --my-transport=nrf24 --my-rf24-irq-pin=15 --my-leds-err-pin=12 --my-leds-rx-pin=16 --my-leds-tx-pin=18
Can you see any problems here, it seemed to work but I hope to test fully this week, maybe tomorrow.....
-
@skywatch
Hi, options for "configure" are ok, I suggest you to double check your cabling !
-
What makes you think that the cabling is wrong? - I checked and can't see any problem....can you be less cryptic please?
-
@skywatch
I meaning that often is also useful to check cable two (or three) times !
but if you already did it... ok !
-
Ah, OK then - I thought there was something in the console data I posted that meant there was a problem! - Tomorrow to build a sensor and get that going.... Thanks again!
-
hi
yesterday i tried to build a rpi-gateway but i had trouble to access, after changeing the rights on the port to 777 and group to dialout i could access via
fhem. and i didn't use the symlink, i used the port directly /dev/pts/0@115200 andthen it works perfectly!thanks...
p.s.: i uses always sudo while make and the other installation commands.
greets mike