Skip to content

Commit a94450e

Browse files
bthome.py - more binary properties added
1 parent 6aab585 commit a94450e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

datatypes.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ Object id,Property,Data type,Factor,Example,Result,Unit
3838
0x25,presence,uint8 (1 byte),2500,"0 (False = Away) 1 (True = Home)"
3939
0x26,problem,uint8 (1 byte),2601,"0 (False = OK) 1 (True = Problem)"
4040
0x27,running,uint8 (1 byte),2701,"0 (False = Not Running) 1 (True = Running)"
41-
4241
0x28,safety,uint8 (1 byte),2800,"0 (False = Unsafe) 1 (True = Safe)"
4342
0x29,smoke,uint8 (1 byte),2901,"0 (False = Clear) 1 (True = Detected)"
43+
4444
0x2A,sound,uint8 (1 byte),2A00,"0 (False = Clear) 1 (True = Detected)"
4545
0x2B,tamper,uint8 (1 byte),2B00,"0 (False = Off) 1 (True = On)"
4646
0x2C,vibration,uint8 (1 byte),2C01,"0 (False = Clear) 1 (True = Detected)"

src/bthome.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class BTHome:
7676
PRESENCE_BINARY = const(0x25) # 0 (False = Away) 1 (True = Home)
7777
PROBLEM_BINARY = const(0x26) # 0 (False = OK) 1 (True = Problem)
7878
RUNNING_BINARY = const(0x27) # 0 (False = Not Running) 1 (True = Running)
79+
SAFETY_BINARY = const(0x28) # 0 (False = Unsafe) 1 (True = Safe)
80+
SMOKE_BINARY = const(0x29) # 0 (False = Clear) 1 (True = Detected)
7981
HUMIDITY_UINT8_X1 = const(0x2E) # %
8082
MOISTURE_UINT8_X1 = const(0x2F) # %
8183
COUNT_UINT16_X1 = const(0x3D)
@@ -158,6 +160,8 @@ class BTHome:
158160
PRESENCE_BINARY: "presence", # 0x25
159161
PROBLEM_BINARY: "problem", # 0x26
160162
RUNNING_BINARY: "running", # 0x27
163+
SAFETY_BINARY: "safety", # 0x28
164+
SMOKE_BINARY: "smoke", # 0x29
161165
HUMIDITY_UINT8_X1: "humidity", # 0x2E
162166
MOISTURE_UINT8_X1: "moisture", # 0x2F
163167
COUNT_UINT16_X1: "count", # 0x3D
@@ -252,7 +256,9 @@ class BTHome:
252256
raw = bytes()
253257
rotation = 0
254258
running = False
259+
safety = False
255260
speed = 0
261+
smoke = False
256262
temperature = 0
257263
text = ""
258264
timestamp = 0
@@ -378,6 +384,8 @@ def _pack_raw_text(self, object_id, value):
378384
PRESENCE_BINARY: _pack_binary,
379385
PROBLEM_BINARY: _pack_binary,
380386
RUNNING_BINARY: _pack_binary,
387+
SAFETY_BINARY: _pack_binary,
388+
SMOKE_BINARY: _pack_binary,
381389
HUMIDITY_UINT8_X1: _pack_int8_x1,
382390
MOISTURE_UINT8_X1: _pack_int8_x1,
383391
COUNT_UINT16_X1: _pack_int16_x1,

0 commit comments

Comments
 (0)