Skip to content

Commit 216d1f0

Browse files
bthome.py - more binary properties added
1 parent 66a653f commit 216d1f0

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

datatypes.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ Object id,Property,Data type,Factor,Example,Result,Unit
3535
0x22,moving,uint8 (1 byte),2201,"0 (False = Not moving) 1 (True = Moving)"
3636
0x23,occupancy,uint8 (1 byte),2301,"0 (False = Clear) 1 (True = Detected)"
3737
0x24,plug,uint8 (1 byte),2400,"0 (False = Unplugged) 1 (True = Plugged in)"
38-
3938
0x25,presence,uint8 (1 byte),2500,"0 (False = Away) 1 (True = Home)"
4039
0x26,problem,uint8 (1 byte),2601,"0 (False = OK) 1 (True = Problem)"
4140
0x27,running,uint8 (1 byte),2701,"0 (False = Not Running) 1 (True = Running)"
41+
4242
0x28,safety,uint8 (1 byte),2800,"0 (False = Unsafe) 1 (True = Safe)"
4343
0x29,smoke,uint8 (1 byte),2901,"0 (False = Clear) 1 (True = Detected)"
4444
0x2A,sound,uint8 (1 byte),2A00,"0 (False = Clear) 1 (True = Detected)"

src/bthome.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ class BTHome:
7373
MOVING_BINARY = const(0x22) # 0 (False = Not moving) 1 (True = Moving)
7474
OCCUPANCY_BINARY = const(0x23) # 0 (False = Clear) 1 (True = Detected)
7575
PLUG_BINARY = const(0x24) # 0 (False = Unplugged) 1 (True = Plugged in)
76+
PRESENCE_BINARY = const(0x25) # 0 (False = Away) 1 (True = Home)
77+
PROBLEM_BINARY = const(0x26) # 0 (False = OK) 1 (True = Problem)
78+
RUNNING_BINARY = const(0x27) # 0 (False = Not Running) 1 (True = Running)
7679
HUMIDITY_UINT8_X1 = const(0x2E) # %
7780
MOISTURE_UINT8_X1 = const(0x2F) # %
7881
COUNT_UINT16_X1 = const(0x3D)
@@ -152,6 +155,9 @@ class BTHome:
152155
MOVING_BINARY: "moving", # 0x22
153156
OCCUPANCY_BINARY: "occupancy", # 0x23
154157
PLUG_BINARY: "plug", # 0x24
158+
PRESENCE_BINARY: "presence", # 0x25
159+
PROBLEM_BINARY: "problem", # 0x26
160+
RUNNING_BINARY: "running", # 0x27
155161
HUMIDITY_UINT8_X1: "humidity", # 0x2E
156162
MOISTURE_UINT8_X1: "moisture", # 0x2F
157163
COUNT_UINT16_X1: "count", # 0x3D
@@ -235,14 +241,17 @@ class BTHome:
235241
moving = False
236242
opening = False
237243
plug = False
244+
presence = False
238245
pm10 = 0
239246
pm2_5 = 0
240247
power = 0
241248
power_on = False
242249
precipitation = 0
243250
pressure = 0
251+
problem = False
244252
raw = bytes()
245253
rotation = 0
254+
running = False
246255
speed = 0
247256
temperature = 0
248257
text = ""
@@ -366,6 +375,9 @@ def _pack_raw_text(self, object_id, value):
366375
MOVING_BINARY: _pack_binary,
367376
OCCUPANCY_BINARY: _pack_binary,
368377
PLUG_BINARY: _pack_binary,
378+
PRESENCE_BINARY: _pack_binary,
379+
PROBLEM_BINARY: _pack_binary,
380+
RUNNING_BINARY: _pack_binary,
369381
HUMIDITY_UINT8_X1: _pack_int8_x1,
370382
MOISTURE_UINT8_X1: _pack_int8_x1,
371383
COUNT_UINT16_X1: _pack_int16_x1,

0 commit comments

Comments
 (0)