Skip to content

Commit e55a3fb

Browse files
authored
Merge pull request #1526 from bbyrd74/master
Add support for Mocreo ST7 temperature sensor
2 parents 8ea3c1d + a3eed94 commit e55a3fb

5 files changed

Lines changed: 35 additions & 2 deletions

File tree

custom_components/ble_monitor/ble_parser/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ def parse_advertisement(
515515
# Inkbird IBS-TH
516516
sensor_data = parse_inkbird(self, man_spec_data, local_name, mac)
517517
break
518-
elif local_name == "MOCREO" and data_len == 0x13:
518+
elif (local_name == "MOCREO" and data_len == 0x13) or (local_name == "ST7" and data_len == 0x11):
519519
# MOCREO
520520
sensor_data = parse_mocreo(self, man_spec_data, local_name, mac)
521521
break

custom_components/ble_monitor/ble_parser/mocreo.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
_LOGGER = logging.getLogger(__name__)
88

99
MOCREO_TYPE_DICT = {
10+
0x10: "ST7",
1011
0x81: "ST5",
1112
0x82: "SW2",
1213
0x83: "ST6",
@@ -26,6 +27,9 @@
2627
}
2728

2829
MOCREO_TYPE_DATA_PARSING_FORMAT = {
30+
0x10: {
31+
"temperature": (5, 0, -16, True, lambda x: x / 100),
32+
},
2933
0x81: {
3034
"temperature": (6, 0, -16, True, lambda x: x / 100),
3135
},
@@ -87,7 +91,10 @@ def _get_value(source, pos):
8791

8892
def parse_mocreo(self, data: bytes, local_name: str, mac: bytes):
8993
"""Parser for MOCREO sensors"""
90-
common_data = data[2:]
94+
if data[0] == 0x11 and data[1] == 0xff and data[2] == 0x4a:
95+
common_data = data[9:] #Mocreo's oddball ST7 format
96+
else:
97+
common_data = data[2:] #Mocreo's "normal" format
9198
firmware = "MOCREO"
9299
result = {"firmware": firmware}
93100

custom_components/ble_monitor/const.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,6 +2199,7 @@ class BLEMonitorBinarySensorEntityDescription(
21992199
'ST5' : [["temperature", "battery", "rssi"], [], []],
22002200
'SW2' : [["battery", "rssi"], [], ["water leak"]],
22012201
'ST6' : [["temperature", "humidity", "battery", "rssi"], [], []],
2202+
'ST7' : [["temperature", "battery", "rssi"], [], []],
22022203
'ST8' : [["temperature", "battery", "rssi"], [], []],
22032204
'ST9' : [["temperature", "humidity", "battery", "rssi"], [], []],
22042205
'ST10' : [["temperature", "battery", "rssi"], [], []],
@@ -2349,6 +2350,7 @@ class BLEMonitorBinarySensorEntityDescription(
23492350
'ST5' : 'MOCREO',
23502351
'SW2' : 'MOCREO',
23512352
'ST6' : 'MOCREO',
2353+
'ST7' : 'MOCREO',
23522354
'ST8' : 'MOCREO',
23532355
'ST9' : 'MOCREO',
23542356
'ST10' : 'MOCREO',

docs/_devices/MOCREO_ST7.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
manufacturer: MOCREO
3+
name: Temperature Sensor
4+
model: ST7
5+
image: MOCREO_ST7.png
6+
physical_description: Rectangular body, with probe, uses 9V battery, BLE
7+
broadcasted_properties:
8+
- temperature
9+
- battery
10+
- rssi
11+
broadcasted_property_notes:
12+
broadcast_rate:
13+
active_scan: no
14+
encryption_key:
15+
custom_firmware:
16+
notes: >
17+
Key Features:
18+
- Measuring Range: -40 to +221°F
19+
- Accuracy: ±0.9°C (temperature)
20+
- Built-in 120dB loud beeper
21+
- Connects to your phone via BLE directly, or works with a hub for remote monitoring
22+
- Real-time data is available in Home Assistant dashboards
23+
- More information can be found in [MOCREO ST7 Temperature Sensor](https://mocreo.com/products/temperature-sensor/)
24+
---

docs/assets/images/MOCREO_ST7.png

11.9 KB
Loading

0 commit comments

Comments
 (0)