Jump to content

Starting Leds when Emby is sending video.


Recommended Posts

ravenneo
Posted (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 by ravenneo
Posted

Hi, you could do something like this with webhooks.

@chef may have some tips.

ravenneo
Posted

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 !

Posted

Do your LED lights have an http command to command them?

Do they have a wifi module? 

  • 2 weeks later...
ravenneo
Posted
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

Posted
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?

ravenneo
Posted
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)
 

Posted
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.

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...