lukasroegner / homebridge-apple-tv-remote

Plugin for controlling Apple TVs in homebridge.
MIT License
131 stars 13 forks source link

Commands json configuration wiki #76

Closed martinorob closed 3 years ago

martinorob commented 3 years ago

Hi, I'm no more able to find an example to write the commands section on json configuration.

I've added this

{ "name": "Apple TV Platform", "devices": [{ "name": "AppleTV", "credentials": "CREDENTIALS", "isOnOffSwitchEnabled": false, "onOffSwitchName": "OFF", "isPlayPauseSwitchEnabled": true, "playPauseSwitchName": "TV STATO", "commandSwitches": [{ "name": "DeejayTV", "commands": [{ "key": "up", "longPress": false }, { "key": "right", "longPress": false, "repeat": 7, "interval": 0.1, "pause": 0.3 }, { "key": "select", "longPress": false } ] }], "isApiEnabled": true, "apiPort": 40304, "apiToken": "TOKEN", "platform": "AppleTvPlatform" }] }

to do "up" -> "right" x7 -> "select" when I push the DeejayTV button but I receive this error

Your config.json contains an illegal platform configuration object at position 2. Missing property 'platform'. Skipping entry...

please may someone help me? Thanks

martinorob commented 3 years ago

Solved with this:

{ "name": "Apple TV Platform", "devices": [ { "name": "AppleTV", "credentials": "CREDENTIALS", "isOnOffSwitchEnabled": false, "onOffSwitchName": "OFF", "isPlayPauseSwitchEnabled": true, "playPauseSwitchName": "TV STATO", "commandSwitches": [ { "name": "DeejayTV", "commands": [ { "key": "menu", "pause": 0.3 }, { "key": "up", "pause": 0.3 }, { "key": "right", "pause": 0.3 }, { "key": "right", "pause": 0.3 }, { "key": "right", "pause": 0.3 }, { "key": "right", "pause": 0.3 }, { "key": "right", "pause": 0.3 }, { "key": "right", "pause": 0.3 }, { "key": "right", "pause": 0.3 }, { "key": "select", "longPress": false } ] } ] } ], "isApiEnabled": true, "apiPort": 40304, "apiToken": "TOKEN", "platform": "AppleTvPlatform" }

Now I need a way to send an api request to turn ON the command "DeejayTV".. any suggestion?

Thanks

martinorob commented 3 years ago

Solved:

/usr/bin/curl -X POST http://ip:port/UNIQUEID/ -d '{"commands":[{"key": "menu","pause": 3},{"wait": 2000},{"key": "up","pause": 0.3},{"key": "right","pause": 0.3},{"key": "right","pause": 0.3},{"key": "right","pause": 0.3},{"key": "right","pause": 0.3},{"key": "right","pause": 0.3},{"key": "right","pause": 0.3},{"key": "right","pause": 0.3},{"key": "select","longPress": false}]}' --header "Content-Type: application/json" --header "Authorization: TOKEN"