Espruino Hub on Raspberry SSL issue

Posted on
  • Hi there,
    I noticed that the Espruino Hub software is installed without SSL certificate.
    Thus it is unable to connect via Bluetooth.
    Any instructions available to add https?
    Cheers.


    1 Attachment

    • Screenshot from 2023-02-17 22-57-41.png
  • Hi - you shouldn't need this if EspruinoHub is working correctly. If you just want to use Web Bluetooth use espruino.com/ide

    What happens is EspruinoHub serves up a page which creates a WebSocket connection back to EspruinoHub. Then EspruinoHub handles the bluetooth connection (which it doesn't need SSL for)

  • Yes but that was my point, you should mention that in the manual that without SSL is not going to allow.
    Yes of course I can use the public web version which has SSL.
    Cheers.

  • I'm not sure where in the manual you mean but if you want to do a PR for the extra docs I'll happily merge.

    I'm still not sure why you'd want to use Web Bluetooth when the whole point of using EspruinoHub is to use the bluetooth that it provides though?

  • I think we are missing each other, yes exactly I want to use the EspruinoHub installed on my Raspberry so that I can connect remotely from my laptop (which is far away from the BLE sensors) to the ide and then program the sensors via the WebBluetooth option.
    Yes I could do the same thing via SSH into the box and run the commandline but this is not always possible because of firewalls and other controls.

    I seem to recall that not having SSL enabled on webpages doesn't allow the WebBluetooth dialog to be available?

  • Ahh, I think I see what you're getting at.

    "Web Bluetooth" is the thing that allows the Web Browser to use your PC's Bluetooth connection. And yes, you need HTTPS for that.

    But that's not what we're using to allow you to access Bluetooth sensors from far away.

    Instead, EspruinoHub uses a WebSocket connection from the page that hosts the IDE back to EspruinoHub, and the bluetooth connection goes through that. Web Bluetooth is not needed.

    Maybe you could check http://yourhost:1888/status and see if any devices have been found there?

    If they have, when you open the http://yourhost:1888/ide and click the connect button (you may have to wait a few seconds) the bluetooth devices in range that Espruino recognises should just appear, as in the picture below:

    You could always check the Chrome Debug console to see if anything looks amiss


    1 Attachment

    • Screenshot at 2023-02-23 08-56-53.png
  • It seems to have crashed today let me investigate...

  • It seems to be happened at midnight.

    1. EspruinoHub.service - EspruinoHub BLE -> MQTT bridge
    2. Loaded: loaded (/etc/systemd/system/EspruinoHub.service; enabled; vendor preset: enabled)
    3. Active: failed (Result: exit-code) since Sat 2023-02-18 01:33:55 GMT; 5 days ago
    4. Docs: https://github.com/espruino/EspruinoHub
    5. Process: 25723 ExecStart=/home/pi/EspruinoHub/start.sh (code=exited, status=1/FAILURE)
    6. Main PID: 25723 (code=exited, status=1/FAILURE)
    7. CPU: 897ms
    8. Feb 18 01:33:55 pihome systemd[1]: EspruinoHub.service: Scheduled restart job, restart counter is at 5.
    9. Feb 18 01:33:55 pihome systemd[1]: Stopped EspruinoHub BLE -> MQTT bridge.
    10. Feb 18 01:33:55 pihome systemd[1]: EspruinoHub.service: Start request repeated too quickly.
    11. Feb 18 01:33:55 pihome systemd[1]: EspruinoHub.service: Failed with result 'exit-code'.
    12. Feb 18 01:33:55 pihome systemd[1]: Failed to start EspruinoHub BLE -> MQTT bridge.
  • It seems to be constantly failing even when restarting this is weird ...

  • I know EspruinoHub does attempt to restart if it can't detect any Bluetooth LE devices in range because it thinks something might be broken - could that be it?

  • There are like 20 devices in range, I can't really understand what is the problem.
    I will probably reinstall everything again.

  • I have wrote my own docker compose file now which works quite well, but one question about the config.json:

    1. "mqtt_host": "mqtt://localhost",
    2. "//mqtt_options": {
    3. "username": "user",
    4. "password": "pass",
    5. "clientId": "clientid"
    6. },

    if I have an open MQTT broker, do I just omit the username and password fields?

  • I seem to have solved my problems, here's the docker file:

    1. version: "3.9"
    2. services:
    3. espruinohub:
    4. image: espruino/espruinohub
    5. hostname: espruinohub
    6. container_name: espruinohub
    7. privileged: true
    8. environment:
    9. - TZ=Europe/London
    10. - NOBLE_HCI_DEVICE_ID=0
    11. network_mode: host
    12. volumes:
    13. - /home/pi/espruinohub/config.json:/data/config.json:ro
    14. restart: unless-stopped
    15. node-red:
    16. image: nodered/node-red:latest
    17. environment:
    18. - TZ=Europe/London
    19. ports:
    20. - "1880:1880"
    21. network_mode: host
    22. volumes:
    23. - node-red-data:/data
    24. restart: unless-stopped
    25. mosquitto:
    26. image: eclipse-mosquitto:2
    27. volumes:
    28. #- ./mqtt/config/:/mosquitto/config/
    29. - ./mqtt/log/:/mosquitto/log/
    30. - mqtt-data:/mosquitto/data/
    31. network_mode: host
    32. ports:
    33. - 1883:1883
    34. - 9001:9001
    35. volumes:
    36. node-red-data:
    37. mqtt-data:

    I need to find the folder where to store the Espruino web pages.

  • Great, glad it's working for you! I think you can just leave mqtt_options commented with "//mqtt_options" and it should be fine if there is no password

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

Espruino Hub on Raspberry SSL issue

Posted by Avatar for user153457 @user153457

Actions