julioterra / yunSpacebrew

developing a version of spacebrew and Hiroki Ohtani's websocket lib that can run on the Arduino Yun.
35 stars 6 forks source link

run-spacebrew issue #6

Open fmatray opened 9 years ago

fmatray commented 9 years ago

Hello, I'm using the yun + spacebrew.

This is a part of my sketch :

  sb.verbose(true);
  sb.addPublish("Red", "range");
  sb.addPublish("Green", "range");  
  sb.addPublish("Blue", "range");
  sb.addPublish("LightDown", "boolean");
  sb.addPublish("LightUp", "boolean");
  sb.addPublish("SunSet", "boolean");
  sb.addPublish("SunRise", "boolean");
  sb.addPublish("SunRiseAlarm", "string");

  sb.addSubscribe("Red", "range");
  sb.addSubscribe("Green", "range");
  sb.addSubscribe("Blue", "range");
  sb.addSubscribe("LightDown", "boolean");
  sb.addSubscribe("LightUp", "boolean");
  sb.addSubscribe("SunSet", "boolean");
  sb.addSubscribe("SunRise", "boolean");
  sb.addSubscribe("SunRiseAlarm", "string");

When I run ps, it looks like there are missing arguments at the end of line. 10832 root 6028 R python spacebrew.py --server sandbox.spacebrew.cc --port 9000 -n Pollux -d SUNRISE -s Red , range -s Green , range -s Blue,range

My guess is there is something wrong while passing arguments threw the bridge. root@pollux:/usr/lib/python2.7/bridge# cat /usr/bin/run-spacebrew

#!/bin/sh
cd /usr/lib/python2.7/spacebrew
echo $@ > /tmp/cmd
exec python spacebrew.py $@

root@pollux:/usr/lib/python2.7/bridge# cat /tmp/cmd --server sandbox.spacebrew.cc --port 9000 -n Pollux -d SUNRISE -s Red , range -s Green , range -s Blue,range

I can't find why I get this. YUN and arduino IDE are uptodate, upgraded 2 days ago.

Best regards, Frédéric

fmatray commented 9 years ago

The only way I found to make it work is to modify run-spacebrew It's no the best way but I can use spacebrew.

#!/bin/sh

cd /usr/lib/python2.7/spacebrew
echo $@ > /tmp/cmd

exec python spacebrew.py --server sandbox.spacebrew.cc --port 9000 -n Pollux -d Sunrise -s Red , range -s Green , range -s Blue , range -s LightDown , boolean -s LightUp , boolean -s SunSet , boolean -s SunRise , boolean -s SunRiseAlarm , string -p Red , range -p Green , range -p Blue , range -p LightDown , boolean -p LightUp , boolean -p SunSet , boolean -p SunRise , boolean -p SunRiseAlarm , string

Few points :

void SpacebrewYun::send(const String& name, const String& value){
    if (publishers != NULL) {

        if (_verbose)
        {
            Console.print("Sending ");
            Console.print(name);
            Console.print(" : ");
            Console.println(value);
        }

Thanks a lot for your work, Spacebrew is very nice to use.

Best regards, Frédéric