EspruinoHub IDE can't connect to Puck.js

Posted on
  • Hey everyone! I'm having some trouble accessing the Puck.js from the EspruinoHub IDE. After following these steps (RPi3 -> fresh Raspbian lite -> Installation of everything -> Headless Startup) I'm able to access the server at :1888 and Node Red at :1880 but the IDE doesn't give me the option to connect to the Puck.js. It just says "SEARCHING... NO PORTS FOUND".

    There's also an error reported in the Chrome developer console when I click on the Connect / Disconnect button that may be related (image attached).

    When I visit :1888/status this is what I get:

     Config loaded
     Connecting...
     Server is listening on http://localhost:1888
     www directory found at /home/pi/EspruinoHub/www. Web server at http://localhost:1888
     log directory found at /home/pi/EspruinoHub/log. Enabling logging.
     Connected
     Serving /home/pi/EspruinoHub/www/ide.html
     Serving /home/pi/EspruinoHub/www/paho-mqtt.js
     Tue Sep 04 2018 14:59:35 GMT+0000 (UTC) Connection accepted.
     Websocket MQTT connected
     Serving /home/pi/EspruinoHub/www/ide.html
     Websocket MQTT closed (WebSocket)
     Websocket MQTT closed (MQTT)
     Serving /home/pi/EspruinoHub/www/paho-mqtt.js
     Tue Sep 04 2018 15:10:50 GMT+0000 (UTC) Connection accepted.
     Websocket MQTT connected
     Serving /home/pi/EspruinoHub/www/rssi.html
     Serving /home/pi/EspruinoHub/www/tinydash.css
     Serving /home/pi/EspruinoHub/www/tinydash.js
     Serving /home/pi/EspruinoHub/www/paho-mqtt.js
     Tue Sep 04 2018 15:19:41 GMT+0000 (UTC) Connection accepted.
     Websocket MQTT connected
     Websocket MQTT closed (WebSocket)
     Websocket MQTT closed (MQTT)
     Serving /home/pi/EspruinoHub/www/index.html
     Websocket MQTT closed (WebSocket)
     Websocket MQTT closed (MQTT)
    
    Tue Sep 04 2018 15:24:11 GMT+0000 (UTC)
    

    And when I run sudo journalctl -f -u EspruinoHub this is what I get:

    -- Logs begin at Tue 2018-09-04 15:39:31 UTC. --
    Sep 04 15:39:33 raspberrypi EspruinoHub[321]: setterm: $TERM is not defined.
    Sep 04 15:39:33 raspberrypi sudo[367]:       pi : TTY=unknown ; PWD=/home/pi/EspruinoHub ; USER=root ; COMMAND=/sbin/setcap cap_net_raw+eip /usr/bin/node
    Sep 04 15:39:33 raspberrypi sudo[367]: pam_unix(sudo:session): session opened for user root by (uid=0)
    Sep 04 15:39:33 raspberrypi sudo[367]: pam_unix(sudo:session): session closed for user root
    Sep 04 15:39:34 raspberrypi EspruinoHub[321]: <Config> Config loaded
    Sep 04 15:39:35 raspberrypi EspruinoHub[321]: <MQTT> Connecting...
    Sep 04 15:39:36 raspberrypi EspruinoHub[321]: <HTTP> Server is listening on http://localhost:1888
    Sep 04 15:39:36 raspberrypi EspruinoHub[321]: <HTTP> www directory found at /home/pi/EspruinoHub/www. Web server at http://localhost:1888
    Sep 04 15:39:36 raspberrypi EspruinoHub[321]: <History> log directory found at /home/pi/EspruinoHub/log. Enabling logging.
    Sep 04 15:39:36 raspberrypi EspruinoHub[321]: <MQTT> Connected
    Sep 04 15:40:36 raspberrypi EspruinoHub[321]: <HTTP> Serving /home/pi/EspruinoHub/www/index.html
    Sep 04 15:40:39 raspberrypi EspruinoHub[321]: <HTTP> Serving /home/pi/EspruinoHub/www/ide.html
    Sep 04 15:40:39 raspberrypi EspruinoHub[321]: <HTTP> Serving /home/pi/EspruinoHub/www/paho-mqtt.js
    Sep 04 15:40:42 raspberrypi EspruinoHub[321]: <HTTP> Tue Sep 04 2018 15:40:42 GMT+0000 (UTC) Connection accepted.
    Sep 04 15:40:42 raspberrypi EspruinoHub[321]: <HTTP> Websocket MQTT connected
    Sep 04 15:41:50 raspberrypi EspruinoHub[321]: <HTTP> Serving /home/pi/EspruinoHub/www/index.html
    Sep 04 15:41:53 raspberrypi EspruinoHub[321]: <HTTP> Serving /home/pi/EspruinoHub/www/ide.html
    Sep 04 15:41:53 raspberrypi EspruinoHub[321]: <HTTP> Serving /home/pi/EspruinoHub/www/paho-mqtt.js
    Sep 04 15:41:55 raspberrypi EspruinoHub[321]: <HTTP> Tue Sep 04 2018 15:41:55 GMT+0000 (UTC) Connection accepted.
    Sep 04 15:41:55 raspberrypi EspruinoHub[321]: <HTTP> Websocket MQTT connected
    Sep 04 15:41:55 raspberrypi EspruinoHub[321]: <HTTP> Websocket MQTT closed (MQTT)
    Sep 04 15:41:56 raspberrypi EspruinoHub[321]: <HTTP> Websocket MQTT closed (WebSocket)
    

    Bluetooth seems to be working and is detecting the Puck.js if I check it from bluetoothctl:

    pi@raspberrypi:~ $ sudo bluetoothctl
    [NEW] Controller B8:27:EB:DA:35:9A raspberrypi [default]
    [NEW] Device 76:09:07:35:4B:80 76-09-07-35-4B-80
    [bluetooth]# agent on
    Agent registered
    [bluetooth]# default-agent
    Default agent request successful
    [bluetooth]# scan on
    Discovery started
    [CHG] Controller B8:27:EB:DA:35:9A Discovering: yes
    [NEW] Device DA:88:7A:76:55:3F Puck.js 553f
    

    Am I missing a step or something?


    1 Attachment

    • console.png
  • If all is going well, in the journalctl log you should see something like:

    Sep 05 07:52:12 frank EspruinoHub[2507]: <Discover> Starting scan...
    Sep 05 07:52:12 frank EspruinoHub[2507]: <Discover> Scanning started.
    

    If it doesn't (which it isn't in your case) it's probably because node.js doesn't have the right permissions to access Bluetooth LE. Can you try running which node, and if that displays a path, can you run:

    sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
    

    And see if that helps after you then do sudo systemctl restart EspruinoHub.service to restart EspruinoHub?

  • Just to add, in /status, you should see a list of the devices it has found right at the end, after the date/time is printed.

  • Thank you! I'm not sure how I messed that up twice but you suggestion to run setcap and systemctl restart fixed it. Now everything is working smoothly.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

EspruinoHub IDE can't connect to Puck.js

Posted by Avatar for Davy @Davy

Actions