tlskinneriv / awnet_local

Enables local support for Ambient Weather personal weather stations.
28 stars 5 forks source link

Excessive Logging to home-assistant.log #43

Closed dlindnegm closed 9 months ago

dlindnegm commented 9 months ago

Integration Version: v1.2.0

Home Assistant Version: HASSOS Core 2023.12.3 Supervisor 2023.12.0 Operating System 11.2 Frontend 20231208.2

Describe the bug Log entries from the Ambient Weather Station - Local integration are added to the home-assistant.log at a rate of about every 30 seconds, causing the log file to grow excessively.

To Reproduce Steps to reproduce the behavior:

  1. Search in home-assistant.log for the string: "[custom_components.awnet_local] Last data "

Expected behavior Not sure if the logging is necessary, but it seems excessive - as if I had enabled debug logging (Debug logging is not enabled). I'm wondering if there's a way to reduce the amount of logging to that file.

Additional context My backup home-assistant.log (home-assistant.log.1) is over 50 MB in size, and most of that is due to logs from the awnet_local integration. That log file covers a period of 6 days and has 12,423 entries just for awnet_local (about 2,070/day). After a reboot the new home-assistant.log has 342 entries for awnet_local over a 3 hour period.

Debug log output from the integration (see Home Assistant docs for how to enable debug logging for an integration; integration name: "custom_components.awnet_local") home-assistant_awnet_local_2023-12-24T20-50-02.854Z.log

The last 3 minutes of the attached log file had debug enabled. The log section below is what is repeated every 30 seconds without debug enabled.

