homebridge-yoto 0.0.14 → 0.0.15

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.
@@ -510,16 +510,20 @@ export class YotoPlayerAccessory {
510
510
  }
511
511
 
512
512
  /**
513
- * Handle device status update from MQTT
514
- * @param {YotoDeviceStatus} status - Device status
513
+ * Handle status update from MQTT
514
+ * @param {YotoDeviceStatus} status - Status data
515
515
  */
516
516
  handleStatusUpdate (status) {
517
- this.log.debug(LOG_PREFIX.ACCESSORY, `[${this.device.name}] Status update received`)
517
+ this.log.debug(LOG_PREFIX.ACCESSORY, `[${this.device.name}] Received status update:`, JSON.stringify(status, null, 2))
518
+ this.log.debug(LOG_PREFIX.ACCESSORY, `[${this.device.name}] Status - batteryLevel:`, status.batteryLevel)
519
+ this.log.debug(LOG_PREFIX.ACCESSORY, `[${this.device.name}] Status - userVolume:`, status.userVolume)
520
+ this.log.debug(LOG_PREFIX.ACCESSORY, `[${this.device.name}] Status - volume:`, status.volume)
521
+
518
522
  this.currentStatus = status
519
523
  this.lastUpdateTime = Date.now()
520
524
  this.accessory.context.lastStatus = status
525
+ this.accessory.context.lastUpdate = this.lastUpdateTime
521
526
 
522
- // Update all characteristics
523
527
  this.updateCharacteristics()
524
528
  }
525
529
 
@@ -785,10 +789,16 @@ export class YotoPlayerAccessory {
785
789
  * @returns {Promise<CharacteristicValue>}
786
790
  */
787
791
  async getVolume () {
792
+ this.log.debug(LOG_PREFIX.ACCESSORY, `[${this.device.name}] getVolume - currentStatus:`, this.currentStatus)
793
+ this.log.debug(LOG_PREFIX.ACCESSORY, `[${this.device.name}] getVolume - userVolume:`, this.currentStatus?.userVolume)
794
+
788
795
  if (!this.currentStatus || this.currentStatus.userVolume === undefined) {
796
+ this.log.debug(LOG_PREFIX.ACCESSORY, `[${this.device.name}] getVolume - returning default: 50`)
789
797
  return 50
790
798
  }
791
- return Number(this.currentStatus.userVolume) || 50
799
+ const volume = Number(this.currentStatus.userVolume) || 50
800
+ this.log.debug(LOG_PREFIX.ACCESSORY, `[${this.device.name}] getVolume - returning:`, volume)
801
+ return volume
792
802
  }
793
803
 
794
804
  /**
@@ -849,10 +859,16 @@ export class YotoPlayerAccessory {
849
859
  * @returns {Promise<CharacteristicValue>}
850
860
  */
851
861
  async getBatteryLevel () {
862
+ this.log.debug(LOG_PREFIX.ACCESSORY, `[${this.device.name}] getBatteryLevel - currentStatus:`, this.currentStatus)
863
+ this.log.debug(LOG_PREFIX.ACCESSORY, `[${this.device.name}] getBatteryLevel - batteryLevel:`, this.currentStatus?.batteryLevel)
864
+
852
865
  if (!this.currentStatus || this.currentStatus.batteryLevel === undefined) {
866
+ this.log.debug(LOG_PREFIX.ACCESSORY, `[${this.device.name}] getBatteryLevel - returning default: 100`)
853
867
  return 100
854
868
  }
855
- return Number(this.currentStatus.batteryLevel) || 100
869
+ const battery = Number(this.currentStatus.batteryLevel) || 100
870
+ this.log.debug(LOG_PREFIX.ACCESSORY, `[${this.device.name}] getBatteryLevel - returning:`, battery)
871
+ return battery
856
872
  }
857
873
 
858
874
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-yoto",
3
3
  "description": "Control your Yoto players through Apple HomeKit with real-time MQTT updates",
4
- "version": "0.0.14",
4
+ "version": "0.0.15",
5
5
  "author": "Bret Comnes <bcomnes@gmail.com> (https://bret.io)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/bcomnes/homebridge-yoto/issues"