Beiträge von janiv

    Hi,

    I have Shelly Plus 1PM.

    I did not find any answer from mJs scripting section of how to store variable locally so that I can recover it after reboot?

    I have installation that boots often and it is expected to be functional immediately after powerup. Including situations where wlan is not always available. I must store configurations into cloud because configurations are managed globally from cloud.

    brJani

    Hi,

    Good info! I guess you could setup DNS from router, but I guess it should be automatic if IP setting is set to DHCP. I found these device settings from Shelly:

    ...

    "sta1": {

    "ssid": "8A1170",

    "is_open": false,

    "enable": true,

    "ipv4mode": "dhcp",

    "ip": null,

    "netmask": null,

    "gw": null,

    "nameserver": null

    }

    ...

    ...

    I had problem with my mobile hotspot and router. Would that point to problems in Shelly FW itself? Local desktop setup in development phase is not uncommon.

    br,Jani

    I tried the other mqtt-announce.js code with these debugs:

    DEBUG LOG

    Connected.

    mgos_mqtt_conn.c:442 MQTT0 connecting to 34e044f4687f46cb8469ee7c1081071b.s2.eu.hivemq.cloud:8883

    mongoose.c:12127 Failed to resolve '34e044f4687f46cb8469ee7c1081071b.s2.eu.hivemq.cloud', server 10.0.0.2

    mgos_mqtt_conn.c:189 MQTT0 TCP connected error (-1)

    mgos_mqtt_conn.c:221 MQTT0 disconnected

    mgos_mqtt_conn.c:527 MQTT0 connecting after 57343 ms

    mongoose.c:12127 Failed to resolve 'time.google.com', server 10.0.0.2

    Hi,

    Thanks for the reply. My problem is still existing unfortunately. I connected to home WLAN from hotspot but no changes. I tried username password matching (and booting) with broker but no luck.

    I really would need a guidance of how and what tools I could use to dig out the problem. Does device have some deep debug capabilities?

    PS. otherwise very innovative products from Shelly!

    br,Jani

    Hi,

    I did once more did not help: Code states the same "not connected". I used BLE functionality here and it works. Anyway problem happens even with minimalistic mqtt code.

    // Scan options

    let scanOptions = {

    duration_ms: BLE.Scanner.INFINITE_SCAN, // Scan indefinitely

    active: false, // Use passive scanning

    interval_ms: 150,

    window_ms: 50,

    };

    // Scan callback

    function scanCB(ev, res) {

    if (ev !== BLE.Scanner.SCAN_RESULT) return;

    // Get the address and signal strength of the beacon

    let addr = res.addr;

    let rssi = res.rssi;

    // Publish the beacon data to the MQTT topic

    //MQTT.publish("beacons", JSON.stringify({ addres: addr, signal: rssi }));

    //print(addr);

    }

    // Start scanning

    BLE.Scanner.Start(scanOptions, scanCB);

    // Publish a message every 10 seconds to confirm that the code is running

    function mqttWatchdog(){

    let status = MQTT.isConnected();

    if(status){

    print("Running");

    MQTT.publish("beacons", "Running", 0, true);

    print("Running");

    } else {

    print("Not connected");

    }

    }

    Timer.set(2000, true, mqttWatchdog);


    pasted-from-clipboard.png

    pasted-from-clipboard.png