Jump to content

Recommended Posts

Posted

Hi

Ich habe einen Master + WLAN + Temperatursensor, alle mit aktueller Firmware.

Ich habe den Verdacht, dass wenn ich den WIFI Power Mode zweimal auf LOW_POWER setze, dass es dann einen Fehler gibt.

 

Folgendes node.js script wird alle 15 Minuten aufgerufen

    var ipcon = new TF.IPConnection();

    var masterBrick = new TF.BrickMaster('6esCZX', ipcon);

    var tempBricklet = new TF.BrickletTemperature('dCf', ipcon);

    tempBricklet.setI2CMode(TF.BrickletTemperature.I2C_MODE_SLOW);

   

    ipcon.connect(HOST, PORT, function(error) {

        cb("Could not open connection: "+error);       

    });

 

    ipcon.on(TF.IPConnection.CALLBACK_CONNECTED, function(connectReason) {

        masterBrick.setWifiPowerMode(TF.BrickMaster.WIFI_POWER_MODE_LOW_POWER);

        tempBricklet.getTemperature(

            function(temp) {

                cb(null, temp/100);

                ipcon.disconnect();

            },

            function(error) {

                cb("Could not read temperature: "+error);

                ipcon.disconnect();

            }

        );

    });

 

Ich bekomme immer "Could not read temperature: 31".

Wenn ich die Zeile

masterBrick.setWifiPowerMode(TF.BrickMaster.WIFI_POWER_MODE_LOW_POWER);

weglasse, dann funktioniert es.

Posted

hab ich probiert:

    ipcon.on(TF.IPConnection.CALLBACK_CONNECTED, function(connectReason) {

        masterBrick.setWifiPowerMode(TF.BrickMaster.WIFI_POWER_MODE_LOW_POWER);

        // Get temperature

        setTimeout(function(){

            tempBricklet.getTemperature(

                function(temp) {

                    console.log(null, temp/100);

                    ipcon.disconnect();

                },

                function(error) {

                    console.log("Could not read temperature: "+error);

                    ipcon.disconnect();

                }

            );

        }, 1500);

    });

 

hilft nix. Erst wenn ich "masterBrick.setWifiPowerMode" weglasse dann funktioniert es.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...