This Homebridge plugin allows you to watch for devices starting or stopping playing airplay audio. For each device, a motion detector is exposed that becomes active when audio is played, and inactive when no audio is being played.
The easiest way to use this plugin is to use homebridge-config-ui-x. To configure manually, add the AirplayWatcherHomebridgePlugin
platform in your config.json
file. Then, add devices to monitor:
{
"platform": "AirplayWatcherHomebridgePlugin",
"devices": [
{
"name": "The name of the device as configured in the Apple Home app (case sensitive, spaces are supported)., e.g. 'My AirportExpress'."
}
]
}
The plugin monitors UDP traffic for MDNS records from Airplay devices. Certain Airplay MDNS TXT records include a bitmask which allows predicting the device's state (playing or not). For this to work, Homebridge needs to run on the same network as the Airplay device.
See airplay-music-watcher, homebridge-airport-express-playing, and this thread on reddit for similar approaches and further information.