2023-12-24 15:02:09.204 INFO (MainThread) [custom_components.awnet_local] Processing data
2023-12-24 15:02:09.204 INFO (MainThread) [custom_components.awnet_local] MAC address: 98:cd:ac:22:14:b7
2023-12-24 15:02:41.488 INFO (MainThread) [custom_components.awnet_local] Last data: {'MAC': '98:cd:ac:22:14:b7', 'name': 'Terrapin Station', 'last_data': {'dateutc': '2023-12-24 20:01:48', 'tempinf': '70.9', 'battin': '1', 'humidityin': '42', 'baromrelin': '29.073', 'baromabsin': '29.073', 'tempf': '63.0', 'battout': '1', 'humidity': '48', 'winddir': '94', 'windspeedmph': '0.9', 'windgustmph': '2.2', 'maxdailygust': '5.8', 'hourlyrainin': '0.000', 'eventrainin': '0.000', 'dailyrainin': '0.000', 'weeklyrainin': '0.000', 'monthlyrainin': '4.807', 'yearlyrainin': '53.551', 'lightning_day': '0', 'lightning_time': '1702191163', 'lightning_distance': '8', 'batt_lightning': '0', 'solarradiation': '69.73', 'uv': '0', 'temp1f': '64.6', 'humidity1': '42', 'temp2f': '60.1', 'humidity2': '43', 'batt1': '1', 'batt2': '1', 'batt_co2': '1'}, 'known_sensors': ['hourlyrainin', 'yearlyrainin', 'lightning_time', 'feelsLikein', 'lightning_hour', 'tempinf', 'temp1f', 'soilhum4', 'humidity1', 'dateutc', 'humidity', 'batt_co2', 'uv', 'soilhum2', 'battsm4', 'battsm2', 'baromrelin', 'batt1', 'battout', 'winddir_card', 'battsm1', 'weeklyrainin', 'maxdailygust', 'tempf', 'solarradiation_lx', 'monthlyrainin', 'temp2f', 'windspeedmph', 'feelsLike', 'batt2', 'humidity2', 'baromabsin', 'dewPointin', 'windgustmph', 'eventrainin', 'winddir', 'dailyrainin', 'soilhum1', 'solarradiation', 'batt_lightning', 'lastRain', 'humidityin', 'lightning_day', 'battin', 'dewPoint', 'lightning_distance'], 'lightning_data': {'1703444552.0': 0, '1703444584.0': 0, '1703444616.0': 0, '1703444648.0': 0, '1703444680.0': 0, '1703444712.0': 0, '1703444744.0': 0, '1703444776.0': 0, '1703444808.0': 0, '1703444840.0': 0, '1703444888.0': 0, '1703444920.0': 0, '1703444952.0': 0, '1703444984.0': 0, '1703445016.0': 0, '1703445048.0': 0, '1703445080.0': 0, '1703445112.0': 0, '1703445144.0': 0, '1703445176.0': 0, '1703445224.0': 0, '1703445256.0': 0, '1703445288.0': 0, '1703445320.0': 0, '1703445352.0': 0, '1703445384.0': 0, '1703445416.0': 0, '1703445448.0': 0, '1703445480.0': 0, '1703445512.0': 0, '1703445544.0': 0, '1703445576.0': 0, '1703445608.0': 0, '1703445640.0': 0, '1703445672.0': 0, '1703445704.0': 0, '1703445735.0': 0, '1703445767.0': 0, '1703445799.0': 0, '1703445831.0': 0, '1703445863.0': 0, '1703445895.0': 0, '1703445927.0': 0, '1703445959.0': 0, '1703445991.0': 0, '1703446023.0': 0, '1703446055.0': 0, '1703446087.0': 0, '1703446119.0': 0, '1703446151.0': 0, '1703446183.0': 0, '1703446215.0': 0, '1703446247.0': 0, '1703446279.0': 0, '1703446311.0': 0, '1703446343.0': 0, '1703446375.0': 0, '1703446407.0': 0, '1703446439.0': 0, '1703446471.0': 0, '1703446503.0': 0, '1703446535.0': 0, '1703446567.0': 0, '1703446599.0': 0, '1703446631.0': 0, '1703446663.0': 0, '1703446705.0': 0, '1703446737.0': 0, '1703446769.0': 0, '1703446801.0': 0, '1703446849.0': 0, '1703446881.0': 0, '1703446913.0': 0, '1703446945.0': 0, '1703446977.0': 0, '1703447009.0': 0, '1703447041.0': 0, '1703447073.0': 0, '1703447105.0': 0, '1703447137.0': 0, '1703447169.0': 0, '1703447201.0': 0, '1703447233.0': 0, '1703447265.0': 0, '1703447297.0': 0, '1703447329.0': 0, '1703447361.0': 0, '1703447393.0': 0, '1703447425.0': 0, '1703447457.0': 0, '1703447501.0': 0, '1703447532.0': 0, '1703447564.0': 0, '1703447596.0': 0, '1703447628.0': 0, '1703447660.0': 0, '1703447692.0': 0, '1703447724.0': 0, '1703447756.0': 0, '1703447788.0': 0, '1703447820.0': 0, '1703447852.0': 0, '1703447884.0': 0, '1703447916.0': 0, '1703447948.0': 0, '1703447980.0': 0, '1703448012.0': 0, '1703448044.0': 0, '1703448076.0': 0, '1703448108.0': 0}, 'sensor_update_in_progress': False, 'stationtype': 'AMBWeatherV4.3.4'}
tlskinneriv commented 9 months ago

Logging can absolutely be reduced. If the default log level for HA is set to info, then you'll see these informational logs show up. To reduce the logging, either change the default log level in HA or add an entry for custom_components.awnet_local and set it to warning or error. Please see the HA Logger documentation for details: https://www.home-assistant.io/integrations/logger/.

dlindnegm commented 9 months ago

Thank you! I've been using logger entries for some time to de-clutter the default Settings - System - Core log, and didn't realize that also covered the home-assistant.log file. Thanks for the quick response & Happy Holidays!

tlskinneriv commented 9 months ago

Very welcome! Fun fact (that I just learned, too): they are the same log file. What we see in the UI is a read of that file. Thanks and Happy Holidays to you as well!