Waking a computer (wake-on-lan, via node-red): erratic behavior

Hello!

I’m trying to set up wake-on-LAN for my media computer using Node-RED, but the behavior is unstable: sometimes it works, sometimes it doesn’t… Maybe you can help? I give more details below.

My final goal is to rely on Gladys to activate everything needed when I have a home cinema session: the screen lowers, the lights turn off, the soundbar, the Freebox and the projector turn on, the shutters close. I have one remaining point to handle: that the computer on which I installed Kodi wakes up if it was turned off or in sleep.

Gladys is installed on a Raspberry Pi 4, via Docker, with Node-RED in its « integrated into Gladys » version. The computer with Kodi is a mini PC on the same network. The network is managed by a Freebox Revolution. Both devices are connected by Ethernet cable with static IPs: 192.168.0.105 for Gladys, 192.168.0.101 for Kodi.

From the « wake me up » app on my iPhone, connected via Wi‑Fi to my Freebox, wake-on-LAN works reliably.

In Node-RED, I installed « node-red-node-wol », and I added the « wake on lan » node into a flow that is triggered by a change of an MQTT topic controlled from Gladys. The node is configured with its default values, and the IP address « 192.168.0.255 » and the MAC address of my mini PC hosting Kodi. For testing, I also have an « inject » node to manually trigger the wake-on-LAN from Node-RED.

And here the behavior is erratic: sometimes the computer with Kodi wakes up correctly (so my configuration is presumably working), sometimes not (so something is still wrong…). It’s as if one of the elements (Node-RED, the Raspberry Pi, the Freebox?) had lost track of the mini PC…

To illustrate, here are my tests this morning:

  • Last night, the mini PC went to sleep
  • This morning, several hours later, the wake-on-LAN from Gladys and Node-RED worked.
  • I put the computer back to sleep, and waited five minutes
  • Another wake-on-LAN, which also worked.
  • I put the computer back to sleep and waited 25 minutes
  • The wake-on-LAN from Node-RED does not work. However, it works from the app on the iPhone.

Does anyone have a lead?

Hi @StephaneB

Can you share your flow so we can investigate?

Here’s the flow (I just replaced the MAC address):

[
    {
        "id": "8b7ec11356e5322c",
        "type": "inject",
        "z": "40b9ba7305f364f9",
        "name": "Manuel",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 430,
        "y": 540,
        "wires": [
            [
                "9e1103e9a0a0ec90"
            ]
        ]
    },
    {
        "id": "9e1103e9a0a0ec90",
        "type": "wake on lan",
        "z": "40b9ba7305f364f9",
        "mac": "XX:XX:XX:XX:XX:XX",
        "host": "192.168.0.255",
        "udpport": "9",
        "numpackets": 3,
        "interval": 100,
        "name": "WOL de l'ordi Kodi",
        "x": 610,
        "y": 540,
        "wires": []
    }
]

\n

\n\ntry with the number of packets at 1 and the interval at 500 or even 1000

Hello @cce66. I tested with different NumberIfPackets/Interval combinations (3/100, 3/1000, 1/100, 1/1000), but the problem persists.

Try putting only the « MAC address » and nothing in the « Target Address » (Node-RED should take the broadcast address based on its IP)

Good evening @cce66. I took a while before I could run another test… Thanks for your new lead, but unfortunately that doesn’t solve the issue.