@sebbo2002/pyatv-mqtt-bridge 4.0.2 โ 4.0.3-develop.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -15
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -7,14 +7,13 @@ MQTT Bridge allows you to remote control your Apple TV using the MQTT protocol.
|
|
|
7
7
|
example, this protocol is supported, so Apple TV can be integrated into your existing automation system. In addition to
|
|
8
8
|
simulating key presses, you can also query the current state of Apple TV.
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
## โ Installation
|
|
12
11
|
|
|
13
12
|
Before you use this module you need to install `pyatv`. See FAQ section for installation tips.
|
|
14
13
|
|
|
15
14
|
To install the javascript module via npm run:
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
npm install -g @sebbo2002/pyatv-mqtt-bridge
|
|
18
17
|
|
|
19
18
|
You can also use the provided Docker container to run `pyatv-mqtt-bridge` within docker:
|
|
20
19
|
|
|
@@ -30,31 +29,40 @@ You can also use the provided Docker container to run `pyatv-mqtt-bridge` within
|
|
|
30
29
|
|
|
31
30
|
```json
|
|
32
31
|
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
"broker": "mqtt://192.168.1.1",
|
|
33
|
+
"devices": [
|
|
34
|
+
{
|
|
35
|
+
"name": "Any Name",
|
|
36
|
+
"topic": "home/livingroom/appletv",
|
|
37
|
+
"host": "192.168.1.2",
|
|
38
|
+
"id": "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE",
|
|
39
|
+
"airplayCredentials": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA:BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB:CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC:DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
43
42
|
}
|
|
44
43
|
```
|
|
45
44
|
|
|
46
45
|
3. Start pyatv
|
|
46
|
+
|
|
47
|
+
- By command line :
|
|
48
|
+
|
|
47
49
|
```bash
|
|
48
50
|
pyatv-mqtt-bridge /home/eve/pyatv-mqtt-bridge.json
|
|
51
|
+
```
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
- or use the Docker container :
|
|
51
54
|
|
|
55
|
+
```bash
|
|
52
56
|
docker run -d --restart=always --name=pyatv-mqtt-bridge \
|
|
53
57
|
-v $(pwd)/config.json:/app/config.json:ro \
|
|
54
58
|
sebbo2002/pyatv-mqtt-bridge
|
|
55
59
|
```
|
|
56
60
|
|
|
61
|
+
- or just run the Docker container from the [`docker-compose.yml`](docker-compose.yml) file with :
|
|
57
62
|
|
|
63
|
+
```bash
|
|
64
|
+
docker-compose up -d
|
|
65
|
+
```
|
|
58
66
|
|
|
59
67
|
## ๐คจ FAQ
|
|
60
68
|
|
|
@@ -64,25 +72,66 @@ docker run -d --restart=always --name=pyatv-mqtt-bridge \
|
|
|
64
72
|
pip3 install pyatv
|
|
65
73
|
```
|
|
66
74
|
|
|
67
|
-
#### How can I enable debugging mode?
|
|
75
|
+
#### How can I enable debugging mode ?
|
|
76
|
+
|
|
77
|
+
You just need to add the `--debug` option.
|
|
78
|
+
|
|
79
|
+
- In command line :
|
|
68
80
|
|
|
69
81
|
```bash
|
|
70
82
|
pyatv-mqtt-bridge --debug /home/eve/pyatv-mqtt-bridge.json
|
|
83
|
+
```
|
|
71
84
|
|
|
72
|
-
|
|
85
|
+
- or while using the Docker container :
|
|
73
86
|
|
|
87
|
+
```bash
|
|
74
88
|
docker run -d --restart=always --name=pyatv-mqtt-bridge \
|
|
75
89
|
-v $(pwd)/config.json:/app/config.json:ro \
|
|
76
90
|
sebbo2002/pyatv-mqtt-bridge \
|
|
77
91
|
pyatv-mqtt-bridge --debug /app/config.json
|
|
78
92
|
```
|
|
79
93
|
|
|
94
|
+
- or while using the [`docker-compose.yml`](docker-compose.yml) file :
|
|
95
|
+
|
|
96
|
+
```yaml
|
|
97
|
+
command: pyatv-mqtt-bridge --debug /app/config.json
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
then restart the container with :
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
docker-compose up
|
|
104
|
+
```
|
|
80
105
|
|
|
81
106
|
#### How can I send commands to the Apple TV?
|
|
107
|
+
|
|
82
108
|
To execute a command send any message to the topic `$device/$command`. `$device` is the configured topic of the device
|
|
83
109
|
and `$command` is a command from [this list](https://github.com/sebbo2002/node-pyatv/blob/develop/src/lib/types.ts#L49).
|
|
84
110
|
Example: `/home/living/appletv/menu`.
|
|
85
111
|
|
|
112
|
+
#### How to check the current Apple TV power state and other status information ?
|
|
113
|
+
|
|
114
|
+
You can listen to several subtopics from the root MQTT topic you've set on your `config.json` file
|
|
115
|
+
(i.e. : `/home/living/appletv`), such as `/powerState` (on, off) and `/deviceState` (iddle, playing, etc...).
|
|
116
|
+
|
|
117
|
+
#### When the Apple TV is off, the turnOff command turns it on instead, how to fix this ?
|
|
118
|
+
|
|
119
|
+
Say you send an MQTT message to turn off your Apple TV each time you're leaving home,
|
|
120
|
+
with the following MQTT topic : `/home/living/appletv/turnOff`.
|
|
121
|
+
... but when you are back home, sometimes your Apple TV is on ! ๐ค
|
|
122
|
+
|
|
123
|
+
Actually, if you press the power button in the right upper corner of your Apple TV remote iOS app, while your Apple TV
|
|
124
|
+
is already off, it will switch it on as well, and this project only provides bridging between MQTT
|
|
125
|
+
and PyATV / Apple TV APIs, with no additional data persistence.
|
|
126
|
+
|
|
127
|
+
> (You could use the `/suspend` command instead of `/turnOff` to avoid this, but the `suspend` and `wakeup`
|
|
128
|
+
> commands are deprecated and may lead to unexpected behaviors).
|
|
129
|
+
|
|
130
|
+
So you just need to implement a listener for the powerState MQTT topic (i.e. : `/home/living/appletv/powerState`)
|
|
131
|
+
in your own app, and store the payload value somewhere (DB, local file, Redis...).
|
|
132
|
+
|
|
133
|
+
Then your app logic with some "standby apple TV" feature should trigger an MQTT `/turnOff` command ONLY when your
|
|
134
|
+
powerState stored value is 'on'.
|
|
86
135
|
|
|
87
136
|
## Copyright and license
|
|
88
137
|
|
package/package.json
CHANGED
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
"@semantic-release/git": "^10.0.1",
|
|
22
22
|
"@semantic-release/github": "^8.0.6",
|
|
23
23
|
"@types/mocha": "^10.0.0",
|
|
24
|
-
"@types/node": "^18.
|
|
24
|
+
"@types/node": "^18.11.9",
|
|
25
25
|
"@types/ws": "^8.5.3",
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
27
|
-
"@typescript-eslint/parser": "^5.
|
|
28
|
-
"eslint": "^8.
|
|
29
|
-
"eslint-plugin-jsonc": "^2.
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^5.42.0",
|
|
27
|
+
"@typescript-eslint/parser": "^5.42.0",
|
|
28
|
+
"eslint": "^8.26.0",
|
|
29
|
+
"eslint-plugin-jsonc": "^2.5.0",
|
|
30
30
|
"esm": "^3.2.25",
|
|
31
31
|
"license-checker": "^25.0.1",
|
|
32
32
|
"semantic-release": "^19.0.5",
|
|
33
33
|
"semantic-release-license": "^1.0.3",
|
|
34
34
|
"ts-node": "^10.8.1",
|
|
35
|
-
"typedoc": "^0.23.
|
|
35
|
+
"typedoc": "^0.23.20",
|
|
36
36
|
"typescript": "^4.8.4"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"start": "node ./dist/bin/cli.js"
|
|
60
60
|
},
|
|
61
61
|
"type": "module",
|
|
62
|
-
"version": "4.0.2"
|
|
62
|
+
"version": "4.0.3-develop.2"
|
|
63
63
|
}
|