binsentsu / am43-ctrl

Node Util for controlling an AM43 Blinds Drive Cover, either over MQTT or via a HTTP API
44 stars 25 forks source link

What is problem? I don't know linux. #13

Open famtory opened 4 years ago

famtory commented 4 years ago

I don't know linux.

raspbian lite. installed nodejs, git, libusb, libudev. I tried nodejs 10.x and 12.x. same result.

=================================================== pi@raspberrypi:~ $ npm install https://github.com/binsentsu/am43-ctrl

usb@1.6.3 install /home/pi/node_modules/usb prebuild-install --verbose || node-gyp rebuild

prebuild-install info begin Prebuild-install version 5.3.3 prebuild-install info looking for cached prebuild @ /home/pi/.npm/_prebuilds/470134-usb-v1.6.3-node-v72-linux-arm.tar.gz prebuild-install http request GET https://github.com/tessel/node-usb/releases/download/v1.6.3/usb-v1.6.3-node-v72-linux-arm.tar.gz prebuild-install http 404 https://github.com/tessel/node-usb/releases/download/v1.6.3/usb-v1.6.3-node-v72-linux-arm.tar.gz prebuild-install WARN install No prebuilt binaries found (target=12.16.3 runtime=node arch=arm libc= platform=linux) make: Entering directory '/home/pi/node_modules/usb/build' CC(target) Release/obj.target/libusb/libusb/libusb/core.o CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o CC(target) Release/obj.target/libusb/libusb/libusb/io.o CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o CC(target) Release/obj.target/libusb/libusb/libusb/sync.o CC(target) Release/obj.target/libusb/libusb/libusb/os/poll_posix.o CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_udev.o AR(target) Release/obj.target/usb.a COPY Release/usb.a CXX(target) Release/obj.target/usb_bindings/src/node_usb.o In file included from ../src/helpers.h:3, from ../src/node_usb.h:21, from ../src/node_usb.cc:1: ../node_modules/nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker)’: ../node_modules/nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void ()(uv_work_t)’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type] , reinterpret_cast(AsyncExecuteComplete) ^ In file included from ../src/node_usb.h:14, from ../src/node_usb.cc:1: ../src/node_usb.cc: At global scope: /home/pi/.cache/node-gyp/12.16.3/include/node/node.h:608:43: warning: cast between incompatible function types from ‘void ()(v8::Local)’ to ‘node::addon_register_func’ {aka ‘void ()(v8::Local, v8::Local, void)’} [-Wcast-function-type] (node::addon_register_func) (regfunc), \ ^ /home/pi/.cache/node-gyp/12.16.3/include/node/node.h:642:3: note: in expansion of macro ‘NODE_MODULE_X’ NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage) ^~~~~ ../src/node_usb.cc:95:1: note: in expansion of macro ‘NODE_MODULE’ NODE_MODULE(usb_bindings, Initialize) ^~~ ../src/node_usb.cc: In function ‘void handleHotplug(std::pair<libusb_device, libusb_hotplug_event>)’: ../src/node_usb.cc:151:58: warning: ‘v8::Local Nan::MakeCallback(v8::Local, const char, int, v8::Local)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(Nan::New(hotplugThis), "emit", 2, argv); ^ In file included from ../src/helpers.h:3, from ../src/node_usb.h:21, from ../src/node_usb.cc:1: ../node_modules/nan/nan.h:1001:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ ../src/node_usb.cc:151:58: warning: ‘v8::Local Nan::MakeCallback(v8::Local, const char, int, v8::Local)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(Nan::New(hotplugThis), "emit", 2, argv); ^ In file included from ../src/helpers.h:3, from ../src/node_usb.h:21, from ../src/node_usb.cc:1: ../node_modules/nan/nan.h:1001:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ In file included from ../src/node_usb.h:12, from ../src/node_usb.cc:1: /home/pi/.cache/node-gyp/12.16.3/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfo&) ’: /home/pi/.cache/node-gyp/12.16.3/include/node/node_object_wrap.h:85:78: required from here /home/pi/.cache/node-gyp/12.16.3/include/node/v8.h:10226:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo::Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type] reinterpret_cast(callback), type); ^~~~~~~~ /home/pi/.cache/node-gyp/12.16.3/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfo&)]’: ../node_modules/nan/nan_object_wrap.h:65:61: required from here /home/pi/.cache/node-gyp/12.16.3/include/node/v8.h:10226:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo::Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type] CXX(target) Release/obj.target/usb_bindings/src/device.o In file included from ../src/helpers.h:3, from ../src/node_usb.h:21, from ../src/device.cc:1: ../node_modules/nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker)’: ../node_modules/nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void ()(uv_work_t)’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type] , reinterpret_cast(AsyncExecuteComplete) ^ ../src/device.cc: In member function ‘void Req::submit(Device, v8::Local, uv_work_cb, uv_work_cb)’: ../src/device.cc:220:70: warning: cast between incompatible function types from ‘uv_work_cb’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type] uv_queue_work(uv_default_loop(), &req, backend, (uv_after_work_cb) after); ^~~~~ ../src/device.cc: In static member function ‘static void Req::default_after(uv_work_t)’: ../src/device.cc:237:64: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(device, Nan::New(baton->callback), 1, argv); ^ In file included from ../src/helpers.h:3, from ../src/node_usb.h:21, from ../src/device.cc:1: ../node_modules/nan/nan.h:959:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ ../src/device.cc:237:64: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(device, Nan::New(baton->callback), 1, argv); ^ In file included from ../src/helpers.h:3, from ../src/node_usb.h:21, from ../src/device.cc:1: ../node_modules/nan/nan.h:959:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ In file included from ../src/node_usb.h:12, from ../src/device.cc:1: /home/pi/.cache/node-gyp/12.16.3/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfo&) ’: /home/pi/.cache/node-gyp/12.16.3/include/node/node_object_wrap.h:85:78: required from here /home/pi/.cache/node-gyp/12.16.3/include/node/v8.h:10226:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo::Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type] reinterpret_cast(callback), type); ^~~~~~~~ /home/pi/.cache/node-gyp/12.16.3/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfo&)]’: ../node_modules/nan/nan_object_wrap.h:65:61: required from here /home/pi/.cache/node-gyp/12.16.3/include/node/v8.h:10226:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo::Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type] CXX(target) Release/obj.target/usb_bindings/src/transfer.o In file included from ../src/helpers.h:3, from ../src/node_usb.h:21, from ../src/transfer.cc:1: ../node_modules/nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker)’: ../node_modules/nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void ()(uv_work_t)’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type] , reinterpret_cast(AsyncExecuteComplete) ^ ../src/transfer.cc: In function ‘void handleCompletion(Transfer)’: ../src/transfer.cc:126:72: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(self->handle(), Nan::New(self->v8callback), 3, argv); ^ In file included from ../src/helpers.h:3, from ../src/node_usb.h:21, from ../src/transfer.cc:1: ../node_modules/nan/nan.h:959:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ ../src/transfer.cc:126:72: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(self->handle(), Nan::New(self->v8callback), 3, argv); ^ In file included from ../src/helpers.h:3, from ../src/node_usb.h:21, from ../src/transfer.cc:1: ../node_modules/nan/nan.h:959:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ In file included from ../src/node_usb.h:12, from ../src/transfer.cc:1: /home/pi/.cache/node-gyp/12.16.3/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfo&) ’: /home/pi/.cache/node-gyp/12.16.3/include/node/node_object_wrap.h:85:78: required from here /home/pi/.cache/node-gyp/12.16.3/include/node/v8.h:10226:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo::Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type] reinterpret_cast(callback), type); ^~~~~~~~ /home/pi/.cache/node-gyp/12.16.3/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfo&)]’: ../node_modules/nan/nan_object_wrap.h:65:61: required from here /home/pi/.cache/node-gyp/12.16.3/include/node/v8.h:10226:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo::Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type] SOLINK_MODULE(target) Release/obj.target/usb_bindings.node COPY Release/usb_bindings.node make: Leaving directory '/home/pi/node_modules/usb/build'

