@@ -94,7 +94,7 @@ class SwitchbotAdvertising {
9494 sd = this . _parseServiceDataForWoContact ( buf , onlog ) ; //WoContact
9595 } else if ( model === "c" ) {
9696 sd = this . _parseServiceDataForWoCurtain ( buf , onlog ) ; // WoCurtain
97- } else if ( model === "x" ) {
97+ } else if ( model === "x" || 'X' ) {
9898 sd = this . _parseServiceDataForWoBlindTilt ( buf , onlog ) ; // WoBlindTilt
9999 } else if ( model === "u" ) {
100100 sd = this . _parseServiceDataForWoBulb ( manufacturerData , onlog ) ; // WoBulb
@@ -378,25 +378,21 @@ class SwitchbotAdvertising {
378378 }
379379 let byte1 = buf . readUInt8 ( 1 ) ;
380380 let byte2 = buf . readUInt8 ( 2 ) ;
381- let byte3 = buf . readUInt8 ( 3 ) ;
382- let byte4 = buf . readUInt8 ( 4 ) ;
383381
384- let calibration = byte1 & 0b01000000 ? true : false ; // Whether the calibration is completed
382+ let calibration = byte1 & 0b00000001 ? true : false ; // Whether the calibration is completed
385383 let battery = byte2 & 0b01111111 ; // %
386- let inMotion = byte3 & 0b10000000 ? true : false ;
387- let currPosition = byte3 & 0b01111111 ; // current positon %
388- let lightLevel = ( byte4 >> 4 ) & 0b00001111 ; // light sensor level (1-10)
389- let deviceChain = byte4 & 0b00000111 ;
384+ let inMotion = byte2 & 0b10000000 ? true : false ;
385+ let tilt = byte2 & 0b01111111 ; // current tilt % (100 - _tilt) if reverse else _tilt,
386+ let lightLevel = ( byte1 >> 4 ) & 0b00001111 ; // light sensor level (1-10)
390387
391388 let data = {
392389 model : "x" ,
393390 modelName : "WoBlindTilt" ,
394391 calibration : calibration ,
395392 battery : battery ,
396393 inMotion : inMotion ,
397- position : currPosition ,
394+ tilt : tilt ,
398395 lightLevel : lightLevel ,
399- deviceChain : deviceChain ,
400396 } ;
401397
402398 return data ;
0 commit comments