Posts by milhouse

    My setup:

    instance 0 - APA102 strips behind the tv

    instance 1 - nanoleaf

    instance 2 - nanoleaf panels

    USB capture device from Roku running plex.

    Everything works great.


    What I am trying to do is turn the leds on when media plays and off when media stops by using a plex webhook. I am catching the webhook, looking for the play uuid (so it only turns the lights on/off for that player) and the media.start and media.stop events.



    Every request call I make gives an error from hyperion. Python error:

    ConnectionError: ('Connection aborted.', BadStatusLine('{"command":"","error":"Errors during message parsing, please consult the Hyperion Log.","success":false,"tan":0}\n',))


    Error from hyperion log:

    2021-10-20T11:47:17.838Z [hyperiond JSONCLIENTCONNECTION] (ERROR) Failed to parse json data from JsonRpc@::ffff:192.168.2.73: Error: illegal value at Line: 0, Column: 1


    The curl version of the commands all work:



    curl -X POST -i 'http://192.168.2.73:8090/json-rpc' --data '{"command":"componentstate","componentstate":{"component":"LEDDEVICE","state":false}}'

    curl -X POST -i 'http://192.168.2.73:8090/json-rpc' --data '{"command" : "instance","subcommand" : "stopInstance","instance" : 1}'

    curl -X POST -i 'http://192.168.2.73:8090/json-rpc' --data '{"command" : "instance","subcommand" : "stopInstance","instance" : 2}'



    curl -X POST -i 'http://192.168.2.73:8090/json-rpc' --data '{"command":"componentstate","componentstate":{"component":"LEDDEVICE","state":true}}'

    curl -X POST -i 'http://192.168.2.73:8090/json-rpc' --data '{"command" : "instance","subcommand" : "startInstance","instance" : 1}'

    curl -X POST -i 'http://192.168.2.73:8090/json-rpc' --data '{"command" : "instance","subcommand" : "startInstance","instance" : 2}'



    Any clue why the python request isn't working the same way as the curl version?


    And as an aside, is there a better way to turn the leds on and off? Seems that instance 0 as the default behaves differently from instances 1 and 2. I would need to change the connected instance and then turn the LEDDEVICE off, but I can't figure out how to pass multiple commands, either. I would need to, in a single call

    Code
    {  "command" : "instance",  "subcommand" : "switchTo",  "instance" : 1 }
    {"command":"componentstate","componentstate":{"component":"LEDDEVICE","state":true}}


    Thanks in advance for any pointers.


    milhouse


    Got it! The http port 8090 worked better than the json-rpc port. This code works:


    I recommend watching this page:
    https://github.com/hyperion-project/hyperion.ng/releases


    and wait for an alpha 6 release.


    Alpha 5 isn't working for nanoleaf. Fix is checked in, so you can compile it yourself (https://github.com/hyperion-pr…ob/master/CompileHowto.md) or just wait for the next release that fixes nanoleaf.


    Then set up the LED hardware w/ controller type nanoleaf, hardware led count, ip address, and token. Then on the LED layout tab set the left/right/top/bottom counts and make sure they add up to the same as the led controller tab and the nanolead itself.

    Nope, it's already on the pi.
    pi@raspberrypi:~ $ sudo apt-get install libssl-dev
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    libssl-dev is already the newest version (1.1.1d-0+deb10u1).
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.



    I think it's the buster docker container that doesn't have a functioning libssl-dev package. Even though it's in the docker config.


    The Raspi-Buster build script doesn't work - error above. The stretch one worked fine even though I am on Buster. So now I have the latest build and my nanolead panels work again.

    Same error for me earlier in the thread. An earlier build compiled just fine, but the later alpha builds don't compile.


    Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
    system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
    OPENSSL_INCLUDE_DIR) (Required is at least version "1.0.0")
    Call Stack (most recent call first):
    /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
    /usr/share/cmake-3.13/Modules/FindOpenSSL.cmake:412 (find_package_handle_standard_args)
    cmake/Dependencies.cmake:54 (find_package)
    src/hyperiond/CMakeLists.txt:115 (DeployUnix)


    I've tried to resolve, but just can't get past this error.


    (I need to compile b/c I need the latest master version - alpha5 is broken for nanoleaf)


    thanks
    milhouse

    What I did...
    set up a virtual switch in smartthings
    make that virtual switch available to alexa - should be able to turn on/off the switch
    set up a python script that basically creates a web server that passes commands to the pi.
    https://hyperion-project.org/t…-a-small-web-server.3022/


    use webcore to make a web call when the virtual switch changes


    If you are using smartthings/webcore already it's a small effort. If you are using HA you probably also have a rules engine in place.

    Excellent, thanks for your help. It looks like the PR is still being discussed, so I I might try compiling from your fork for now when I get some time. Unless the merge seems imminent. My German is a little weak, so it's hard to follow the discussion. :)

    Thanks, both. I've got everything set up correctly near as I can tell, but no luck turning on the lights so still stuck and wondering what the LED layout looks like.
    Version 1.0.0
    Build master (GitHub-b51e67a/5e55962-1568748826) Git Remote: https://github.com/hyperion-project/hyperion.ng.git
    Build date Oct 8 2019 19:26:46
    I know it's working because I can go to the Remote Control module and turn the Hue lights to a solid color, for example.


    I set up a second instance for my nanoleaf panels, everything looks peachy. Using the same API key I use in smartthings, so pretty sure the key is good. Firmware 3.2.0.



    What I expected was that the LED Layout tab would at least have the right number of LEDs which would be an indicator that it was connecting and getting the LED list. But it shows 26 LEDs for some reason instead of 20.



    What's your LED Layout look like? Any other ideas to troubleshoot?


    Thanks again-
    milhouse

    Can you provide just a bit more detail on getting the nanoleaf aurora to work with hyperion.ng? I compiled it and it seemed to be working correctly, but I didn't have nanoleaf in the list of device types. Is there a manual step to creating the device with the config text in the first post?


    Thanks-
    milhouse

    You are most welcome - glad it worked!


    Can't help you with the rest, no idea how Google Home works. My SmartThings hub is on my local network, so it can call the endpoint directly. You are probably going to have to open a hole in your firewall and port forward from your router to port 8080 on your Pi's internal IP address. Good luck!


    milhouse

    Just going to make a stab in the dark, based on this error line:
    AssertionError: View function mapping is overwriting an existing endpoint function: index


    I wonder if flask doesn't like the same variable name used more than once. Maybe change each def to be something different?
    @route('/color/<colorid>')
    def indexc(colorid):
    subprocess.check_output(['/usr/bin/hyperion-remote', '--color', colorid])
    return "done"
    @route('/effect/<effectname>')
    def indexe(effectname):
    subprocess.check_output(['/usr/bin/hyperion-remote', '--effect', effectname])
    return "done"
    @route('/clearall')
    def indexclear():
    subprocess.check_output(['/usr/bin/hyperion-remote', '--clearall'])
    return "done"

    Well, that's something I never quite figured out how to do. I don't have the webserver script run on startup - never managed to get it to work right. I manually run my shell script (the 4 line script above, rm + nohup python lines) every time I reboot - only every couple of months, so not very labor intensive. If you are going to reboot regularly you'd probably want to get it to start automatically. Why a regular reboot at all? My pi runs for months without issue. The file cleanup I do is simply because the bottle webserver doesn't run properly if I don't delete them first - has nothing to do with actually needing a regular restart.


    If it ran on startup, then you'd probably skip the nohup part since it would be independent of a logged in user. But I have no idea where the bottle files would go. Can't remember exactly what problems I had trying to get it to run on boot. If you figure out how to do it, let me know please!


    Startup order actually shouldn't matter - the webserver doesn't actually interface directly with hyperion, it just runs a command line when called.

    I wonder if the script is not starting up correctly because of some leftover bottle files from a previous crash. That would be files that start with bottle* AND a file that seems to include the machine name.
    pi@Pi-Attic:~ $ ls
    bottle.log Documents Pictures Videos
    bottle.pid Downloads Public
    bottle.pid.lock Music python_games
    Desktop Pi-Attic-76f9b8c0.517-158751035 Templates


    In my shell script that starts the webserver, I clean up any potential leftovers first, then start the hyperion web server.


    #!/bin/sh
    rm bottle* -f
    rm Pi-Attic* -f
    nohup /usr/bin/python /home/pi/Documents/hyperionweb.py start



    Give that a try - stop the bottle web server ("hyperionweb.py stop"), clean up the files above, then start again. Give it a minute to get running, then try calling it.

    If you are sure the script is actually running (e.g. does it work from the Pi itself through a browser or curl), then I can only assume you are right and it's the orbi. I've never seen a consumer grade router that blocks anything on the LAN side, though.


    Should only need port forwarding if you want things to be accessible from outside your home network.


    In the python script, did you leave the 0.0.0.0 address or change it to the static IP? If you leave at 0.0.0.0 then it should accept connections on all IPs (like if the pi is on wireless and wired networks).


    Does ifconfig show you the IP address you think you have assigned?

    Yes, you could have a virtual switch available to Alexa. Webcore could respond to the switch changes to off trigger, make a web call to the clearall endpoint, and turn the virtual switch back on (so it's ready agin for the turn off). Or a momentary switch.


    Like you said - could be a lot of virtual switches if you wanted finer control. And you'd have to pay attention to priorities in hyperion, in case you wanted to override the HDMI signlat with an effect for example.


    I use the random effect (of my favorite effects) so it's just part of my outdoor lighting routines. On at sunset -30, off at 11:00pm.

    Took my first stab at creating a new effect for my outside LED strips. Nothing fancy, based originally on the Snake effect. All it does it start with all green LEDs, and then change them to red, one at a time across the strip. Pause when it hits all red, the starts changing to green in the same direction.


    Could have been a lot more efficient, I am sure, and doesn't really use the parameters in the json file. But hey - it works, and looks good across the front of the house.


    To install, just unzip and put both files in your "effects" directory.


    Merry Christmas, all!


    milhouse

    Files

    • snakexmas.zip

      (721 Byte, downloaded 281 times, last: )