@abandonware/bluetooth-hci-socket@0.5.3-5 install /home/pi/node_modules/@abandonware/bluetooth-hci-socket node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download node-pre-gyp WARN Tried to download(404): https://github.com/abandonware/node-bluetooth-hci-socket/releases/download/0.5.3-5/binding-0.5.3-5-node-v72-linux-arm.tar.gz node-pre-gyp WARN Pre-built binaries not found for @abandonware/bluetooth-hci-socket@0.5.3-5 and node@12.16.3 (node-v72 ABI, glibc) (falling back to source compile with node-gyp) make: Entering directory '/home/pi/node_modules/@abandonware/bluetooth-hci-socket/build' CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o In file included from ../src/BluetoothHciSocket.cpp:8: ../../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker)’: ../../../nan/nan.h:2294:62: warning: cast between incompatible function types from ‘void ()(uv_work_t)’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type] , reinterpret_cast(AsyncExecuteComplete) ^ In file included from /home/pi/.cache/node-gyp/12.16.3/include/node/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: ../src/BluetoothHciSocket.cpp: At global scope: /home/pi/.cache/node-gyp/12.16.3/include/node/node.h:608:43: warning: cast between incompatible function types from ‘void ()(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void ()(v8::Local)’} to ‘node::addon_register_func’ {aka ‘void ()(v8::Local, v8::Local, void*)’} [-Wcast-function-type] (node::addon_register_func) (regfunc), \ ^ /home/pi/.cache/node-gyp/12.16.3/include/node/node.h:642:3: note: in expansion of macro ‘NODE_MODULE_X’ NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage) ^~~~~ ../src/BluetoothHciSocket.cpp:578:1: note: in expansion of macro ‘NODE_MODULE’ NODE_MODULE(binding, BluetoothHciSocket::Init); ^~~ SOLINK_MODULE(target) Release/obj.target/binding.node COPY Release/binding.node COPY /home/pi/node_modules/@abandonware/bluetooth-hci-socket/lib/binding/binding.node TOUCH Release/obj.target/action_after_build.stamp make: Leaving directory '/home/pi/node_modules/@abandonware/bluetooth-hci-socket/build' npm WARN pi@1.0.0 No description npm WARN pi@1.0.0 No repository field.

