ha-bridge: Cannot run external script.

Hi, I am trying to execute nodejs script from ha-bridge and getting errors, I set command type to “Execute Script/Program” and my command is [{"item":"nodejs ~/Downloads/ha-bridge/scripts/led.js 2 on", "type":"cmdDevice"}] The command nodejs ~/Downloads/ha-bridge/scripts/led.js 2 on runs fine in terminal. But running in ha-bridge I am getting error:

Request Error, Please look in your habridge log: error {“type”:6,“address”:“/lights/2”,“description”:“Error on calling out to device”,“parameter”:“/lights/2state”}

Looking into debug log I see

Decode Json for url items: [{"item":"[{\"item\":\"nodejs ~/Downloads/ha-nridge/scripts/led.js 2 on\"}]","type":"cmdDevice"}]
Exec Request called with url: [{"item":"nodejs ~/Downloads/ha-nridge/scripts/led.js 2 on"}]
Executing request: [{"item":"nodejs ~/Downloads/ha-nridge/scripts/led.js 2 on"}]    com.bwssystems.HABridge.plugins.exec.CommandHome
Could not execute request: [{"item":"nodejs ~/Downloads/ha-nridge/scripts/led.js 2 on"}]

Any idea what’s wrong? Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (9 by maintainers)

Most upvoted comments

It’s working out beautifully. I put together a small blog post: http://codecorner.galanter.net/2017/02/24/full-control-of-your-limitless-ledmilight-v6-bulbs-from-amazon-echo/ maybe will be useful to others struggling with Milight v6.

Thanks,

Yuriy.

On Fri, Feb 24, 2017 at 8:45 PM, Yuriy Galanter yuri@galanter.net wrote:

Never mind, deleted and re-added the device and it’s is working now. Here’s final commands:

ON: nodejs /home/ygalanter/ha-bridge/scripts/led.js 2 on DIM: nodejs /home/ygalanter/ha-bridge/scripts/led.js 2 dim ${intensity.percent} OFF: nodejs /home/ygalanter/ha-bridge/scripts/led.js 2 off

btw, I am using https://github.com/mwittig/node-milight-promise module, which is a very nice wrapper for Milight v6. Maybe others can use it too.

Thanks for your help!

Yuriy.

On Fri, Feb 24, 2017 at 3:02 PM, yuri@galanter.net wrote:

Yes, this is content of the led.sh (I am passing params to it):

#!/bin/sh /usr/bin/nodejs /home/ygalanter/ha-bridge/scripts/led.js $1 $2

if I call it from terminal as

/usr/bin/nodejs /home/ygalanter/ha-bridge/scripts/led.js 2 off

it works. But bridge stirll throws

Request Error, Pleae look in your habridge log: error {“type”:6,“address”:“/lights/2”,“description”:“Error on calling out to device”,“parameter”:“/lights/2state”}

From: BWS Systems notifications@github.com Sent: Friday, February 24, 2017 2:56 PM To: bwssytems/ha-bridge ha-bridge@noreply.github.com Cc: ygalanter yuri@galanter.net ; Author author@noreply.github.com Subject: Re: [bwssytems/ha-bridge] Cannot run external script. (#496)

You will need to have the whole command in the script:

/usr/bin/nodejs /home/ygalanter/ha-bridge/scripts/led.js 2 off

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bwssytems/ha-bridge/issues/496#issuecomment-282389034, or mute the thread https://github.com/notifications/unsubscribe-auth/AHhqwD0tqLj7RYK6wxv86tNViu40i2xrks5rfzXugaJpZM4MLitI .