Skip to content

Commit

Permalink
Initial support for GVH5101/5012 and enum GVH5072 dev type (#19)
Browse files Browse the repository at this point in the history
* Initial support for GVH5101/5012 and enum GVH5072 dev type

* Fix humidity reading for temperatures below freezing

* Add sample advertising packet for GVH5101
  • Loading branch information
zrhutto committed Jan 15, 2022
1 parent e653174 commit 692567f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
3 changes: 3 additions & 0 deletions blerry/blerry.be
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
var user_config = {
'A4C138AAAAAA': {'alias': 'trial_govee5075', 'model': 'GVH5075', 'discovery': true},
'A4C138BBBBBB': {'alias': 'other_govee5075', 'model': 'GVH5075', 'via_pubs': false},
'A4C1381XXXXX': {'alias': 'test_govee5072', 'model': 'GVH5072'},
'A4C1381XXXXX': {'alias': 'test_govee5101', 'model': 'GVH5101'},
'A4C1381XXXXX': {'alias': 'test_govee5102', 'model': 'GVH5102'},
'C33130XXXXXX/1': {'alias': 'govee5182-2probe-meats', 'model': 'GVH5182'},
'A4C138XXXXXX': {'alias': 'govee5183meats', 'model': 'GVH5183'},
'D03232XXXXXX/1': {'alias': 'govee5184-4probe-meats', 'model': 'GVH5184'},
Expand Down
3 changes: 3 additions & 0 deletions blerry/blerry_main.be
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ end

# Load model handle functions only if used
var model_drivers = {'GVH5075' : 'blerry_model_GVH5075.be',
'GVH5072' : 'blerry_model_GVH5075.be',
'GVH5101' : 'blerry_model_GVH5075.be',
'GVH5102' : 'blerry_model_GVH5075.be',
'GVH5182' : 'blerry_model_GVH5182.be',
'GVH5183' : 'blerry_model_GVH5183.be',
'GVH5184' : 'blerry_model_GVH5184.be',
Expand Down
26 changes: 21 additions & 5 deletions blerry/blerry_model_GVH5075.be
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,22 @@ def handle_GVH5075(value, trigger, msg)
output_map['Time_via_' + device_topic] = output_map['Time']
output_map['RSSI_via_' + device_topic] = output_map['RSSI']
end
var basenum = (bytes('00') + adv_data[3..5]).get(0,-4)
var dev_type = adv_data.get(0,-2)
var basenum = 0x00000000
if dev_type == 0x88EC # GVH5075/GVH5072
basenum = (bytes('00') + adv_data[3..5]).get(0,-4)
output_map['Battery'] = adv_data.get(6,1)
elif dev_type == 0x0100 # GVH5101/GVH5102
basenum = (bytes('00') + adv_data[4..6]).get(0,-4)
output_map['Battery'] = adv_data.get(7,1)
end
if basenum >= 0x800000
output_map['Temperature'] = (0x800000 - basenum)/10000.0
output_map['Humidity'] = ((basenum - 0x800000) % 1000)/10.0
output_map['Temperature'] = (basenum-0x800000)/-10000.0
output_map['Humidity'] = ((basenum-0x800000) % 1000)/10.0
else
output_map['Temperature'] = basenum/10000.0
output_map['Humidity'] = (basenum % 1000)/10.0
end
output_map['Battery'] = adv_data.get(6,1)
output_map['DewPoint'] = round(get_dewpoint(output_map['Temperature'], output_map['Humidity']), this_device['temp_precision'])
output_map['Temperature'] = round(output_map['Temperature'], this_device['temp_precision'])
output_map['Humidity'] = round(output_map['Humidity'], this_device['humi_precision'])
Expand All @@ -63,4 +70,13 @@ end

# map function into handles array
device_handles['GVH5075'] = handle_GVH5075
require_active['GVH5075'] = false
require_active['GVH5075'] = false

device_handles['GVH5072'] = handle_GVH5075
require_active['GVH5072'] = false

device_handles['GVH5101'] = handle_GVH5075
require_active['GVH5101'] = false

device_handles['GVH5102'] = handle_GVH5075
require_active['GVH5102'] = false
1 change: 1 addition & 0 deletions dev_helpers/spoof_devices.be
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fake_ble.every_second = def ()
# tasmota.publish_result('{\"DetailsBLE\":{\"mac\":\"494207CCCCCC\",\"a\":\"inkbirdth_active_noH\",\"RSSI\":-83,\"p\":\"0201060302F0FF04097470730AFF5CFA000000C4D54908\"}}','test')
# tasmota.publish_result('{\"DetailsBLE\":{\"mac\":\"D4E4A3AAAAAA\",\"a\":\"sbot_temp_passive\",\"RSSI\":-75,\"p\":\"02010609FF5900D4E4A3AAAAAA\"}}','test')
# tasmota.publish_result('{\"DetailsBLE\":{\"mac\":\"D4E4A3BBBBBB/1\",\"a\":\"sbot_temp_active\",\"RSSI\":-83,\"p\":\"02010609FF5900D4E4A3BBBBBB11071BC5D5A50200B89FE6114D22000DA2CB0916000D5410640411BC\",\"0x0d00\":\"5410640511BC\"}}','test')
# tasmota.publish_result('{\"DetailsBLE\":{\"mac\":\"A4C1381BXXXX\",\"a\":\"govee5101_test\",\"RSSI\":-91,\"p\":\"0D09475648353130325F44443238030388EC02010509FF0100010182D92164\"}}', 'test')
if (tasmota.millis()%2) == 1
tasmota.publish_result('{\"DetailsBLE\":{\"mac\":\"D03232XXXXXX/1\",\"a\":\"govee5184_seq1\",\"RSSI\":-83,\"p\":\"0201060303518414FF363E5D01000101BC01860898FFFF06FFFFFFFF"}}','test')
else
Expand Down

0 comments on commit 692567f

Please sign in to comment.