• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

cristian5th/homebridge-appletv: Configuration of pyatv and cmd4 for reading the ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

cristian5th/homebridge-appletv

开源软件地址:

https://github.com/cristian5th/homebridge-appletv

开源编程语言:

Shell 100.0%

开源软件介绍:

homebridge-appletv

Configuration of pyatv and homebridge-cmd4 for reading the Apple TV status in Homebridge.

Installation

  • Install pyatv and pair with the Apple TV.
$ pip3 install pyatv
$ /home/pi/.local/bin/atvremote scan
$ /home/pi/.local/bin/atvremote --id AA:BB:CC:DD:EE:FF --protocol airplay pair
$ /home/pi/.local/bin/atvremote --id AA:BB:CC:DD:EE:FF --protocol companion pair

pyatv installation on Synology NAS

$ sudo su
$ mkdir -p /volume1/@Entware/opt
$ rm -rf /opt
$ mkdir /opt
$ mount -o bind "/volume1/@Entware/opt" /opt

For aarch64 (see here for other architectures):

$ wget -O - https://bin.entware.net/aarch64-k3.10/installer/generic.sh | /bin/sh
  • Install pyatv and pair with the Apple TV.
$ opkg update
$ opkg install python3 python3-pip python3-cffi python3-dev
$ pip3 install pyatv
$ /volume1/@Entware/opt/bin/atvremote scan
$ /volume1/@Entware/opt/bin/atvremote --id AA:BB:CC:DD:EE:FF --protocol airplay pair
$ /volume1/@Entware/opt/bin/atvremote --id AA:BB:CC:DD:EE:FF --protocol companion pair

Note: you may get an error when executing atvremote.
ModuleNotFoundError: No module named 'bitarray._bitarray'
Downgrading bitarray will solve the problem.

pip install --upgrade bitarray==2.3.7

Upgrade

  • Upgrade pyatv when new version is released.
pip3 install --upgrade pyatv

Homebridge-cmd4 plugin configuration

Note: replace /var/lib/homebridge/ with /volume1/homebridge when using a Synology NAS

{
    "platform": "Cmd4",
    "name": "Cmd4",
    "interval": 5,
    "timeout": 4000,
    "debug": false,
    "stateChangeResponseTime": 3,
    "queueTypes": [
        {
            "queue": "A",
            "queueType": "WoRm"
        }
    ],
    "accessories": [
        {
            "type": "Switch",
            "displayName": "Apple TV Power",
            "on": "FALSE",
            "queue": "A",
            "polling": [
                {
                    "characteristic": "on"
                }
            ],
            "state_cmd": "bash /var/lib/homebridge/appletv_control.sh"
        },
        {
            "type": "Switch",
            "displayName": "Apple TV Play State",
            "on": "FALSE",
            "queue": "A",
            "polling": [
                {
                    "characteristic": "on"
                }
            ],
            "state_cmd": "bash /var/lib/homebridge/appletv_control.sh"
        },
        {
            "type": "Switch",
            "displayName": "Apple TV Video Play",
            "on": "FALSE",
            "queue": "A",
            "polling": [
                {
                    "characteristic": "on"
                }
            ],
            "state_cmd": "bash /var/lib/homebridge/appletv_control.sh"
        }

}

Shell script appletv_control.sh

Note: replace /var/lib/homebridge/ with /volume1/homebridge when using a Synology NAS

  • Place the script file inside the folder /var/lib/homebridge/
  • Set the script as executable with the command chmod +x /var/lib/homebridge/appletv_control.sh
  • Change ATV_id with the ID of your Apple TV
  • Change airplay_credentials with the credentials given when pairing with the Apple TV
  • Change companion_credentials with the credentials given when pairing with the Apple TV

Known issues

There is a known issue for pyatv if you have configured a Homepod to be the default audio output. In this case, you will always get the power to be ON (postlund/pyatv#1667).

Many thanks to




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
simonbs/homebridge-roomba: Roomba plugin for Homebridge发布时间:2022-06-17
下一篇:
luisiam/homebridge-mihome发布时间:2022-06-17
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap