Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

RPC method error: 404 not found

lvdinhlvdinh HCMC
edited October 9 in Mongoose OS

I created a simple RPC method name "Control0".
After that I call "mos call Control0" then CMD returned 404 not found.
I also checked by calling "mos call RPC.List", it was not listed.
I'm using ESP8266 D1 mini.

Please help me!

Thanks and Regards,

Comments

  • lvdinhlvdinh HCMC
    edited October 10

    My code:

    load('api_rpc.js');
    load('api_gpio.js');
    
    let led = Cfg.get('pins.led');
    
    RPC.addHandler("Control0", function(args){
      GPIO.write(led, args.state);
      return true;
    
    });
    

    cmd returns:

    E:\IoT\mos>mos call RPC.List
    Using port COM12
    [
      "Wifi.Scan",
      "OTA.SetBootState",
      "OTA.GetBootState",
      "OTA.CreateSnapshot",
      "OTA.Revert",
      "OTA.Commit",
      "OTA.Update",
      "I2C.WriteRegW",
      "I2C.WriteRegB",
      "I2C.ReadRegW",
      "I2C.ReadRegB",
      "I2C.Write",
      "I2C.Read",
      "I2C.Scan",
      "GPIO.RemoveIntHandler",
      "GPIO.SetIntHandler",
      "GPIO.Toggle",
      "GPIO.Write",
      "GPIO.Read",
      "FS.Umount",
      "FS.Mount",
      "FS.Mkfs",
      "FS.Remove",
      "FS.Put",
      "FS.Get",
      "FS.ListExt",
      "FS.List",
      "Config.Save",
      "Config.Set",
      "Config.Get",
      "Sys.SetDebug",
      "Sys.GetInfo",
      "Sys.Reboot",
      "RPC.Ping",
      "RPC.Describe",
      "RPC.List"
    ]
    
  • SergeySergey Dublin, Ireland

    You should pay attention to the error messages printed on the console.

  • Today, after retried to flash again, I was seeing my new RPC method. I think there might be some problems of cable when I save the code.

  • SergeySergey Dublin, Ireland
    edited October 11

    The problem is with the code, you call Cfg function and did not load('api_config.js');
    The appropriate error you should have seem on the console.

Sign In or Register to comment.