Git Product home page Git Product logo

Comments (9)

berechetflorin avatar berechetflorin commented on June 15, 2024 2

Good news, I solved the problem. As I imagine, the service nexus433 couldn't connect to the remote MQTT server at boot sequence because it was starting faster than the networking was ready (although there is line in nexus433.service with After=network-online.target, this doesn't guarantee that a connection with Mosquitto broker is already possible). I added the line:
ExecStartPre=/bin/sh -c 'until ping -c1 192.168.1.8; do sleep 1; done;' (it waits until it gets a valid ping) before the line: ExecStart=/usr/local/bin/nexus433 in file /etc/systemd/system/nexus433.service

from nexus433.

slavkoja avatar slavkoja commented on June 15, 2024 1

Beware, the network-online.target (at least on debian) is not real waiting by default. It must be activated by using systemd's networking or by setting proper WAIT_ONLINE_METHOD in /etc/default/networking.

The default one (ifup) doesn't wait to be really on-line (eg. DHCP can be still in progress). Try to use one of route or ping/ping6 method with appropriate related settings...

from nexus433.

aquaticus avatar aquaticus commented on June 15, 2024

After changing configuration file you must restart service (or stop/start program when running from command line).
make install overrides configuration file with default one. That's the reason you cannot connect to MQTT as there are no credentials in file. Use make install only once to install files.

from nexus433.

berechetflorin avatar berechetflorin commented on June 15, 2024

As a matter of fact I modified the file /home/pi/nexus433/nexus433.ini.in with my credentials. So everytime I use make or make install the file /etc/nexus433.ini is written with the right credentials. I wonder if the file /etc/systemd/system/nexus433.service is ok like this:

[Unit]
Description=433MHz sensor receiver
After=network-online.target

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/nexus433

[Install]
WantedBy=multi-user.target

Is it possible that the required configuration file is not loaded in time when the Raspbian is booting?

from nexus433.

aquaticus avatar aquaticus commented on June 15, 2024

This happens when you start service manually or only when the board boots up? If this is the second case, most likely MQTT server still does not start when nexus service is running. You must add dependence on MQTT to nexus433.service (or just a delay).

from nexus433.

aquaticus avatar aquaticus commented on June 15, 2024

Just realised you're running the software on RPI0, so most likely you have no MQTT server on the same machine. My above statement makes no sense.

from nexus433.

berechetflorin avatar berechetflorin commented on June 15, 2024

Yes, it is the second case, when the RPi0 board boots. The MQTT server is on another machine (Home Assistant on another Raspberry Pi). Something happens during the boot sequence, I have to find a way to check if the nexus433 configuration file is loaded at the right time before connecting to the MQTT server.

from nexus433.

berechetflorin avatar berechetflorin commented on June 15, 2024

Yes, I suspected this line didn't helped too much for starting nexus433.service with the proper timing. That's why I tested with the until ping. Anyway, the gateway is now working perfectly for me, all my "untamed" R8H sensor are now fully integrated with Home Assistant. Thank you @aquaticus for this!

from nexus433.

aquaticus avatar aquaticus commented on June 15, 2024

Probably it would be the best to refactor initial MQTT connection routine to try all the time.

from nexus433.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.