Skip to content

Commit

Permalink
Modify logger
Browse files Browse the repository at this point in the history
  • Loading branch information
themoosman committed Jun 17, 2024
1 parent fea397e commit 7b5b5e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions bin/user/ambientweatherapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from os import path

DRIVER_NAME = 'ambientweatherapi'
DRIVER_VERSION = '0.0.12'
DRIVER_VERSION = '0.0.13'
log = logging.getLogger(__name__)


Expand Down Expand Up @@ -92,15 +92,13 @@ def convert_epoch_ms_to_sec(self, epoch_ms):

def print_dict(self, data_dict):
"""Prints a dict."""
if log.DEBUG >= logging.root.level:
log.debug("calling: print_dict")
for key in data_dict:
log.debug(key + " = " + str(data_dict[key]))
log.debug("calling: print_dict")
for key in data_dict:
log.debug(key + " = " + str(data_dict[key]))

def get_value(self, data_dict, key):
"""Gets the value from a dict, returns None if the key does not exist."""
if log.DEBUG >= logging.root.level:
log.debug("calling: get_value")
log.debug("calling: get_value")
return data_dict.get(key, None)

def get_float(self, value):
Expand Down Expand Up @@ -354,15 +352,15 @@ def genLoopPackets(self):
is_battery = value.startswith('batt')
if value in data:
log.debug("Setting Weewx value: '%s' to: %s using Ambient field: '%s'" %
(key, str(data[value]), value))
(key, str(data[value]), value))
if is_battery:
_packet[key] = self.get_battery_status(data[value])
else:
_packet[key] = self.get_float(data[value])
else:
log.debug("Dropping Ambient value: '%s' from Weewx packet." % (value))

self.print_dict(_packet)
# self.print_dict(_packet)
log.debug("============Completed Packet Build============")
yield _packet
log.info("loopPacket Accepted")
Expand Down
2 changes: 1 addition & 1 deletion install.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def loader():
class AmbientWeatherApiInstaller(ExtensionInstaller):
def __init__(self):
super(AmbientWeatherApiInstaller, self).__init__(
version="0.0.12",
version="0.0.13",
name='ambientweatherapi',
description='WeeWx AmbientWeather API Driver.',
author="Karl Moos",
Expand Down

0 comments on commit 7b5b5e7

Please sign in to comment.