💬 Building a Raspberry Pi Gateway
-
@Mihai
you can attach analogue sensor to ESP2866 with espeasy firmware ... more info here : http://www.letscontrolit.com/wiki/index.php/ESPEasy ... i'm using one ESP8266-12E and i have good results and Uptime: 74209 minutes (usb powered).
i'm using IRQ on NRF24L01 connected to my Rpi, but i don't have many sensor with nrf+arduino (only 2) and i had no problems ... i don't if IRQ improve the reliability and i never play with irq fron nrf on arduino.
regarding retain=true have a look here : http://www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages
for more reliability on mqtt i think you can use qos=1 ( The broker/client will deliver the message at least once, with confirmation required.), but all depends on your set-up .. not all messages need special attention. -
@eyesoft
Thank you for the answer, I am happy to get a confirmation about sensors works on a Pi Gateway. Since at least one of my sensor is analogue, I still have to add an Arduino board to the gateway, I plan to connect it via USB.
I have tested and get very good results with Home Assistant controller running on a Pi where I add sensors directly on Pi and to an Arduino (USB to Pi).
The Ethernet Gateway do not use IRQ: https://www.mysensors.org/build/ethernet_gateway
Nor the nodes: https://www.mysensors.org/build/connect_radio Even if the wire is connected at Arduino pin 2, is mentioned: Note: The IRQ is currently not used by the MySensors library so it can be left un-connected
If you know how to connect and manage this IRQ on Arduino sketch, please let me know.
I have built this some time ago and works without the IRQ connected. Now I have updated the MySensors to 2.1.0 , IRQ is still unconnected and works the same. As far as I see, it is used for the Pi Gateway. I plan to migrate to this configuration of Pi Gateway, but I would like to get more info before change my working system:- this IRQ improve the reliability? (sometimes I have encountered problems due the load of NRF24 network with many messages)
- I would like to set retain=true for the MQTT Gateway, this will improve the reliability.
I already addressed the last question somwhere else, still waiting for more info if somebody know.
Thank you
@Mihai I have not done any extensive testing with IRQ functionality in RPi, I plan to do it in the future, so for now you will have to test it for yourself.
@Madhias Yes, this is the expected output, the gateway is now waiting for messages to arrive.
@pjeran Yes, there is a work in progress with many improvements: https://github.com/mysensors/MySensors/pull/722
-
I have created a patch to enable the use of the RFM69 with a RaspberryPi gateway without the use of an Arduino gateway board.
It has only been tested with my configuration, but it seems to work well for me.
Pull request is here with configuration instructions:
https://github.com/mysensors/MySensors/pull/728Note that it currently requires using some pin other than CS0/CS1 for the chip-select
-
I have created a patch to enable the use of the RFM69 with a RaspberryPi gateway without the use of an Arduino gateway board.
It has only been tested with my configuration, but it seems to work well for me.
Pull request is here with configuration instructions:
https://github.com/mysensors/MySensors/pull/728Note that it currently requires using some pin other than CS0/CS1 for the chip-select
-
@Mihai
you can attach analogue sensor to ESP2866 with espeasy firmware ... more info here : http://www.letscontrolit.com/wiki/index.php/ESPEasy ... i'm using one ESP8266-12E and i have good results and Uptime: 74209 minutes (usb powered).
i'm using IRQ on NRF24L01 connected to my Rpi, but i don't have many sensor with nrf+arduino (only 2) and i had no problems ... i don't if IRQ improve the reliability and i never play with irq fron nrf on arduino.
regarding retain=true have a look here : http://www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages
for more reliability on mqtt i think you can use qos=1 ( The broker/client will deliver the message at least once, with confirmation required.), but all depends on your set-up .. not all messages need special attention.@eyesoft
As far as I understand, MySensors relay on PubSubClient for MQTT and it does not allow to publish messages with QOS=1 or 2, only 0.
Retain is different that QOS, it offers the possibility to recover the state for a device that loose connection for a while (e.g. after a restart). I find it very usefull. For example I have to restart the controller. When come back I got all states to their real values if retain=true. Otherwise they goes to the default, usually 0.
I have now 6 nodes, each with several sensors and relays. -
please help :(
every time after reboot i have to run this codesudo ./bin/mysgw -dso built a virtual usb but after reboot ....

how put this code in startup ? :( please help thank you
From the Building a Raspberry Pi Gateway article:
If you wish to install:
sudo make installThe last command will provide instructions for your system on how to start the gateway on every boot.
-
From the Building a Raspberry Pi Gateway article:
If you wish to install:
sudo make installThe last command will provide instructions for your system on how to start the gateway on every boot.
@marceloaqno
i do it but after reboot serial lost again :(
just with command work againsudo ./bin/mysgw -d -
From the Building a Raspberry Pi Gateway article:
If you wish to install:
sudo make installThe last command will provide instructions for your system on how to start the gateway on every boot.
@marceloaqno
i'm sorry
after sudo make install i must run this lines:sudo systemctl enable mysgw.service sudo systemctl start mysgw.servicesorry thank you
-
@marceloaqno can you build a rs485 gateway on raspberry pi ?
-
This data that I get when I run ./mysgw --d , where is it stored and how can I get it to push it on cloud? Please help.
-
This data that I get when I run ./mysgw --d , where is it stored and how can I get it to push it on cloud? Please help.
Data is not stored... to store the data and do something usefull with it (or not) you need a controller. I use mycontroller, and from this software you can "push" data to an external server.
I use my controller, but i am sure that other controller software also has this feature. -
@Tag , The controller must be using something to get the data right? How can we do it directly without using the controller?
-
@hek It looks like development is the default branch in the repository. I was following the build instructions and couldn't figure out why I kept getting "connection refused". Just typing up a troubleshooting post when I saw my log said 2.2.0-beta. Sure enough when I grabbed master(2.1.0) instead it ran fine. Should probably add a checkout in the instructions.
-
@hek It looks like development is the default branch in the repository. I was following the build instructions and couldn't figure out why I kept getting "connection refused". Just typing up a troubleshooting post when I saw my log said 2.2.0-beta. Sure enough when I grabbed master(2.1.0) instead it ran fine. Should probably add a checkout in the instructions.
@pete1450 could you clarify which instructions should be updated?
The instructions at https://www.mysensors.org/about/arduino recommend using the Arduino IDE Board manager, which will get the latest stable version.
Edit: Now I see. The link in the first post in this thread. It doesn't mention the master branch because up until Dec 25th the development branch was required. But now that 2.1 has been released the instructions should indeed use the stable version. I've updated the instructions. Thanks for noticing!
-
@Tag , The controller must be using something to get the data right? How can we do it directly without using the controller?
This is also new for me since i do not send data into any cloud... but i can imagine that you can use MQTT. (see https://www.mysensors.org/build/mqtt_gateway for more details) is important that the receiving side supports MQTT. in this case google is your friend ;)
if you do a ./configure --help you will find you can build the mysensors gateway with MQTT support
./configure --help ... --my-gateway=[ethernet|serial|mqtt] Gateway type, set to none to disable gateway feature. [ethernet] --my-node-id=<ID> Disable gateway feature and run as a node with given id. --my-controller-url-address=<URL> Controller or MQTT broker url. --my-controller-ip-address=<IP> Controller or MQTT broker ip. --my-port=<PORT> The port to keep open on gateway mode. If gateway is set to mqtt, it sets the broker port. ...