Skip to content

Trivial Python Rest API server that does one thing: give it the hostname/ip of a airport express and it'll tell you if it's currently receiving an Airplay stream.

License

Notifications You must be signed in to change notification settings

reefab/airport-express-status

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Airport Express Status

Trivial Python Rest API server that does one thing: give it the hostname/ip of a airport express and it'll tell you if it's currently receiving an Airplay stream.

No external dependencies.

Why does this even exists

I needed a way to find out if my Airport Express was receiving Airplay so I could automatically turn on my receiver and switch to its toslink input.

The Airport Express do have a HTTP API but it speaks Plist, a binary format that's not readily readable for most software.

Hence this little piece of server that requests the status of the Airport Express, extracts and decode the Airplay status and reports it back in JSON.

Usage

$ docker run -p 8000:8000 reefab/airport-express-status:latest
$ curl localhost:8000/<airport express hostname or IP>
{"Status": true}

Home Assistant

Create a binary sensor.

binary_sensor:
  - platform: rest
    name: Airport Express Airplay Status
    resource: http://localhost:8000/airport.home.arpa
    scan_interval: 30
    value_template: "{{ value_json.Status }}"

Use it in an automation:

  - alias: 🔈 Switch on receiver if airplay is active
    trigger:
      platform: state
      entity_id: binary_sensor.airport_express_airplay_status
      to: 'on'
    action:
      - service: media_player.turn_on
        entity_id: media_player.yamaha_receiver
      - service: media_player.select_source
        entity_id: media_player.yamaha_receiver
        data:
          source: 'AV4'

About

Trivial Python Rest API server that does one thing: give it the hostname/ip of a airport express and it'll tell you if it's currently receiving an Airplay stream.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages