fbacker / broadlink-mqtt-bridge

Bridge Broadlink RM Devices with MQTT and API for e.g. OpenHAB
41 stars 14 forks source link

Error when running index.js #10

Closed OhNoItSJoe closed 5 years ago

OhNoItSJoe commented 5 years ago

Hello Fbacker, I tried what you said earlier today and it worked. Now I'm getting a new Error. Read the error in the code down below.

I can't reach the webgui on port 3001 (I changed it). It said that the MQTT connection worked.

I reinstalled my openHAB (v2.4 now) and got this error after running "node index.js" in the broadlink-mqtt-bridge directroy:



env { LC_ALL: 'en_US.UTF-8',
  LS_COLORS: 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:',
  LESSCLOSE: '/usr/bin/lesspipe %s %s',
  LANG: 'en_US.UTF-8',
  SUDO_GID: '1000',
  EDITOR: 'nano',
  USERNAME: 'root',
  SUDO_COMMAND: '/bin/bash',
  NO_AT_BRIDGE: '1',
  USER: 'root',
  PWD: '/srv/openhab2-conf/broadlink-mqtt-bridge',
  HOME: '/root',
  LC_CTYPE: 'en_US.UTF-8',
  SUDO_USER: 'openhabian',
  SUDO_UID: '1000',
  MAIL: '/var/mail/root',
  SHELL: '/bin/bash',
  TERM: 'xterm',
  SHLVL: '1',
  LANGUAGE: 'en_US.UTF-8',
  LOGNAME: 'root',
  PATH: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
  GCC_COLORS: 'error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01',
  LESSOPEN: '| /usr/bin/lesspipe %s',
  OLDPWD: '/srv/openhab2-conf',
  _: '/usr/bin/node' }
commandsPath /srv/openhab2-conf/broadlink-mqtt-bridge/commands
2018-12-19 20:48:53 [info]:     Starting Broadlink MQTT NodeJS Application
2018-12-19 20:48:53 [info]:     MQTT Options {
  "host": "127.0.0.1",
  "port": 1883,
  "protocol": "mqtt",
  "subscribeBasePath": "broadlink",
  "username": "censored",
  "password": "censored"
}
2018-12-19 20:48:53 [info]:     GUI Web listen on port 3001
2018-12-19 20:48:53 [info]:     MQTT Connected {
  "cmd": "connack",
  "retain": false,
  "qos": 0,
  "dup": false,
  "length": 2,
  "topic": null,
  "payload": null,
  "sessionPresent": false,
  "returnCode": 0
}
/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/broadlinkjs-rm/index.js:194
      log(`\n\x1b[35m[Info]\x1b[0m We've discovered an unknown Broadlink device. This likely won't cause any issues.\n\nPlease raise an issue in the GitHub repository (https://github.com/lprhodes/homebridge-broadlink-rm/issues) with details of the type of device and its device type code: "${deviceType.toString(16)}". The device is connected to your network with the IP address "${host.address}".\n`);
      ^

TypeError: log is not a function
    at Broadlink.addDevice (/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/broadlinkjs-rm/index.js:194:7)
    at Broadlink.onMessage (/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/broadlinkjs-rm/index.js:171:10)
    at emitTwo (events.js:126:13)
    at Socket.emit (events.js:214:7)
    at UDP.onMessage [as onmessage] (dgram.js:659:8)
fbacker commented 5 years ago

are you running as sudo? try node index.js. Update to latest version and try again and post the output.

Seems you are getting the error "We've discovered an unknown Broadlink device." What device are you trying to use?

OhNoItSJoe commented 5 years ago

I will try updating it again, I just installed it yesterday. And I will run index.js as sudo as soon as I get home.

I am using the BroadLink RM Mini 3

OhNoItSJoe commented 5 years ago

`[21:09:10] openhabian@openHABianPi:/srv/openhab2-conf/broadlink-mqtt-bridge$ sudo -s [21:09:14] root@openHABianPi:/srv/openhab2-conf/broadlink-mqtt-bridge# bash -c "$(curl -sL https://raw.githubusercontent.com/fbacker/broadlink-mqtt-bridge/master/installers/raspberry.sh)"


| "\ /" \ / " \ /""\ |" "|" | |" \ (" |" |/"| / ") (. |) :|: |// \ / \ (. __ :|| | || ||.\ \ (: |/ / |: \/|/ / / ) :/' /\ \ |: \ ) ||: | |: ||: . \ | / (| _ \ // (: (__/ /// ' \ (| (_\ ||\ | |. ||. \ . (// \ |: |_) :|: \ / / \ |: :( _|: \ /\ || \ \ |: | \ \ (_____/|_| \)"__(/ _(__/ ___(_|\|_(| _)

Installing helper tools ... Reading package lists... Done Building dependency tree Reading state information... Done git is already the newest version (1:2.11.0-3+deb9u4). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Check current Node installation ... Node currently installed. Checking version number. Minimum Node version: v8.12.0 Installed Node version: v8.14.0 No Node.js upgrade necessary. It seems like Broadlink-Bridge is already installed. We'll try to upgrade instead.

Upgrade ... Updating 2ae9b70..3bd52b9 error: Your local changes to the following files would be overwritten by merge: README.md device.js index.js Please commit your changes or stash them before you merge. Aborting Unable to upgrade. Please run git pull manually. [21:09:26] root@openHABianPi:/srv/openhab2-conf/broadlink-mqtt-bridge# [21:09:26] root@openHABianPi:/srv/openhab2-conf/broadlink-mqtt-bridge# sudo git pull Updating 2ae9b70..3bd52b9 error: Your local changes to the following files would be overwritten by merge: README.md device.js index.js Please commit your changes or stash them before you merge. Aborting `

OhNoItSJoe commented 5 years ago

Just unistalled the bridge an reinstalled it, same error. I ran index.js as sudo and normal.

fbacker commented 5 years ago

Your first update didn't work because it looks like you modified files in the project.

Looks like the underlaying plugin doesn't support the RM Mini 3. There's a pull request to fix this that hasn't been merge. I've created a new pull request, so hopefully this will be resolved soon.

OhNoItSJoe commented 5 years ago

Thank you very much! Looking forward to use this binding soon.

Which BroadLink device do you use?

fbacker commented 5 years ago

Lets hope he will merge the request. I've setup notifications so I'll know when something happens.

I'm using the Broadlink RM PRO+ to control the heater and tv with IR. Ceiling fans, car heater and outdoor lights with RF.

OhNoItSJoe commented 5 years ago

Any news by chance? I might just buy a rm pro until the rm mini works, will have a use for it elsewhere.

fbacker commented 5 years ago

Doesn't happen anything in the repo, so made an npm change to the fellow who we I think have a fix. please try latest version and see if it works now.

OhNoItSJoe commented 5 years ago

Oh my god, it is working! Thank you really much! By the way, is there a way to support your project here?

fbacker commented 5 years ago

Perfect. Then I'm happy.

No way to support for the moment, just enjoy and hope it's working for you. Maybe in the future when I have the time to really sit down with the project I might add a support possibility.