Discover causes {"id":(null), "error":{"code":-1, "message":"invalid command"}}

I’m trying to discover the bulb using this command on ubuntu:

echo -ne 'M-SEARCH * HTTP/1.1\r\nHOST:\r\nMAN:"ssdp:discover"\r\nST:wifi_bulb\r\n' | nc -w1 55443

but I receive this:
{“id”:(null), “error”:{“code”:-1, “message”:“invalid command”}}

What am I doing wrong? I’ve spend a few hours trying different variations.

The bulb is setup correctly because I’m able to use this command to turn the light off
echo -ne ‘{“id”:1,“method”:“toggle”,“params”:[]}\r\n’ | nc -w1 55443

You directly sent the discover message to IP and port of the bulb, that’s why you get the error message. If you know the IP already, it can’t be called discovery…
The discovery message should be sent to a multicast address using UDP.

I have also tried:
echo -ne ‘M-SEARCH * HTTP/1.1\r\nHOST:\r\nMAN:“ssdp:discover”\r\nST:wifi_bulb\r\n’ | nc -u 1982
but nothing happens, after a few minutes I canceled the command.
I’m assuming the http request is correcty formated, then can you suggest a correct nc command?

I don’t think “nc” supports multicast UDP. Please let me know your purpose, we can provide some binary utility to support bulb discovery.

First of all let me thank you that someone from the Staff it’s actually taking time to help us - the users. It really makes a difference.

I think you are right, netcat-openbsd might not support multicast.
What I was trying to do was to get the supported control methods, mainly. But I managed to get it using the available python script.