Homebridge Plugin

Hey @drudge ,

This is amazing! Thanks so much for putting this together and sharing here. I’m totally going to get this setup at home and give this a whirl. Excited to see what else you create and please let us know what we can do to best support you. Something like turning off the screen feels like something we should support and would make the Homebridge integration even better.

Let us know if there are any other limitations that you run into that would make your time easier and we’ll see what we can do on our end!

Hey @drudge,

Thank you for putting this together. I’m not very technical but can usually follow instructions. However, I’m having issues following this. I was able to install homebridge on my NAS; i believe it is a docker container. Do you have any idea how I could install pixlet in this container within homebridge? Could I use the homebridge terminal?

Hi @bgnzo!

It is hard for me to help since I’m not familiar with your NAS setup, but if you are adding customizations to Homebridge it might make sense to build a new Docker image that bundles Homebridge + Pixlet + your homebridge plugins (like homebridge-tidbyt) and run that on your NAS instead.

Alternatively, your setup may allow you to put the Pixlet binary on a data volume or mapped host directory and then perform the setup after attaching to the running container with docker attach.

I’m running Homebridge on a Raspberry Pi and simply installed a pre-compiled Go binary and built pixlet from source there.

Hope this helps, good luck!

Hi all!

I’ve added a new feature to Custom Apps: Config Scripts

Config Scripts are Node.js modules that you can execute to dynamically build configuration parameters before they are passed to the Render Script . This allows you to tap into the vast ecosystem of modules available on npm to build your own connected applets.

A Config Script is a very simple Node module that exports a single function that returns a Promise that resolves to an array of key/value pair objects. The most trivial example looks like this:

module.exports = function(config) {
    return new Promise(function(resolve) {
        resolve([
            {
                key: 'foo',
                value: 'bar',
            },
        ]);
    });
};

I’ve put together a little tutorial to demonstrate how Config Scripts can be used in conjunction with Render Scripts to pull data from the XBOX LIVE API and push your Gamerscore to your Tidbyt device.

Here is the final result:

Let me know what you think.

Wow thank you so much for getting this created!
I was curious, what do you have homebridge setup on?
I’m on a Raspberry Pi 4 w/ Raspberry Pi OS but have been unable to get pixlet installed.
Any chance you have a similar setup?

Hi @ToWn3r !

I’m running Homebridge on a Raspberry Pi 4 using the official image based on Raspbian.

I installed Pixlet using the method outlined here, which consisted of the following steps:

  1. Run wget https://go.dev/dl/go1.17.5.linux-armv6l.tar.gz to download the latest Go for rPI 4
  2. Run sudo tar -C /usr/local -xzf go1.17.5.linux-armv6l.tar.gz to extract go in to /usr/local/
  3. Run sudo apt update && sudo apt install git libwebp-dev -y to install the libwebp dependency.
  4. Run git clone https://github.com/tidbyt/pixlet to get pixlet source
  5. Run cd pixlet && make build to build Pixlet
  6. Move the built pixlet binary to /usr/local/bin (which is in the $PATH ).
1 Like

You’re amazing!
I’m getting a strange error :frowning:

Hi @ToWn3r

It looks like Go is not in your path. Make sure it is by adding the following lines to your ~/.bashrc file:

PATH=$PATH:/usr/local/go/bin
GOPATH=$HOME/golang

Alternatively, you can alter the build command like this:

cd pixlet && PATH=$PATH:/usr/local/go/bin GOPATH=$HOME/golang make build

1 Like

:see_no_evil:

Idk where that is :frowning:

The file would be /home/pi/.bashrc. By default, ls does not show hidden/dotfiles, so the file prefixed with a period does not show. you can use ls -a to show them.

If the file doesn’t exist you can create it with those lines and it will be fine.

Alternatively, you can avoid ~/.bashrc and alter the build command instead like this:

cd pixlet && PATH=$PATH:/usr/local/go/bin GOPATH=$HOME/golang make build

1 Like

Getting closer!
Getting a permission denied

pi@ToWn3r-Pi:~ $ cd pixlet && PATH=$PATH:/usr/local/go/bin     GOPATH=$HOME/golang make build
rm -rf build/out
go run render/gen/embedfonts.go
failed to initialize build cache at /home/pi/.cache/go-build: mkdir /home/pi/.cache/go-build: permission denied
make: *** [Makefile:14: embedfonts] Error 1

If you’ve ran the command with sudo it might have changed permissions on your cache directory.

sudo chown -R pi /home/pi/.cache 

and then try the build again. Just make sure all of the directories are owned by the pi user that you are running as.

1 Like

Perfect! After running the following I think it was built.

sudo chown -R pi /home/pi/.cache

sudo PATH=$PATH:/usr/local/go/bin GOPATH=$HOME/golang make build

1 Like

Great, now you can run mv pixlet /usr/local/bin/ and pixlet will be in your path and available to the Homebridge plugin.

[Tidbyt] Could not locate the pixlet CLI. Make sure it is installed and in your PATH.

Is pixlet actually there? What does ls -lah /usr/local/bin/pixlet show?

What does this show?

> pixlet render --help

If you are unable to run the render above, what does the $PATH show when you run env?

Hi @ToWn3r

From your last screenshot, it looks like you’ve moved the entire pixlet source folder into /usr/local/bin. What we wanted to do was move the built binary there instead.

Move the source back to your home directory

> sudo mv /usr/local/bin/pixlet /home/pi/pixlet

Build pixlet:

> cd /home/pi/pixlet 
> sudo PATH=$PATH:/usr/local/go/bin GOPATH=$HOME/golang make build
> sudo mv pixlet /usr/local/bin/pixlet

Ahh i think i figured out the missing step.
After sudo PATH=$PATH:/usr/local/go/bin GOPATH=$HOME/golang make build
I had to cd /home/pi/pixlet/build/out then sudo mv pixlet /usr/local/bin/pixlet

1 Like

I’ve built this out a bit more here: