A set of Node-RED nodes for interacting with Plejd.
Q1 Why can’t Node-RED connect to Plejd?
- Check if the Plejd mesh is not connected to another bluetooth device. The
Plejd
app for example
Q2 Why can I not use the Plejd app when node-red-contrib-plejd is running?
- It’s because only one device can be connected to the BLE mesh at the time.
Run the following command in the user directory of your Node-RED install. This is
usually ~/.node-red
.
npm install node-red-contrib-plejd
Obtaining the crypto key and the device ids is a crucial step to get this running, for this it is required to get the .site json file from the plejd app on android or iOS.
- Turn on USB debugging and connect the phone to a computer.
- Extract a backup from the phone:
$ adb backup com.plejd.plejdapp
- Unpack the backup:
$ dd if=backup.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xv
- Recover the .site file:
$ cp apps/com.plejd.plejdapp/f/*/*.site site.json
- Open a backup in iBackup viewer.
- Select raw files, look for AppDomainGroup-group.com.plejd.consumer.light.
- In AppDomainGroup-group.com.plejd.consumer.light/Documents there should be two folders.
- The folder that isn't named ".config" contains the .site file.
When the site.json file has been recovered the cryptokey and the output addresses can be extracted:
- Extract the cryptoKey:
$ cat site.json | jq '.PlejdMesh.CryptoKey' | sed 's/-//g'
- Extract the outputAddresses:
$ cat site.json | jq '.PlejdMesh.outputAdresses' | grep -v '\$type' | jq '.[][]'
Or just open site.json in your favorite editor and extract the crypto key and output addresses (IDs).
All nodes needs to be configured with a Plejd connection. The only setting for the connection is the crypto key.
Return state changes of Plejd devices in msg.payload. Example input:
{id: 11, state: 'on', dim: 255}
Change state of a Plejd device in the mesh by using msg.payload:
{id: 12, state: 'off', dim: 255}
{id: 13, state: 'on', dim: 100}
Big thanks to @klali and his https://github.com/klali/ha-plejd component for Home assistant, this project would not have been possible without it.