Hi @scaprile,
thanks for getting back to me and also for the pointer to the documentation.
This is the code, I’m running:
Event.on(Event.CLOUD_CONNECTED, function () {
Log.debug("Connected to MQTT...");
RPC.call(RPC.LOCAL, 'Sys.GetInfo', null, function (resp, ud) {
Log.debug('Response:', JSON.stringify(resp));
Log.debug('MAC address:', resp.mac);
}, null);
}, null);
As I wrote in my initial message, the call from the documentation is not giving me the output, but is trying sending a message via MQTT:
[Dec 8 14:34:21.398] init.js:147 Connected to MQTT...
[Dec 8 14:34:21.413] mg_rpc.c:246 'RPC.LOCAL' -> 0x3ffd14e8
[Dec 8 14:34:21.417] mg_rpc.c:698 QUEUED FRAME (71): {"src":"sbcE36728","dst":"RPC.LOCAL","id":15920,"method":"Sys.GetInfo"}
[Dec 8 14:34:21.428] mgos_event.c:135 ev MOS4 triggered 2 handlers
[Dec 8 14:34:21.431] mgos_mqtt_conn.c:168 MQTT0 sub xyz/unprovisioned/sbcE36728/rpc @ 1
[Dec 8 14:34:21.441] mongoose.c:3007 0x3ffd7758 udp://162.159.200.123:123
[Dec 8 14:34:21.447] mongoose.c:3022 0x3ffd7758 udp://162.159.200.123:123 -> 0
[Dec 8 14:34:21.453] mgos_sntp.c:53 SNTP sent query to 162.159.200.123
[Dec 8 14:34:21.469] mgos_sntp.c:64 SNTP reply from 162.159.200.123: time 1765200862.361055, local 43.850190, delta 1765200818.510865
[Dec 8 14:34:21.478] mgos_event.c:135 ev MOS3 triggered 4 handlers
[Dec 8 14:34:21.485] mgos_mqtt_conn.c:179 MQTT0 event: 209
[Dec 8 14:34:21.488] mg_rpc.c:499 0x3ffd14e8 CHAN OPEN (MQTT)
[Dec 8 14:34:21.494] mgos_event.c:135 ev RPC0 triggered 0 handlers
[Dec 8 14:34:21.500] mgos_rpc_channel_mq:153 Published [{"src":"sbcE36728","dst":"RPC.LOCAL","id":15920,"method":"Sys.GetInfo"}] to topic [xyz/unprovisioned/RPC.LOCAL/response]
[Dec 8 14:34:21.514] mg_rpc.c:678 0x3ffd14e8 SEND FRAME (71): {"src":"sbcE36728","dst":"RPC.LOCAL","id":15920,"method":"Sys.GetInfo"} -> 1
The delivery of the message to the topic xyz/unprovisioned/RPC.LOCAL/response is failing, because topic names with “.” are not allowed in MQTT. Therefor I was trying to use the device_id, which works and I get the following message into the topic xyz/unprovisioned/sbcE36728/response:
{"src":"sbcE36728","dst":"sbcE36728","id":18405,"method":"Sys.GetInfo"}
and there is no logging output at all given, related the code, like the “Mac address” or something else.
So I was under the impression, that the RPC-MQTT module seems to redirect all calls to MQTT somehow.
Do you have any other suggestion or idea on how I could report the IP address of the device as a message to the MQTT broker? Since this would be really helpful.
Regards,