Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Havlik committed Feb 5, 2023
1 parent 7922870 commit f8cc1fd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ def on_message(client, data, message):
if 'BME280' in data:
for key in ('Temperature', 'Humidity', 'DewPoint', 'Pressure'):
val = data['BME280'][key]
metric = get_or_create_metric(f'{sensor_name}_bme280_{key.lower()}', f'{key.lower()} {sensor_name}')
metric.set(val)
if val is not None:
metric = get_or_create_metric(f'{sensor_name}_bme280_{key.lower()}', f'{key.lower()} {sensor_name}')
metric.set(val)
if 'ENERGY' in data:
total = data['ENERGY']['Total']
power = data['ENERGY']['Power']
Expand Down

0 comments on commit f8cc1fd

Please sign in to comment.