Avatar for user90273

user90273

Member since May 2018 • Last active Oct 2018
  • 2 conversations
  • 6 comments

Most recent activity

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user90273

    I finally got this working again, not sure what I was doing wrong.
    Thanks for the help

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user90273

    I tried a fresh install, did update and than upgrade before starting the install.
    I think the following worked:

    sudo apt-get install mosquitto mosquitto-clients bluetooth bluez libbluetooth-dev libudev-dev
    

    Now doing ./start.sh give's me an error:

    root@raspberrypi:~/EspruinoHub# ./start.sh
    setterm: terminal xterm does not support --blank
    module.js:549
        throw err;
        ^
    
    Error: Cannot find module 'bluetooth-hci-socket'
        at Function.Module._resolveFilename (module.js:547:15)
        at Function.Module._load (module.js:474:25)
        at Module.require (module.js:596:17)
        at require (internal/module.js:11:18)
        at Object.<anonymous> (/root/EspruinoHub/node_modules/noble/li­b/hci-socket/hci.js:6:26)
        at Module._compile (module.js:652:30)
        at Object.Module._extensions..js (module.js:663:10)
        at Module.load (module.js:565:32)
        at tryModuleLoad (module.js:505:12)
        at Function.Module._load (module.js:497:3)
    root@raspberrypi:~/EspruinoHub#
    

    the following are some of the install message:

    Building dependency tree
    Reading state information... Done
    build-essential is already the newest version (12.3).
    python-rpi.gpio is already the newest version (0.6.3~stretch-1).
    The following packages were automatically installed and are no longer required:
      lxkeymap python-cairo python-gobject python-gobject-2 python-gtk2 python-xklavier
    Use 'sudo apt autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
    root@raspberrypi:/home/pi# bash <(curl -sL https://raw.githubusercontent.com/node-r­ed/raspbian-deb-package/master/resources­/update-nodejs-and-nodered)
    
    Root user detected. Typically install as a normal user. No need for sudo.
    
    Are you really sure you want to install as root ? (y/N) ? y
    
    
    This script will remove versions of Node.js prior to version 6.x, and Node-RED and
    if necessary replace them with Node.js 8.x LTS (carbon) and the latest Node-RED from Npm.
    
    It also moves any Node-RED nodes that are globally installed into your user
    ~/.node-red/node_modules directory, and adds them to your package.json, so that
    you can manage them with the palette manager.
    
    It also tries to run 'npm rebuild' to refresh any extra nodes you have installed
    that may have a native binary component. While this normally works ok, you need
    to check that it succeeds for your combination of installed nodes.
    
    To do all this it runs commands as root - please satisfy yourself that this will
    not damage your Pi, or otherwise compromise your configuration.
    If in doubt please backup your SD card first.
    
    Are you really sure you want to do this ? [y/N] ? y
    Running Node-RED update for user root at /root
    
    This can take 20-30 minutes on the slower Pi versions - please wait.
    
      Stop Node-RED                       â
      Remove old version of Node-RED      â
      Remove old version of Node.js       â
      Install Node.js LTS                 â   Node v8.11.2   Npm 5.6.0
      Clean npm cache                     â
      Install Node-RED core               â   0.18.7
      Move global nodes to local          â
      Install extra Pi nodes              -
      Npm rebuild existing nodes          â
      Add menu shortcut                   â
      Update systemd script               â
    grep: /home/root/.config/lxpanel/LXDE-pi/panel­s/panel: No such file or directory
    sed: can't read /home/root/.config/lxpanel/LXDE-pi/panel­s/panel: No such file or directory
      Update update script                â/nodered-install.log
    
    
    
    All done.
      You can now start Node-RED with the command  node-red-start
      or using the icon under   Menu / Programming / Node-RED
      Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880
    
    Started  Mon  4 Jun 16:14:53 UTC 2018  -  Finished  Mon  4 Jun 16:20:38 UTC 2018
    
    root@raspberrypi:/home/pi# sudo apt-get install mosquitto mosquitto-clients bluetooth bluez libbluetooth-dev libudev-dev
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    bluez is already the newest version (5.43-2+rpt2+deb9u2).
    bluez set to manually installed.
    The following additional packages will be installed:
      libc-ares2 libev4 libmosquitto1 libuv1 libwebsockets8
    Suggested packages:
      bluez-cups bluez-obexd apparmor
    The following NEW packages will be installed:
      bluetooth libbluetooth-dev libc-ares2 libev4 libmosquitto1 libudev-dev libuv1 libwebsockets8 mosquitto mosquitto-clients
    0 upgraded, 10 newly installed, 0 to remove and 2 not upgraded.
    Need to get 799 kB of archives.
    After this operation, 1,826 kB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Get:2 http://archive.raspberrypi.org/debian stretch/main armhf bluetooth all 5.43-2+rpt2+deb9u2 [41.5 kB]
    Get:1 http://raspbian.mirror.colo-serv.net/ras­pbian stretch/main armhf libudev-dev armhf 232-25+deb9u2 [90.9 kB]
    Get:3 http://archive.raspberrypi.org/debian stretch/main armhf libbluetooth-dev armhf 5.43-2+rpt2+deb9u2 [181 kB]
    Get:4 http://raspbian.mirror.colo-serv.net/ras­pbian stretch/main armhf libev4 armhf 1:4.22-1 [34.0 kB]
    Get:5 http://raspbian.mirror.colo-serv.net/ras­pbian stretch/main armhf libc-ares2 armhf 1.12.0-1+deb9u1 [76.0 kB]
    Get:6 http://raspbian.mirror.colo-serv.net/ras­pbian stretch/main armhf libmosquitto1 armhf 1.4.10-3+deb9u1 [46.4 kB]
    Get:7 http://raspbian.mirror.colo-serv.net/ras­pbian stretch/main armhf libuv1 armhf 1.9.1-3 [73.2 kB]
    Get:8 http://raspbian.mirror.colo-serv.net/ras­pbian stretch/main armhf libwebsockets8 armhf 2.0.3-2 [85.1 kB]
    Get:9 http://raspbian.mirror.colo-serv.net/ras­pbian stretch/main armhf mosquitto armhf 1.4.10-3+deb9u1 [120 kB]
    Get:10 http://raspbian.mirror.colo-serv.net/ras­pbian stretch/main armhf mosquitto-clients armhf 1.4.10-3+deb9u1 [51.3 kB]
    Fetched 799 kB in 2s (306 kB/s)
    Selecting previously unselected package libudev-dev:armhf.
    (Reading database ... 122135 files and directories currently installed.)
    Preparing to unpack .../0-libudev-dev_232-25+deb9u2_armhf.de­b ...
    Unpacking libudev-dev:armhf (232-25+deb9u2) ...
    Selecting previously unselected package bluetooth.
    Preparing to unpack .../1-bluetooth_5.43-2+rpt2+deb9u2_all.d­eb ...
    Unpacking bluetooth (5.43-2+rpt2+deb9u2) ...
    Selecting previously unselected package libev4.
    Preparing to unpack .../2-libev4_1%3a4.22-1_armhf.deb ...
    Unpacking libev4 (1:4.22-1) ...
    Selecting previously unselected package libc-ares2:armhf.
    Preparing to unpack .../3-libc-ares2_1.12.0-1+deb9u1_armhf.d­eb ...
    Unpacking libc-ares2:armhf (1.12.0-1+deb9u1) ...
    Selecting previously unselected package libmosquitto1:armhf.
    Preparing to unpack .../4-libmosquitto1_1.4.10-3+deb9u1_armh­f.deb ...
    Unpacking libmosquitto1:armhf (1.4.10-3+deb9u1) ...
    Selecting previously unselected package libuv1:armhf.
    Preparing to unpack .../5-libuv1_1.9.1-3_armhf.deb ...
    Unpacking libuv1:armhf (1.9.1-3) ...
    Selecting previously unselected package libwebsockets8:armhf.
    Preparing to unpack .../6-libwebsockets8_2.0.3-2_armhf.deb ...
    Unpacking libwebsockets8:armhf (2.0.3-2) ...
    Selecting previously unselected package mosquitto.
    Preparing to unpack .../7-mosquitto_1.4.10-3+deb9u1_armhf.de­b ...
    Unpacking mosquitto (1.4.10-3+deb9u1) ...
    Selecting previously unselected package mosquitto-clients.
    Preparing to unpack .../8-mosquitto-clients_1.4.10-3+deb9u1_­armhf.deb ...
    Unpacking mosquitto-clients (1.4.10-3+deb9u1) ...
    Selecting previously unselected package libbluetooth-dev.
    Preparing to unpack .../9-libbluetooth-dev_5.43-2+rpt2+deb9u­2_armhf.deb ...
    Unpacking libbluetooth-dev (5.43-2+rpt2+deb9u2) ...
    Setting up libev4 (1:4.22-1) ...
    Setting up libbluetooth-dev (5.43-2+rpt2+deb9u2) ...
    Setting up libuv1:armhf (1.9.1-3) ...
    Processing triggers for libc-bin (2.24-11+deb9u3) ...
    Setting up bluetooth (5.43-2+rpt2+deb9u2) ...
    Processing triggers for systemd (232-25+deb9u2) ...
    Processing triggers for man-db (2.7.6.1-2) ...
    Setting up libudev-dev:armhf (232-25+deb9u2) ...
    Setting up libc-ares2:armhf (1.12.0-1+deb9u1) ...
    Setting up libwebsockets8:armhf (2.0.3-2) ...
    Setting up mosquitto (1.4.10-3+deb9u1) ...
    Setting up libmosquitto1:armhf (1.4.10-3+deb9u1) ...
    Setting up mosquitto-clients (1.4.10-3+deb9u1) ...
    Processing triggers for libc-bin (2.24-11+deb9u3) ...
    Processing triggers for systemd (232-25+deb9u2) ...
    root@raspberrypi:/home/pi# sudo systemctl enable nodered.service
    Created symlink /etc/systemd/system/multi-user.target.wa­nts/nodered.service â /lib/systemd/system/nodered.service.
    root@raspberrypi:/home/pi# sudo systemctl start nodered.service
    root@raspberrypi:/home/pi# cd ~/.node-red && npm install node-red-contrib-ui
    npm WARN notice [SECURITY] debug has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?searc­h=debug&version=2.3.3 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
    npm WARN notice [SECURITY] parsejson has the following vulnerability: 1 high. Go here for more details: https://nodesecurity.io/advisories?searc­h=parsejson&version=0.0.3 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
    npm WARN notice [SECURITY] debug has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?searc­h=debug&version=2.3.3 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
    npm WARN notice [SECURITY] debug has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?searc­h=debug&version=2.3.3 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
    npm WARN notice [SECURITY] debug has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?searc­h=debug&version=2.3.3 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
    npm WARN notice [SECURITY] debug has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?searc­h=debug&version=2.2.0 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
    npm WARN node-red-project@0.0.1 No repository field.
    npm WARN node-red-project@0.0.1 No license field.
    
    + node-red-contrib-ui@1.2.20
    added 71 packages in 33.002s
    root@raspberrypi:~/.node-red# cd ~/
    root@raspberrypi:~# git clone https://github.com/espruino/EspruinoHub
    Cloning into 'EspruinoHub'...
    remote: Counting objects: 438, done.
    remote: Total 438 (delta 0), reused 0 (delta 0), pack-reused 438
    Receiving objects: 100% (438/438), 116.71 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (283/283), done.
    root@raspberrypi:~# cd EspruinoHub
    root@raspberrypi:~/EspruinoHub# npm install
    npm WARN notice [SECURITY] hoek has the following vulnerability: 1 moderate. Go here for more details: https://nodesecurity.io/advisories?searc­h=hoek&version=2.16.3 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
    
    > usb@1.3.1 install /root/EspruinoHub/node_modules/usb
    > node-pre-gyp install --fallback-to-build
    
    sh: 1: node-pre-gyp: Permission denied
    
    > bluetooth-hci-socket@0.5.1 install /root/EspruinoHub/node_modules/bluetooth­-hci-socket
    > node-gyp rebuild
    
    gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/8.11.2"
    gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp"
    gyp ERR! configure error
    gyp ERR! stack Error: EACCES: permission denied, mkdir '/root/EspruinoHub/node_modules/bluetoot­h-hci-socket/build'
    gyp ERR! System Linux 4.14.34-v7+
    gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/­node-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /root/EspruinoHub/node_modules/bluetooth­-hci-socket
    gyp ERR! node -v v8.11.2
    gyp ERR! node-gyp -v v3.6.2
    gyp ERR! not ok
    
    > websocket@1.0.26 install /root/EspruinoHub/node_modules/websocket­
    > (node-gyp rebuild 2> builderror.log) || (exit 0)
    
    npm notice created a lockfile as package-lock.json. You should commit this file.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@0.1.4 (node_modules/xpc-connection):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for xpc-connection@0.1.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: usb@1.3.1 (node_modules/usb):
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: usb@1.3.1 install: `node-pre-gyp install --fallback-to-build`
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bluetooth-hci-socket@0.5.1 (node_modules/bluetooth-hci-socket):
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bluetooth-hci-socket@0.5.1 install: `node-gyp rebuild`
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
    
    added 75 packages in 46.945s
    root@raspberrypi:~/EspruinoHub# git clone https://github.com/espruino/EspruinoWebI­DE
    Cloning into 'EspruinoWebIDE'...
    remote: Counting objects: 4477, done.
    remote: Compressing objects: 100% (20/20), done.
    remote: Total 4477 (delta 10), reused 16 (delta 6), pack-reused 4451
    Receiving objects: 100% (4477/4477), 5.77 MiB | 2.66 MiB/s, done.
    Resolving deltas: 100% (2972/2972), done.
    root@raspberrypi:~/EspruinoHub# (cd EspruinoWebIDE && git clone https://github.com/espruino/EspruinoTool­s)
    Cloning into 'EspruinoTools'...
    remote: Counting objects: 1849, done.
    remote: Compressing objects: 100% (22/22), done.
    remote: Total 1849 (delta 15), reused 22 (delta 10), pack-reused 1817
    Receiving objects: 100% (1849/1849), 590.70 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (1264/1264), done.
    root@raspberrypi:~/EspruinoHub# sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
    root@raspberrypi:~/EspruinoHub# ./start.sh
    setterm: terminal xterm does not support --blank
    module.js:549
        throw err;
        ^
    
    Error: Cannot find module 'bluetooth-hci-socket'
        at Function.Module._resolveFilename (module.js:547:15)
        at Function.Module._load (module.js:474:25)
        at Module.require (module.js:596:17)
        at require (internal/module.js:11:18)
        at Object.<anonymous> (/root/EspruinoHub/node_modules/noble/li­b/hci-socket/hci.js:6:26)
        at Module._compile (module.js:652:30)
        at Object.Module._extensions..js (module.js:663:10)
        at Module.load (module.js:565:32)
        at tryModuleLoad (module.js:505:12)
        at Function.Module._load (module.js:497:3)
    root@raspberrypi:~/EspruinoHub#
    

    not sure what I'm doing wrong
    Thank you for your help!

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user90273

    This was a fresh install from NOOBS_v2_7_0 nothing else installed before.
    Did not do update or upgrade before doing software install, maybe this is what I missed

    Thanks

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user90273

    I followed the instruction on: https://github.com/espruino/EspruinoHub
    section: Installation of everything (EspruinoHub, Node-RED, Web IDE)

    I'm getting the following error:

    events.js:183
          throw er; // Unhandled 'error' event
          ^
    
    Error: connect ECONNREFUSED 127.0.0.1:1883
        at Object._errnoException (util.js:992:11)
        at _exceptionWithHostPort (util.js:1014:20)
        at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
    

    after doing at ./start.sh from the EspruinoHub directory or trying to go to
    http://192.168.2.86:1888/mqtt.html.

    I'm not sure how I could fix this or what did I miss.

    Thank you

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user90273

    thank you, will try this out

    • 3 comments
    • 166 views
  • in Puck.js, Pixl.js and MDBT42
    Avatar for user90273

    I would like to trigger 2 IFTTT events with my Puck.js, the first IFTTT event, turns on a wifi plug and the second event turns off the wifi plug, all this done in node-red.
    I’m using the following code on the Puck.js, it send a different number each time the button is pressed, a 1 or an 11.

    var pressCount = 0;
    setWatch(function() {
      pressCount++;
      if ( pressCount == 1)
      {
        NRF.setAdvertising({
        0xFFFF : [pressCount]
       });
       pressCount = 10;
      }
      else
      {
         NRF.setAdvertising({
        0xFFFF : [pressCount]
       });
        pressCount = 0;
      }
    }, BTN, { edge:"rising", repeat:true, debounce:50 });
    
    

    in the node-red input mqtt node, I use the following as the Topic:
    /ble/advertise/ca:c2:42:7c:05:dc/ffff

    using a function node, I was trying to test for the 2 pressCount value I was sending each time I pressed the puck.js
    I could not figure how to test for the pressCount value so I ended up testing for the length.
    The following is the code I ended up using in the node fuction:

    var newMsg = { payload: msg.payload.length };
    if (newMsg.payload == 29) {
       return [  msg, null ];
    } else  {
        return [ null, msg ];
    }
    
    

    It worked out OK testing for the length, but if someone could show me how I could test for the pressCount value that would be appreciated.

    Thanks

Actions