Lightpack 2?

Anyone had any joy connecting with the new lightpack2. I received it last night and haven’t had any time to look at it properly. Just wandering if anyone out there has done anything with it yet?

Just to update this, I may be speaking to the void but its good practise to document. I have managed to control this using a raspberry pi in close proximity sending commands. I originally tried some emulation style operating systems as it was close to my tv but it had no way to install the required packages. I resorted to straight raspbian in the end.

As this uses Bluetooth LE its recommended to use a newer pi as i am not sure if the first or second gen support it. I used a Pi 3 model B. If you’re not sure if BLE is working on your pi, check with a hcitool lescan with sudo hcitool lescan. Check that it finds your Lightpack and the MAC is correct.

Anyways. On the Pi I had this script, just sat in the root of the pi home folder. Obviously replace YourLightpackMac with your actual lightpack Bluetooth LE MAC Address. By no means is this a beautiful script, its the bare minimum! :slight_smile:

credit to this guy for working out all the values

#!/bin/sh
# stop and start the bluetooth adapter
sudo hciconfig hci0 down
sudo hciconfig hci0 up
# power/mood/media (handle 0x001c):
if [ $1 = off ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x001c --value=30
elif [ $1 = media ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x001c --value=31
elif [ $1 = mood ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x001c --value=32
# input selection (handle 0x0018):
elif [ $1 = hdmi1 ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x0018 --value=31
elif [ $1 = hdmi2 ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x0018 --value=32
elif [ $1 = hdmi3 ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x0018 --value=33
elif [ $1 = hdmi4 ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x0018 --value=34
# brightness (handle 0x0018):    
elif [ $1 = brightness0 ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x0010 --value=2D32
elif [ $1 = brightness25 ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x0010 --value=2D31
elif [ $1 = brightness50 ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x0010 --value=30
elif [ $1 = brightness75 ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x0010 --value=31
elif [ $1 = brightness100 ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x0010 --value=32
# mood lighting modes (handle 0x000c):
elif [ $1 = birchgrove ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x000c --value=62697263685F67726F7665
elif [ $1 = fireplace ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x000c --value=66697265706C616365
elif [ $1 = starrynight ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x000c --value=7374617272795F6E69676874
elif [ $1 = cafe ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x000c --value=63616665
elif [ $1 = auroraborealis ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x000c --value=6175726F72615F626F7265616C6973
elif [ $1 = stilllightwhite ]
then
gatttool -b YourLightpackMac --char-write-req --handle=0x000c --value=7374696C6C5F6C696768745F7768697465
fi

I created some input selects so I can chose the effects etc

lightpack_mode:
  name: lightpack mode
  options:
    - off
    - media
    - mood
lightpack_input:
  name: lightpack input
  options:
    - hdmi1
    - hdmi2
    - hdmi3
    - hdmi4
lightpack_mood:
  name: lightpack mood
  options:
    - hdmi1
    - hdmi2
    - hdmi3
    - hdmi4
lightpack_brightness:
  name: lightpack brightness
  options:
    - brightness0
    - brightness25
    - brightness50
    - brightness75
    - brightness100
lightpack_mood_setting:
  name: lightpack mood setting
  options:
    - birchgrove
    - fireplace
    - starrynight
    - cafe
    - auroraborealis
    - stilllightwhite

Then the shell commands to send what I want to the lightpack. I used a sshkey to connect so no password required. Again replace YourUser@YourPiAddress with your actual details

lightpack_mode: ssh -i /config/.ssh/id_rsa -o StrictHostKeyChecking=no YourUser@YourPiAddress 'exec ./lightpack.sh \"{{states.input_select.lightpack_mode.state}}\"'
lightpack_input: ssh -i /config/.ssh/id_rsa -o StrictHostKeyChecking=no YourUser@YourPiAddress 'exec ./lightpack.sh \"{{states.input_select.lightpack_input.state}}\"'
lightpack_mood: ssh -i /config/.ssh/id_rsa -o StrictHostKeyChecking=no YourUser@YourPiAddress 'exec ./lightpack.sh \"{{states.input_select.lightpack_mood.state}}\"'
lightpack_brightness: ssh -i /config/.ssh/id_rsa -o StrictHostKeyChecking=no YourUser@YourPiAddress 'exec ./lightpack.sh \"{{states.input_select.lightpack_brightness.state}}\"'
lightpack_mood_setting: ssh -i /config/.ssh/id_rsa -o StrictHostKeyChecking=no YourUser@YourPiAddress 'exec ./lightpack.sh \"{{states.input_select.lightpack_mood_setting.state}}\"'

I then as a benefit and because I could see no other feasible way of doing this, used Node Red to watch for Harmony Activity changes. If I changed to the Xbox on harmony it changes the Input to HDMI1. It takes about 1-2 seconds to switch which isn’t bad considering the actual remote isn’t that fast normally.

Annotation 2020-02-17 214629

Also my Node Red is offlline as I am transitioning my config to clean it up and broke everything, please dont call me out on these errors.

2 Likes

Thanks for posting this and I assure you that you aren’t screaming into the void!

Looking at your code I’m wondering if I can replace the raspberry pi with a ESP32 running ESPHome to control Lightpack instead.

I tried with esphome but the ble library was not very nature at the time. It most likely is very easy but I haven’t played with it. When I have time I may give it a go. I was thinking of maybe taking the nespresso Addon and manipulating it to make a custom Addon.

1 Like