You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was reviewing the DACP protocol trying to find a way to detect when the Apple TV was turned off (so I could add play, pause and off lights) however the closest I got was detecting when the app is closed (or turned off). It works really well, is this something you would be happy for me to PR?
If not, and for anyone interested in setting this up for automation (I have only tested this on the alternate-playpause-switch) there's a few simple changes you need to make.
The first is to change the switch type to Outlet which enables on/off (playing/paused) and in use (on when playing / paused, off when app is closed).
And finally we need to add some state monitors for logging
_getOnState(callback){this.log(`Returning current on state: ${this._isOn ? 'on' : 'off'}`);callback(undefined,this._isOn);}async_setOnState(isOn,callback){this.log(`Setting current on state: ${isOn ? 'on' : 'off'}`);this._isOn=isOn;}
Once that is done, you should be able to listen to the power state going off to determine the Apple TV is off (or close enough at least).
The text was updated successfully, but these errors were encountered:
I was reviewing the DACP protocol trying to find a way to detect when the Apple TV was turned off (so I could add play, pause and off lights) however the closest I got was detecting when the app is closed (or turned off). It works really well, is this something you would be happy for me to PR?
If not, and for anyone interested in setting this up for automation (I have only tested this on the
alternate-playpause-switch
) there's a few simple changes you need to make.The first is to change the switch type to
Outlet
which enables on/off (playing/paused) and in use (on when playing / paused, off when app is closed).homebridge-dacp/src/DacpAccessory.js
Lines 95 to 108 in 8a8f472
This needs to change to:
And then the controls service needs to change too:
homebridge-dacp/src/PlayerControlsService.js
Line 3 in 8a8f472
The constructor needs to support the new parameter
The service needs to use the new characteristic
The update needs to track the new characteristic and determine the on state
And finally we need to add some state monitors for logging
Once that is done, you should be able to listen to the power state going off to determine the Apple TV is off (or close enough at least).
The text was updated successfully, but these errors were encountered: