@sebbo2002/pyatv-mqtt-bridge

Bridge which allows you to control your Apple TV via MQTT

Usage no npm install needed!

<script type="module">
  import sebbo2002PyatvMqttBridge from 'https://cdn.skypack.dev/@sebbo2002/pyatv-mqtt-bridge';
</script>

README

pyatv-mqtt-bridge

License Dependencies

MQTT Bridge allows you to remote control your Apple TV using the MQTT protocol. For many home automation systems, for example, this protocol is supported, so Apple TV can be integrated into your existing automation system. In addition to simulating key presses, you can also query the current state of Apple TV.

โ˜ Installation

Before you use this module you need to install pyatv. See FAQ section for installation tips.

To install the javascript module via npm run:

npm install -g @sebbo2002/pyatv-mqtt-bridge

You can also use the provided Docker container to run pyatv-mqtt-bridge within docker:

docker pull sebbo2002/pyatv-mqtt-bridge

โš’ Quick Start

  1. Use pyatv to connect to your Apple TV and authenticate [?]

  2. Create a new pyatv-mqtt-bridge configuration file. Your can use the config.example.json to start with.

{
  "broker": "mqtt://192.168.1.1",
  "devices": [
    {
      "name": "Any Name",
      "topic": "home/livingroom/appletv",
      "host": "192.168.1.2",
      "id": "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE",
      "airplayCredentials": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA:BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB:CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC:DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"
    }
  ]
}
  1. Start pyatv
pyatv-mqtt-bridge /home/eve/pyatv-mqtt-bridge.json

# or use the Docker container

docker run -d --restart=always --name=pyatv-mqtt-bridge \
    -v $(pwd)/config.json:/app/config.json:ro \
    sebbo2002/pyatv-mqtt-bridge

๐Ÿคจ FAQ

How to install pyatv

pip3 install pyatv

How can I enable debugging mode?

pyatv-mqtt-bridge --debug /home/eve/pyatv-mqtt-bridge.json

# or if you use the Docker container

docker run -d --restart=always --name=pyatv-mqtt-bridge \
    -v $(pwd)/config.json:/app/config.json:ro \
    sebbo2002/pyatv-mqtt-bridge \
    pyatv-mqtt-bridge --debug /app/config.json

How can I send commands to the Apple TV?

To execute a command send any message to the topic $device/$command. $device is the configured topic of the device and $command is a command from this list. Example: /home/living/appletv/menu.

Copyright and license

Copyright (c) Sebastian Pekarek under the MIT license.