Beiträge von marcpierre

    Hello Mircho,

    I'm want to use a BLU1 to control a Plus 2PM in "Cover mode"

    So i'm using 2 scripts from the library : Ble-Shellyblu.js and the ble-evnets-handler.js

    first of all had to adapt the library version:: the BLU scanner sends "adress" : "12:34:56:.... " , the script conditions contain: "mac": "12:34:56...". after adapting this, the basic library works

    Then I started with what this needs to do, ti activate the cover when the button is pushed. the Shelly.Call(Cover.open...) works.

    Next, make it work like my other covers : cyclically, in a up - stop - down - stop at each click on the BLU.

    So, I use Shelly.Call to get the status of the cover, and then intend do some logic on the callback result.

    It did not go well.

    After a while, I got to this thread and borrowed your code.

    Here i'm stuck again:


    this is the console output :

    The button was pressed
    09:46:11

    Uncaught ReferenceError: "result" is not defined
    09:46:11

    at line 10 col 21
    09:46:11

    console.log(result);
    09:46:11

    ^
    09:46:11

    in function "func" called from line 12 col 16
    09:46:11

    func(data);
    09:46:11

    ^
    09:46:11

    in function "executeScene" called from line 12 col 43
    09:46:11

    this.executeScene(sceneIndex, data);
    09:46:11

    ^
    09:46:11

    in function "onNewData" called from line 17 col 36
    09:46:11

    sceneEventObject.onNewData(info);
    09:46:11

    ^
    09:46:11

    in function called from system
    09:46:11


    This is the part I changed on the library the code in BOLD is where the problem is

    /****************** START CHANGE ******************/

    let coverstate ;

    let coverinfo ;

    let CONFIG = {scenes: [ // List of scenes {1}

    { /** SCENE START 1 - Shelly BLU example **/ //{2}

    // when event name is `shelly-blu` and button is pressed more than 0 times

    conditions: { //{3}

    event: "shelly-blu",

    address: "bc:02:6e:c3:7e:32",

    button: { //{4}

    compare: "==",

    value: 1,

    }, //{4}

    }, //{3}

    action: function (data) { //{4}

    console.log("The button was pressed");

    Shelly.call(

    "Cover.Getstatus",

    { id: 0 },

    function(result){//{5}

    coverinfo = result.temperature;

    coverstate = result.state;

    } //{5}

    );

    console.log(result);

    if (coverstate == "closed") {//{5}

    console.log("state is : closed");

    Shelly.call("Cover.Open", { id: 0 });

    }//{5}

    },//{4}

    },//{3}

    /** SCENE END 1 **/

    /** SCENE START 3 - Shelly BLU Scanner example **/

    {//{3}

    // when event name is `shelly-blu`

    },//{2}

    /** SCENE END 3 **/

    ],

    //When set to true, debug messages will be logged to the console

    debug: false,

    };//1

    /******************END CHANGE ******************/


    How do I define that "result" ? And in the same line, how can I put the whole callback string in an array ?

    Some help would be much appreciated

    Hello All,

    I have a roller shutter before my front door. It is controlled now by a Shelly 2,5 in roller mode, with a pushbutton inside the house.

    This means that I depend on WIFI being online to open the shutter from the outside.

    To avoid needing the WIFI, I bought a few BLU1 buttons and a Gen2 Shelly 2PM. The 2PM is paired with the BLU1, and transmits the BLU1 info to the app so that works fine

    I also found a script that detects the button being single or double pressed and displays that on the script console, and emits an event. But the event goes over WIFI.

    Now I want that button to control the 2PM directly, but all I find in the API are webhook based commands.

    Has anybody any ideas ?