Before assigning keys to the remote we need to pair the Harmony Remote with the Mi Box S, as the Mi Box S can only be controlled via Bluetooth:
Install the Harmony app to your phone or tablet from the app store
Connect the app to your Harmony Hub and add “NVIDIA Shield” as a new device.
Put the Mi Box S into pairing mode.
Create a new activity for the Harmony Remote, at the end of which the remote should get paired with the Mi Box S. The Harmony Remote shows up as “keyboard” on the Mi Box S.
If the pairing does not work, or if you need to re-pair (after changing the remote or after a reset of the box), then you need to delete the “NVIDIA Shield” device and all related activities from your Harmony Remote settings. After that, power cycle the remote and the box, then start over from a.
The Shield remote has additional keys which are understood by the Mi Box S, so we can use those to get Playback and Navigation functionality properly set up.
Open MyHarmony on your PC, then edit the button assignments for the SHIELD TV activity. Assign keys to the Harmony Remote which correspond to Kodi functions according to below's table.
In Kodi, use Keymap Editor to map keys to Kodi functions which are not recoginzed automatically. Run Keymap Editor in Program Addons, then go to Edit → Global and chose the Action Category. Assign the keys, then Save them.
A GamePad has a “Home” button, the equivalent for OK is the “A” button, the equivalent for Return is the “B” button. Other buttons would need to be mapped, but it is actually better to then use the remote for navigation.