1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SOLVED Unable to Configure Multiple Devices

Discussion in 'Software Support' started by sdk7_25, 1 June 2016.

  1. sdk7_25

    sdk7_25 New Member

    Messages:
    2
    Hardware:
    RPi2
    Hi All...excellent work with the software. I've been able to successfully set up my apa102 strip with the fushicai grabber on my pi. I'm running into a bit of a stumbling block when trying to integrate my Phillips Hue bulbs as well. I tried searching and couldn't locate a solution. I'm not very proficient with Raspbian or Linux, so I apologize if this is something simple and I'm missing it.

    Anyway, I tried to follow https://hyperion-project.org/wiki/Controlling-Multiple-Devices . I ran into a few problems. It looks like hyperiond is no longer located at /usr/bin/hyperiond and has been moved to /opt/hyperion/bin/hyperiond. Not a big deal as I'm fairly sure that I can simply adjust the paths accordingly in the guide. I created a second hyperion.init.sh file and placed it in /opt/hyperion/init.d.

    When I try to test it, I get the following:
    Code:
    Hyperion Ambilight Deamon
            Version   : V1.02.0 (brindosch-f4162eb/2d45d51-1462453507
            Build Time: May  5 2016 06:07:47
    INFO: Selected configuration file: /opt/hyperion/config/hyperion.config.2.json
    HYPERION INFO: ColorTransform 'default' => [0; 2]
    HYPERION INFO: ColorCorrection 'default' => [0; 2]
    HYPERION INFO: ColorAdjustment 'default' => [0; 2]
    LEDDEVICE INFO: configuration:
    {
            "colorOrder" : "rgb",
            "name" : "MyHyperionConfig",
            "output" : "192.168.200.54",
            "switchOffOnBlack" : true,
            "transitiontime" : 1,
            "type" : "philipshue",
            "username" : "lMI-Q-LhIxQjaHjbK4-Mo83SP6weVkR9tBSzEXRb"
    }
    
    HYPERION INFO: Not creating any smoothing
    EFFECTENGINE ERROR: Effect directory can not be loaded: /storage/hyperion/effects
    EFFECTENGINE INFO: Initializing Python interpreter
    LedDevicePhilipsHue::saveStates(nLights=3): found light with id 1.
    LedDevicePhilipsHue::saveStates(nLights=3): found light with id 2.
    LedDevicePhilipsHue::saveStates(nLights=3): found light with id 3.
    INFO: Hyperion started and initialised
    INFO: Boot sequence 'Rainbow swirl fast' EFFECTENGINE INFO: run effect Rainbow swirl fast on channel 0
    BLACKBORDER INFO: threshold set to 0.2 (51)
    BLACKBORDER INFO: mode:default
    started
    INFO: Json server created and started on port 19446
    INFO: Proto server created and started on port 19447
    V4L2GRABBER INFO: width=720 height=576
    V4L2GRABBER INFO: pixel format=YUYV
    terminate called after throwing an instance of 'std::runtime_error'
      what():  VIDIOC_REQBUFS ERROR 16, Device or resource busy
    
    If I turn off the hue bulbs in the app, and then run that command, it turn them on, so it's at least connecting to the Hue hub correctly

    I figured it has something to do with the second hyperion config and that I could work it out by Googling. So I tried to set the second instance of Hyperion to run on boot using the guide. But I get the following error:
    Code:
    ln: failed to access ‘/etc/rc2.d/S01hyperion2’: No such file or directory
    
    At this point, I'm unsure as to how to proceed. Any assistance would be greatly appreciated. Thanks again for all the hard work!

    Here's the config for my apa102s: http://pastebin.com/ZksMEmTZ
    Here's my WIP config for my Hue bulbs: http://pastebin.com/bBqHJdVz
    Here's the Log generated by Hypercon:
     
    Last edited: 1 June 2016
  2. Brindosch

    Brindosch Active Member

    Messages:
    678
    Hardware:
    RPi1/Zero, RPi2, RPi3, +nodeMCU/ESP8266
    Greetings,
    currently the usage of more than one hyperion instance is a way too complicated. @redPanther is working on that.
    1. service files depends on system type, the location /opt/hyperion/init.d/ is just used to copy the right file to the right place (depending on system). This dir will be removed with the next version to prevent this confusion.
    2. To startup a second configuration you need to create a second service. create a copy of this file: /etc/systemd/system/hyperion.service (at the same folder)
    and replace the config path with your bulb config path (eg file name (XY.json)).
    3.Now you need to enable this new service file with the following command
    Code:
    systemctl -q enable YOURSERVICEFILENAME
    4. Disable the V4L2 at your bulb config, you get this error cause you already use this device with your main config. All grabbed pictures are redirected to your bulb hyperion too.

    Notes: Please take notice that you no longer need the service file with the next Hyperion release. you just need to add all configs in a row to spawn multiple Hyperions.
     
  3. sdk7_25

    sdk7_25 New Member

    Messages:
    2
    Hardware:
    RPi2
    Hello. Thanks for the assistance! I removed the V4L2 on the bulb config, created a duplicate service pointed to the hue bulbs new config, forwarded the json ports from the strip config to the bulb config, and enabled the newly created service. The bulbs now light up, but the latency is incredibly high. It is my guess that the config for the phillips hue bulbs needs to be modified. I'll do some research into that. Thanks again!
     
  4. Brindosch

    Brindosch Active Member

    Messages:
    678
    Hardware:
    RPi1/Zero, RPi2, RPi3, +nodeMCU/ESP8266
  5. Doc.Ex

    Doc.Ex Member

    Messages:
    73
    Hardware:
    RPi2, +PhilipsHue
    I don't know the possibilities of v4l2, but the generic USB grabbers grab with 30hz NTSC or 25hz PAL. So a higher capture rate than that would be useless. However with smoothing enabled, a higher output rate can be beneficial.
     
  6. Brindosch

    Brindosch Active Member

    Messages:
    678
    Hardware:
    RPi1/Zero, RPi2, RPi3, +nodeMCU/ESP8266
    Ah you are right, i "skipped" this information :)
    But is this framerate used or is there a cut to lower the cpu usage
     
  7. Doc.Ex

    Doc.Ex Member

    Messages:
    73
    Hardware:
    RPi2, +PhilipsHue
    That I don't know. But since the capture seems pretty smooth and only has a fixed delay because of so many processing devices in the signal chain, I guess v4l2 grabs in the same interval as the input signal comes in. The frame decimation parameter however can reduce that frequency, which is why I always set it to 1. Keep in mind that all Info I gathered is from trial and error and I don't have a clue how the code looks like behind it, since I am no programmer.

    Btw, the input lag for philips hue is because the hue hub cant handle many requests at once. So the update frequency for the hue lights need to be reduced. From my testing a frequency of 5Hz works pretty well. However It must be divided by the number of used bulbs. so for 2 Bulbs it is 2,5hz each. To compensate the lag, a high transition time works best, so it becomes a smooth ambient lighting, rather than a hectic delayed distraction.