Mqtt takes up to 5 seconds

Hello,
I'm using mqtt broker aedes node inside node red.
Node red is installed on raspi 4b 4gb. My mqtt device is shelly-1 wich I use to register the state of the switch and after that I turn the lights on or off. For the lights I am using philips hue. I've connected my shelly to wifi repeater. Both have perfect connection, but sometimes it takes between 5 and 10 seconds to get something happen. But it's only for the first time. When I trigger the switch again, it works instant. After some time passed. Again first trigger 5 seconds. But not every time, it's like every 2nd time. It's a little bit annoying.
I have already installed one of those, connected to the wifi router and it works perfectly.

What could be the problem with this device. Do I miss some preference?
I'm using qos 1.

Somehow I think my repeater is garbage. I'm using TP-Link TL-WA850RE.

Any ideas?

Repeaters are notoriously bad in my experience (unless it's a good quality mesh).

Also, run top or htop on the pi. Are you getting periods of high CPU usage?

Lastly, install mosquitto & ditch aedes.

1 Like

It's 15€ repeater, what am I expecting 🤦. But I thought it will be enough for mqtt. Well messages arrive, but not instant.

I don't think I have high cpu usage. Running only node red in the pi and it's not large.
I will try mosquito, but I don't know what you mean with top or htop.

Thank you for your reply.

node-RED is single threaded, so it only does one thing at once, which means that if the CPU is busy, there will be a backlog of commands for node-RED to execute.
Because Aedes is running in node-RED, it's commands could be delayed in that backlog.

If you type top at the cmd prompt, it will show you the %CPU (how busy the CPU is) which may be a pointer if that is the problem.

It may also be worth adding a debug node to the Aedes node, to see if it disconnects it's subscription to your client.

1 Like

Ok looks like it's repeater issue. Today morning I just connected the shelly relay to the router. I have terrible connection with -87dbm but still works without delay and without losing messages.

With the repeater it felt like it needs to wake up first, what takes 5-10seconds.

But I will install mosquito anyway, so I have the broker not running inside node red.

Thank you guys for your advices.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.