Skip to content

Commit f3e93bd

Browse files
Merge pull request #30 from dingusdk/wavemini
Support for Wave Mini
2 parents 9b9e6a9 + 49a64c7 commit f3e93bd

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

custom_components/airthings_wave/airthings.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
CHAR_UUID_ILLUMINANCE_ACCELEROMETER = UUID('b42e1348-ade7-11e4-89d3-123b93f75cba')
2727
CHAR_UUID_WAVE_PLUS_DATA = UUID('b42e2a68-ade7-11e4-89d3-123b93f75cba')
2828
CHAR_UUID_WAVE_2_DATA = UUID('b42e4dcc-ade7-11e4-89d3-123b93f75cba')
29+
CHAR_UUID_WAVEMINI_DATA = UUID('b42e3b98-ade7-11e4-89d3-123b93f75cba')
2930

3031
Characteristic = namedtuple('Characteristic', ['uuid', 'name', 'format'])
3132

@@ -49,7 +50,7 @@ def __str__(self):
4950

5051
sensors_characteristics_uuid = [CHAR_UUID_DATETIME, CHAR_UUID_TEMPERATURE, CHAR_UUID_HUMIDITY, CHAR_UUID_RADON_1DAYAVG,
5152
CHAR_UUID_RADON_LONG_TERM_AVG, CHAR_UUID_ILLUMINANCE_ACCELEROMETER,
52-
CHAR_UUID_WAVE_PLUS_DATA,CHAR_UUID_WAVE_2_DATA]
53+
CHAR_UUID_WAVE_PLUS_DATA,CHAR_UUID_WAVE_2_DATA,CHAR_UUID_WAVEMINI_DATA]
5354

5455
sensors_characteristics_uuid_str = [str(x) for x in sensors_characteristics_uuid]
5556

@@ -100,6 +101,18 @@ def decode_data(self, raw_data):
100101
return data
101102

102103

104+
class WaveMiniDecode(BaseDecode):
105+
def decode_data(self, raw_data):
106+
val = super().decode_data(raw_data)
107+
val = val[self.name]
108+
data = {}
109+
data['date_time'] = str(datetime.isoformat(datetime.now()))
110+
data['temperature'] = round( val[1]/100.0 - 273.15,2)
111+
data['humidity'] = val[3]/100.0
112+
data['voc'] = val[4]*1.0
113+
return data
114+
115+
103116
class WaveDecodeDate(BaseDecode):
104117
def decode_data(self, raw_data):
105118
val = super().decode_data(raw_data)[self.name]
@@ -123,7 +136,8 @@ def decode_data(self, raw_data):
123136
str(CHAR_UUID_RADON_LONG_TERM_AVG):BaseDecode(name="radon_longterm_avg", format_type='H', scale=1.0),
124137
str(CHAR_UUID_ILLUMINANCE_ACCELEROMETER):WaveDecodeIluminAccel(name="illuminance_accelerometer", format_type='BB', scale=1.0),
125138
str(CHAR_UUID_TEMPERATURE):BaseDecode(name="temperature", format_type='h', scale=1.0/100.0),
126-
str(CHAR_UUID_WAVE_2_DATA):Wave2Decode(name="Wave2", format_type='<4B8H', scale=1.0),}
139+
str(CHAR_UUID_WAVE_2_DATA):Wave2Decode(name="Wave2", format_type='<4B8H', scale=1.0),
140+
str(CHAR_UUID_WAVEMINI_DATA):WaveMiniDecode(name="WaveMini", format_type='<HHHHHHLL', scale=1.0),}
127141

128142

129143
class AirthingsWaveDetect:

0 commit comments

Comments
 (0)