Skip to content

Commit 51ed5f8

Browse files
bthome.py - more binary properties added
1 parent ca02177 commit 51ed5f8

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

datatypes.csv

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ Object id,Property,Data type,Factor,Example,Result,Unit
4242
0x29,smoke,uint8 (1 byte),2901,"0 (False = Clear) 1 (True = Detected)"
4343
0x2A,sound,uint8 (1 byte),2A00,"0 (False = Clear) 1 (True = Detected)"
4444
0x2B,tamper,uint8 (1 byte),2B00,"0 (False = Off) 1 (True = On)"
45-
4645
0x2C,vibration,uint8 (1 byte),2C01,"0 (False = Clear) 1 (True = Detected)"
4746
0x2D,window,uint8 (1 byte),2D01,"0 (False = Closed) 1 (True = Open)"
48-
4947
0x2E,humidity,uint8 (1 byte),1,2E23,35,%
5048
0x2F,moisture,uint8 (1 byte),1,2F23,35,%
5149
0x3D,count,uint16 (2 bytes),1,3D0960,24585,

src/bthome.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ class BTHome:
8080
SMOKE_BINARY = const(0x29) # 0 (False = Clear) 1 (True = Detected)
8181
SOUND_BINARY = const(0x2A) # 0 (False = Clear) 1 (True = Detected)
8282
TAMPER_BINARY = const(0x2B) # 0 (False = Off) 1 (True = On)
83+
VIBRATION_BINARY = const(0x2C) # 0 (False = Clear) 1 (True = Detected)
84+
WINDOW_BINARY = const(0x2D) # 0 (False = Closed) 1 (True = Open)
8385
HUMIDITY_UINT8_X1 = const(0x2E) # %
8486
MOISTURE_UINT8_X1 = const(0x2F) # %
8587
COUNT_UINT16_X1 = const(0x3D)
@@ -166,6 +168,8 @@ class BTHome:
166168
SMOKE_BINARY: "smoke", # 0x29
167169
SOUND_BINARY: "sound", # 0x2A
168170
TAMPER_BINARY: "tamper", # 0x2B
171+
VIBRATION_BINARY: "vibration", # 0x2C
172+
WINDOW_BINARY: "window", # 0x2D
169173
HUMIDITY_UINT8_X1: "humidity", # 0x2E
170174
MOISTURE_UINT8_X1: "moisture", # 0x2F
171175
COUNT_UINT16_X1: "count", # 0x3D
@@ -270,11 +274,13 @@ class BTHome:
270274
timestamp = 0
271275
tvoc = 0
272276
uv_index = 0
277+
vibration = False
273278
voltage = 0
274279
volume = 0
275280
volume_flow_rate = 0
276281
volume_storage = 0
277282
water = 0
283+
window = False
278284

279285
def __init__(self, local_name="BTHome", debug=False):
280286
local_name = local_name[:10] # Truncate to fit [^3]
@@ -394,6 +400,8 @@ def _pack_raw_text(self, object_id, value):
394400
SMOKE_BINARY: _pack_binary,
395401
SOUND_BINARY: _pack_binary,
396402
TAMPER_BINARY: _pack_binary,
403+
VIBRATION_BINARY: _pack_binary,
404+
WINDOW_BINARY: _pack_binary,
397405
HUMIDITY_UINT8_X1: _pack_int8_x1,
398406
MOISTURE_UINT8_X1: _pack_int8_x1,
399407
COUNT_UINT16_X1: _pack_int16_x1,

0 commit comments

Comments
 (0)