Skip to content

Commit

Permalink
feat: Polling now calls updateValue
Browse files Browse the repository at this point in the history
  • Loading branch information
ztalbot2000 committed Mar 11, 2021
1 parent 78cf3ea commit 9c75b06
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions Cmd4Accessory.js
Original file line number Diff line number Diff line change
Expand Up @@ -2378,11 +2378,24 @@ class Cmd4Accessory
clearTimeout( this.listOfRunningPolls[ accessory.displayName + accTypeEnumIndex ] );

// i.e. Characteristic.On
// i.e. Characteristic.RotationDirection
// For fetch since polling, always use getValue
self.service.getCharacteristic(
CMD4_ACC_TYPE_ENUM.properties[ accTypeEnumIndex ].characteristic
).getValue( );
// Characteristic.RotationDirection

accessory.getValue( accTypeEnumIndex, function ( error, properValue) {
{
if ( error == 0 )
{
let characteristicString = CMD4_ACC_TYPE_ENUM.properties[ accTypeEnumIndex ].type;

if ( accessory.statusMsg == true )
self.log.info( chalk.blue( `characteristicPolling Updating ${ accessory.displayName } ${ characteristicString }` ) + ` ${ properValue }` );
else
accessory.log.debug( chalk.blue( `characteristicPolling Updating ${ accessory.displayName } ${ characteristicString }` ) + ` ${ properValue }` );

accessory.service.getCharacteristic( CMD4_ACC_TYPE_ENUM.properties[ accTypeEnumIndex ].characteristic ).updateValue( properValue );
}

}});



// Add the check of this.listOfRunningPolls so that in Unit Testing, we can delete polling
Expand Down

0 comments on commit 9c75b06

Please sign in to comment.