ravenneo 0 Posted May 7, 2021 Share Posted May 7, 2021 (edited) I have a emby server working really fine in a Raspberry pi 4B. I have a wee hat on the raspi with leds and my idea is start the leds when someone is playing some video from the server. Does anyone have any idea/advice/guide to do that? Many thanks Edit: I am sorry I have just seen that there is a raspberry subforum Edited May 7, 2021 by ravenneo Link to comment Share on other sites More sharing options...
Luke 37065 Posted May 9, 2021 Share Posted May 9, 2021 Hi, you could do something like this with webhooks. @chef may have some tips. Link to comment Share on other sites More sharing options...
ravenneo 0 Posted May 9, 2021 Author Share Posted May 9, 2021 Thank you for your reply, I haven't listen before about this webhooks, I am going to do some research If anyone has another idea I will try it as well ! Link to comment Share on other sites More sharing options...
chef 3745 Posted May 15, 2021 Share Posted May 15, 2021 Do your LED lights have an http command to command them? Do they have a wifi module? Link to comment Share on other sites More sharing options...
ravenneo 0 Posted May 24, 2021 Author Share Posted May 24, 2021 On 15/05/2021 at 22:02, chef said: Do your LED lights have an http command to command them? Do they have a wifi module? Hi, the led system is this one: https://github.com/pimoroni/led-shim It goes attached to the GPIO on the raspi Link to comment Share on other sites More sharing options...
chef 3745 Posted May 25, 2021 Share Posted May 25, 2021 11 hours ago, ravenneo said: Hi, the led system is this one: https://github.com/pimoroni/led-shim It goes attached to the GPIO on the raspi Cool! When using the shim, how are you turning them on? Link to comment Share on other sites More sharing options...
ravenneo 0 Posted May 26, 2021 Author Share Posted May 26, 2021 On 25/05/2021 at 04:14, chef said: Cool! When using the shim, how are you turning them on? I normally go into the pi using ssh from my phone and then run a python script to make LEDs works. It is some kind of "ambient light" (I really like shinny things hahaha) But it would be great that with just activating emby the LEDs go on I just run an example from pimoroni called "rainbow" #!/usr/bin/env python import colorsys import time import ledshim spacing = 360.0 / 16.0 hue = 0 ledshim.set_clear_on_exit() ledshim.set_brightness(0.8) while True: hue = int(time.time() * 100) % 360 for x in range(ledshim.NUM_PIXELS): offset = x * spacing h = ((hue + offset) % 360) / 360.0 r, g, b = [int(c * 255) for c in colorsys.hsv_to_rgb(h, 1.0, 1.0)] ledshim.set_pixel(x, r, g, b) ledshim.show() time.sleep(0.0001) I am still learning to write this kind of things (my first year into linux-python world) Link to comment Share on other sites More sharing options...
chef 3745 Posted May 26, 2021 Share Posted May 26, 2021 1 hour ago, ravenneo said: I normally go into the pi using ssh from my phone and then run a python script to make LEDs works. It is some kind of "ambient light" (I really like shinny things hahaha) But it would be great that with just activating emby the LEDs go on I just run an example from pimoroni called "rainbow" #!/usr/bin/env python import colorsys import time import ledshim spacing = 360.0 / 16.0 hue = 0 ledshim.set_clear_on_exit() ledshim.set_brightness(0.8) while True: hue = int(time.time() * 100) % 360 for x in range(ledshim.NUM_PIXELS): offset = x * spacing h = ((hue + offset) % 360) / 360.0 r, g, b = [int(c * 255) for c in colorsys.hsv_to_rgb(h, 1.0, 1.0)] ledshim.set_pixel(x, r, g, b) ledshim.show() time.sleep(0.0001) I am still learning to write this kind of things (my first year into linux-python world) Okay. I think we need to create a web service on the pi. Something we can contact with either a "GET" or "POST" request which will run the code. Then we can use embys built in Webhooks to do this. I'm not familiar with creating a web service using python. Maybe Stack overflow has a post we can learn from. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now