1 package is looking for funding run npm fund for details

found 0 vulnerabilities

pi@raspberrypi:~ $ sudo am43ctrl sudo: am43ctrl: command not found pi@raspberrypi:~ $ sudo am43-ctrl sudo: am43-ctrl: command not found pi@raspberrypi:~ $ sudo am43ctrl 02:XX:XX:XX:XX:XX sudo: am43ctrl: command not found

================================================= what is problem?

famtory commented 4 years ago

cd into node_modules/.bin run by using: sudo ./am43ctrl … like in readme.

pi@raspberrypi:~/node_modules/.bin $ sudo ./am43ctrl 02:xx:xx:xx:xx:xx am43* ERROR: Neither --express-port or --mqtt-url supplied, nothing to do +0ms Usage: am43ctrl MAC1 MAC2 --express-port 3000 --url [mqtt|ws][s]://yourbroker.example.com

Options: --help Show help [boolean] --version Show version number [boolean] -d, --debug Enable debug logging [boolean] -l, --express-port Port for express web server (if unset, express will not startup) [number] --url, --mqtt-url MQTT broker URL --topic, --mqtt-base-topic Base topic for MQTT [default: "homeassistant"] -p, --mqtt-password Password for MQTT (if not specified as an argument, will prompt for password at startup) -u, --mqtt-username Username for MQTT

Examples: am43ctrl MAC1 MAC2 --url [broker_url] Connect to devices with specific IDs only, publish to MQTT pi@raspberrypi:~/node_modules/.bin $

famtory commented 4 years ago

pi@raspberrypi:~/node_modules/.bin $ sudo ./am43ctrl 02:xx:xx:xx:xx:xx -l 3000 am43* scanning for 1 device(s) [ '02xxxxxxxxxx' ] +0ms pi@raspberrypi:~/node_modules/.bin $

==================== Is it OK??

danielbrunt57 commented 3 years ago

May I piggyback on this issue? I though I knew linux but this nodejs and npm is all new territory. After many hours of research, I've managed to get am43ctrl to install but have the following error when trying to run it:

root@HS3Pi3v5:~/node_modules/.bin# ./am43ctrl 
/root/node_modules/@abandonware/noble/lib/hci-socket/hci.js:74
  this._socket = new BluetoothHciSocket();
                 ^

Error: EAFNOSUPPORT, Address family not supported by protocol
    at new Hci (/root/node_modules/@abandonware/noble/lib/hci-socket/hci.js:74:18)
    at new NobleBindings (/root/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:25:15)
    at Object.<anonymous> (/root/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:546:18)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
root@HS3Pi3v5:~/node_modules/.bin# node --version
v8.17.0