Wiimote Control for RasPlex - AddOn (v0.5)

0.4 tested on build 1.6.2.123
0.5 tested on build 1.7.1.137

I created a small daemon that uses some dependencies from cwiid so you can use any wiimote as a remote controller for your RasPlex.

To install

Extract the content inside “/.plexht/addons/packages/” so you get a wiimote folder

if you dont know how to uncompress in linux its
tar xf wiimote.0.4.tar.gz

Edit or create autostart.sh (default location at “/.config”) with
#!/bin/sh
(
PATH="${PATH}:/storage/.plexht/addons/packages/wiimote/bin:/storage/.plexht/addons/packages/wiimote/lib";
export PATH;
PYTHONPATH="${PYTHONPATH}:/storage/.plexht/addons/packages/wiimote/lib";
export PYTHONPATH;
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/storage/.plexht/addons/packages/wiimote/lib";
export LD_LIBRARY_PATH;
sleep 10s;
python ~/.plexht/addons/packages/wiimote/bin/wiimote.py
) &

Enable BlueTooth from Services

and reboot

Features

  • The daemon will wait till you press 1+2 on a wiimote and connect
  • Press power button on the wiimote to disconnect the wiimote
  • daemon will wait for a new pairing if a connection its lost
  • Wiimotes vibrates to indicate that the connection has been established
  • LED 1 of the wiimote its kept on during the operation
  • Displays a one time warning message if battery level its below 20%

#Buttons
For now all buttons are mapped in this way

  • Use the Dpad to navigate on vertical mode
  • A = Enter/Ok
  • B = Escape/Back
  • Home = Returns to the main menu
  • Minus = Rewind
  • Plus = Fast foward
  • 1 = Change subtitle
  • 2 = Change audio track

being newer to the rasplex I found this and would love to get it working. I have extracted the ffiles and placed them all in the correct location and configured the startup.sh script but it doest pair for me.

is the cwiid another plugin necessary for the pairing to work? I am using a pi3 FYI with a default rasplex installation.

@bhorocks said:
being newer to the rasplex I found this and would love to get it working. I have extracted the ffiles and placed them all in the correct location and configured the startup.sh script but it doest pair for me.

is the cwiid another plugin necessary for the pairing to work? I am using a pi3 FYI with a default rasplex installation.

Okk, got it figured out… Works great so far!
thanks!

Because some limitations on the implementation of CWIID you need to pair the wiimote each time you want to use it and the power button will just turn off the wiimote (if you want to save battery)

For pairing you need to press 1+2 or the red sync button on the back on some later motion plus models

good to know its working for you, there is a lot of room for improvement but it works so far and it isn’t heavy on resources

This works without any extra hardware?

How? I’m actually interested because I thought the Wiimote used some kind of proprietary tech other than Bluetooth.

@Brandon4466 said:
This works without any extra hardware?

How? I’m actually interested because I thought the Wiimote used some kind of proprietary tech other than Bluetooth.

Yes

It uses Bluetooth and a proprietary interface that has been reverse engineered a long time ago. In this case Im just implementing the CWiiD library for python but there are others. You can find a lot of documentation about it.

The only thing new its that now with build in bluetooth on the pie we can use all the sensors of the wiimote for interacting with IoT devices. Plus they are dirty cheap

What hasn’t been discovered is the shutdown button commands are passed, so all the implementations that you will find doesn’t work with that button. So it isn´t possible to shutdown rasplex with that, but its always possible to assign some button combination for that.

Anyway, look on youtube for “wiimote hacks” for some cool ideas

Hey, just got a Raspberry Pi 3 and loaded RasPlex on it! I installed your addon, however I cannot get the Wiimote paired, the four lights just continue to blink… is there a more step-by-step tutorial you can provide?

Thanks!

So I managed to get it paired, but it seems that the daemon is like only half working. I can use the arrow keys to navigate but that’s it. A, B, 1, 2, Home, and Power all don’t work. Am I supposed to pair it a specific way?

Also autostart.sh doesn’t run on boot, I have to many start it…

I get what you are saying, you are currently not running the daemon. If you pair a wiimote as a normal bluetooth joystick you will notice that only the crosshair works with the GUI. Thats why I made the daemon.

If the Daemon its working you should get a pop up message on rasplex asking you to press 1+2 to connect your wiimote. You can do this at any time and it should always connect to the Pi as long as Bluetooth its enable.

To test the autostart.sh file make it executable with chmod +x and run it over ssh. If something its pointing to a wrong directory it will tell you, but its very important to set the correct paths for the script to run.

Just remember
autostart.sh goes in ~/.config
and the uncompressed plugin should go in ~/.plexht/addons/packages/ with the bin and lib files inside the “wiimote” folder (I noticed that the forum changes the name of the file)

Also have in mind I haven’t tested yet on 1.7.1, I might have a specific version for it on monday as I know it has been some changes that could prevent commands to be passed to the GUI.

ok if you are running it on 1.7.1

edit ~/.plexht/addons/packages/wiimote/bin/wiimote.py
go to like 35 where it reads

port = 9778

change it to

port = 9777

and it should work

Also, make sure to have bluetooth enabled or it will silently fail
You will know that the plugin its running if you get this pop up message when you start rasplex

I will update now my original post and upload a corrected version if you just wish to make a clean install

Hi,

what a nice plugin. Im looking for a way to use my xbox 360 controller and was wondering, if it was possible to use it with this fancy plugin. Of course, changes and tweaks for matching the xbox keymap would be needed.

Is this something worth thinking about?

@prometheus247 said:
Hi,

what a nice plugin. Im looking for a way to use my xbox 360 controller and was wondering, if it was possible to use it with this fancy plugin. Of course, changes and tweaks for matching the xbox keymap would be needed.

Is this something worth thinking about?

Mmmm… its not really possible to make it compatible

You would need an xbox wireless receiver as it doesn´t use standard bluetooth communication as the Wii or PS3 and the driver implementation would be different.

sorry, I don´t have one to test it but I think its already implemented at some level

In fact some people used my same approach

How to get wiimote.0.4.tar.gz?

I will upload it again tomorrow
the original files were lost on the change of forum