Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mqtt is missing records #107

Open
MaxRower opened this issue Oct 14, 2022 · 1 comment
Open

mqtt is missing records #107

MaxRower opened this issue Oct 14, 2022 · 1 comment

Comments

@MaxRower
Copy link

The WS1080 is set to log data every five minutes, the cron job does run every five minutes to collect data, due to known USB troubles jobs often fail, so next time there will be two records to collect, but mqtt only transmits only one record instead. Only the last record seems to be sent. I think the cause is the missing time stamp fields in mqtt, but those could be added so all records are properly forwarded via mosquitto mqtt to telegraf and finally to influxdb?

python -m pywws.hourly -v /tmp/weather/
03:00:01:pywws.logger:pywws version 22.9.0, build 1696 (e9ef20a)
03:00:01:pywws.logger:Python version 3.10.7 (main, Oct 10 2022, 16:14:30) [GCC 11.2.0]
03:00:01:pywws.weatherstation:using pywws.device_libusb1
03:00:03:pywws.logdata:Unrecognised 'magic number' 37 00
03:00:03:pywws.logdata:Synchronising to weather station
03:00:39:pywws.weatherstation:status {'lost_connection': False, 'rain_overflow': False}
03:00:45:pywws.logdata:Fetching data
03:00:45:pywws.logdata:2 catchup records
03:00:45:pywws.process:Generating summary data
03:00:45:pywws.calib:Using default calibration
03:00:45:pywws.regulartasks:doing task sections ['logged', 'hourly']
03:00:46:pywws.service.mqtt:OK
03:00:46:pywws.service.mqtt:1 record sent

@jim-easterbrook
Copy link
Owner

Don't run a cron job every five minutes. As you've discovered it won't work correctly as one run may still be synchronising to the station when the next run starts. There's a reason why the module is called pywws.hourly. If you need data more frequently then use "live" logging.

service.mqtt is a pywws.service.LiveDataService - it only ever sends the most recent data. If you want to send complete data to a database you need to use something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants