Skip to content

Can't add new buttons. Client won't connect. #116

@Sawtaytoes

Description

@Sawtaytoes

Error when doing new FlicClient on the latest version I pulled down today:

node:events:495
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED ::1:5551
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
Emitted 'error' event on FlicClient instance at:
    at FlicClient.rawClient.onError (/home/pi/projects/fliclib-linux-hci/clientlib/nodejs/fliclibNodeJs.js:911:6)
    at Socket.onError (/home/pi/projects/fliclib-linux-hci/clientlib/nodejs/fliclibNodeJs.js:158:6)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 5551
}

Node.js v18.18.0

Not sure when this broke, but I re-added my Flic buttons at least a year ago, so it was working back then provided I updated the SDK at that time too.

These are the commands I use to start the flicd server and add buttons:

pi@Apple-Pi:~ $ cat ./scripts/start-filc-daemon.sh
#!/bin/bash

echo "Checking for Bluetooth service"
bluetoothServiceState=$(service bluetooth status | grep 'active (running)')

if [ "$bluetoothServiceState" != "" ]; then
  echo "Bluetooth service found. Running command..."
  sudo ~/projects/fliclib-linux-hci/bin/armv6l/flicd -f ~/flic-db.sqlite3 -w -s 0.0.0.0 -d
else
  echo "Bluetooth service not found. Trying again."
  sleep 2
  bash "$0" && exit
fi
pi@Apple-Pi:~ $ cat ./scripts/scan-new-clients.sh
#!/bin/bash

node ~/projects/fliclib-linux-hci/clientlib/nodejs/newscanwizard.js

Starting flicd and scanning

pi@Apple-Pi:~ $ ./scripts/start-filc-daemon.sh
Checking for Bluetooth service
Bluetooth service found. Running command...
Available HCI devices found:

Trying hci0
Flic server is now up and running!
Entering daemon state...
pi@Apple-Pi:~ $ ./scripts/scan-new-clients.sh
node:events:495
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED ::1:5551
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
Emitted 'error' event on FlicClient instance at:
    at FlicClient.rawClient.onError (/home/pi/projects/fliclib-linux-hci/clientlib/nodejs/fliclibNodeJs.js:911:6)
    at Socket.onError (/home/pi/projects/fliclib-linux-hci/clientlib/nodejs/fliclibNodeJs.js:158:6)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 5551
}

Node.js v18.18.0

I know it's running, just not why it won't connect all of a sudden. I'm listening on 0.0.0.0, so that should cover all interfaces. Also, I can connect to this service from another device just fine with new FlicClient. It's only when running the scanner that it has issues.

Am I missing something or forgetting how this worked? Did something change since I ran this command last?

What are the steps I should be doing to add new devices?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions