I do not have any gen2 devices. But what have you tried?
As far as i can make out you send
{"id":123, "src":"user_1", "method":"Switch.Set", "params":{"id":0,"on":true}}
to topic shelly_id/rpc
id
: number/string, identifier of this request, will be used to match the response frame. Requiredsrc
: string, name of the source of the request (you can choose whatever string you like to identify you as the source of the request). Requiredmethod
: string, name of the procedure to be called. Requiredparams
: JSON object, parameters that the method takes (if any) Optional