
As mentioned before, I started using Home Assistant to create my own smart home and as it goes, you start playing with other smart devices in the home. You connect lights, heating, tv, sound system, router, and, in my case, the Formuler Z11 box. You start with little scripts to turn everything on (or off) with a single button press, instead of having to grab three separate remotes. And then you find the Universal Remote Card… a remote control card, within Home Assistant!
Standard buttons for zapping and volume were added quickly, but the ‘Groups’ and ‘Guide’ buttons turned out to be a little bit more of a challenge. But… I got it working, and below is the how-to, if you want to add custom buttons for your android tv box in Home Assistant as well.
To send a custom remote keycode to a Formuler Z11 using Home Assistant, you’ll need to utilize the androidtv integration and the adb_command service. You’ll simply need to add the command to send the desired keycode. The adb_command service allows you to send commands to your Android TV device via ADB (Android Debug Bridge). Read more here, and add it to your HACS: https://www.home-assistant.io/integrations/androidtv
Here’s how to do it:
- Enable ADB debugging on your Formuler Z11 device. Navigate to Settings > System > Developer Options and enabling USB debugging. You may need to enable developer options first by tapping the build number multiple times in the “About” section of the system settings.
- Ensure ADB is enabled and configured in Home Assistant: Make sure you have both the androidtv and Android Debug Bridge integration installed and configured in your Home Assistant instance.
- Verify that Home Assistant can connect to your Formuler Z11 using ADB. Configure ADB by entering the (fixed!) IP address. You will need to authorize the connection on the TV when prompted.
- Add a custom element in your Universal Remote Card configuration.
As a button, with the following interaction:- Tap behaviour: Perform Action
- Action: Android Debug Bridge: ADB command
- Target: Your Android Debug Bridge / Android TV connection
- Command: “input keyevent KEYCODE_11“, for the ‘groups’ button on the remote, or
- Command: “input keyevent KEYCODE_12“, for the ‘guide’ button on the remote.
- Add your shiny new button(s) to your remote card, save and use!
Below the yaml code for my remote:
type: custom:universal-remote-card
remote_id: remote.formuler_z11_pro_max_bt1
custom_actions:
- type: button
name: mylist
tap_action:
action: perform-action
perform_action: androidtv.adb_command
target:
device_id: xxxxxxxxxxxxxxxxxxxx
data:
command: input keyevent KEYCODE_11
icon: mdi:television-shimmer
- type: button
name: myguide
tap_action:
action: perform-action
perform_action: androidtv.adb_command
target:
device_id: xxxxxxxxxxxxxxxxxxxx
data:
command: input keyevent KEYCODE_12
icon: mdi:television-guide
media_player_id: media_player.formuler_z11_pro_max_bt1
rows:
- - tv_power
- home
- power
- - - volume_up
- volume_mute
- volume_down
- circlepad
- - channel_up
- null
- channel_down
- - back
- mylist
- myguide
- menu
- ""
- - info
- f1tv
- npostart
- enter
- - previous
- rewind
- play_pause
- fast_forward
- next
platform: Android TV
Important notes:
Keycode values: You can find the KEYCODE_xx to use, by going to your remote control App on the Formuler box. Configure the custom keys, let it map to a remote control button, click the button on the remote, and see your desired code appear.
Security:
When enabling ADB debugging, be aware of the security implications. Only enable it on trusted networks and consider disabling it when not actively debugging. However, this approach allows you to trigger custom actions on your Formuler Z11 using Home Assistant by sending specific ADB commands, including keycodes.
That’s all folks!
Have a nice day.