weatherflow-collector
weatherflow-collector copied to clipboard
unable to parse weatherflow_obs,collector_key=
{"error":"unable to parse 'weatherflow_obs,collector_key=,collector_type=remote-rest,elevation=,latitude=98.77661,longitude=-102.4288,public_name=Barkley,source=collector,station_id=159594,station_name=,timezone=America/Los_Angeles timestamp=1733549048000,air_temperature=13.7,barometric_pressure=998.5,station_pressure=998.5,sea_level_pressure=1013.3,relative_humidity=74,precip=0.000615,precip_accum_last_1hr=0.257329,precip_accum_local_day=0.266167,precip_accum_local_yesterday=0.021137,precip_accum_local_yesterday_final=0.000443,precip_minutes_local_day=34,precip_minutes_local_yesterday=3,precip_minutes_local_yesterday_final=3,precip_analysis_type_yesterday=1,wind_avg=3,wind_direction=161,wind_gust=4.5,wind_lull=1.7,solar_radiation=0,uv=0,brightness=1,illuminance=1,lightning_strike_last_epoch=1730759354000,lightning_strike_last_distance=12,lightning_strike_count=0,lightning_strike_count_last_1hr=0,lightning_strike_count_last_3hr=0,feels_like=13.7,heat_index=13.7,wind_chill=13.7,dew_point=9.1,wet_bulb_temperature=11.2,delta_t=2.5,air_density=1.21262,pressure_trend=-1 1733549048000000000': missing tag value"}
This is in the old version...it is now erroring out. I know this is working because my HA setup is fine.
@disruptivepatternmaterial - same error previously:
https://github.com/lux4rd0/weatherflow-collector/issues/31#issuecomment-2525306427
@disruptivepatternmaterial—I made a quick fix. If you want to try out lux4rd0/weatherflow-collector:5.1.57, I haven't been able to run it yet as I'm remote, and my 5.1 environment isn't up to test. But it should work. The change is:
If the PR is focused solely on addressing the issue in the handle_rapid_wind method, here’s the specific and concise PR content:
Description:
This fixes an issue in the handle_rapid_wind method where timestamps from the WeatherFlow API were being received as floating-point values. The timestamps are now explicitly normalized to integers to ensure consistency in data processing and storage.
Changes Made:
- Normalized Timestamps:
- Added explicit normalization of
timestampusingint(). - Captured raw and normalized values in debug logs.
- Added explicit normalization of
Detailed Changes:
Updated handle_rapid_wind Method:
@utils.calculate_timestamp_delta("handle_rapid_wind")
async def handle_rapid_wind(self, full_data):
logger_WebSocketHandler.debug(f"Received rapid_wind full data: {full_data}")
# Extract the nested 'data' dictionary
data = full_data.get("data", {})
device_id = data.get("device_id")
ob_data = data.get("ob", [])
if len(ob_data) >= 3:
# Extract and normalize the timestamp
- timestamp, wind_speed, wind_direction = ob_data[:3]
+ raw_timestamp, wind_speed, wind_direction = ob_data[:3]
+ timestamp = int(raw_timestamp) # Convert to integer
+ logger_WebSocketHandler.debug(f"Normalized timestamp: {timestamp} (raw: {raw_timestamp})")
fields = {
"timestamp": timestamp,
"wind_speed": wind_speed,
"wind_direction": wind_direction,
# Add other relevant fields as needed
}
# Normalize other fields (if necessary)
fields = utils.normalize_fields(fields)
# Construct tags and other metadata (unchanged)
...
PERFECT! THANKS!