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

Dont work #23

Open andrkaz opened 3 years ago

andrkaz commented 3 years ago

sudo ./am43ctrl /home/xxxxx/node_modules/am43-ctrl/src/am43.js:29 static busyDevice = null; ^

SyntaxError: Unexpected token = at Module._compile (internal/modules/cjs/loader.js:723:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (/home/pi/node_modules/am43-ctrl/index.js:7:14) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

willemdej commented 3 years ago

do you installed as root?

willemdej commented 3 years ago

run and install in root map then > example; /am43ctrl 02b62c22d6bc -d --url mqtt://yourbrokerip:1883 -u username -p password

andrkaz commented 3 years ago

This problem solved. First I upgrade node.js to last version v14.15.1, after that am43ctrl can start manually. If try to start as service via systemd, some erorrs appear and service failed to start. I make sh script:

!/bin/bash

sleep 60s sudo /home/pi/node_modules/.bin/am43ctrl MAC --url mqtt://192.168.1.99 -u user -p pass -d

The "sleep" command is needed so that the other services have time to start. And finally put this script into crontab for start once when system is booting, like this:

@reboot root /home/pi/am43.sh