briis / hass-weatherflow2mqtt

WeatherFlow to MQTT for Home Assistant. Use UDP to get local weather data in to Home Assistant using MQTT Discovery
MIT License
126 stars 28 forks source link

Sporadically no data in HA for 30min #168

Closed nilvanis closed 2 years ago

nilvanis commented 2 years ago

Home Assistant Version?

2022.6.7

Add-On or Self Hosted?

Self managed Container

Weatherflow2MQTT version?

3.1.1

What happened?

Hello, First of all I'd like to take the opportunity and thank you so much for this piece of software - amazing work, I'm so glad I can pull all my WF Tempest data to HA that easily.

I've set up this just yesterday, but I noticed one thing I cannot figure out the root cause.

I'm using W2M in a docker container on an rpi4, WF HUB is in the same network as rpi. I also run mosquitto MQTT server as an addon in HA. W2M is not my only MQTT client, but is using dedicated credentials to authenticate. One of the other clients is in another docker container on the same rpi. Between rpi & HA there is a hardware firewall so I have visibility over the traffic going over it.

Normally everything seems to work as expected, entities are updated every few seconds in HA. However, every few hours I can see a ~30min freeze in data collection just for WF entities. Other MQTT sensors update normally. It's easiest visible on the solar insolation sensor, but basically all sensors have 'straight line' for the same period. You can see it here: https://imgur.com/U89lmpl

In the same time Weatherflow Tempest data on the web are updating normally. I have also checked the firewall logs and I don't see any new network sessions during 'freeze times' and no teardown/timeout sessions as well.

Anyone have a clue what can cause this behavior?

Relevant log output

CONTAINER ID   IMAGE                           COMMAND                  CREATED        STATUS        PORTS                                       NAMES
xxxxxxxxxxxx   briis/weatherflow2mqtt:latest   "weatherflow2mqtt"       45 hours ago   Up 43 hours   1883/tcp, 0.0.0.0:50222->50222/udp          weatherflow2mqtt_weatherflow2mqtt_1                                           

Last logs:
2022-07-14T23:50:17.635245807Z INFO:weatherflow2mqtt.weatherflow_mqtt:Connected to the MQTT server at xx.xx.xx.xx:1883
2022-07-14T23:50:17.636361843Z INFO:weatherflow2mqtt.weatherflow_mqtt:The UDP server is listening on port 50222
2022-07-14T23:50:25.444593519Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Hub sensor: Status
2022-07-14T23:50:25.445482981Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Hub sensor: Weather
2022-07-14T23:50:29.446021254Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Status
2022-07-14T23:50:29.447409734Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Absolute Humidity
2022-07-14T23:50:29.454396393Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Air Density
2022-07-14T23:50:29.455869706Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Temperature
2022-07-14T23:50:29.457932500Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Voltage
2022-07-14T23:50:29.458965295Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Battery
2022-07-14T23:50:29.460239553Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Battery Mode
2022-07-14T23:50:29.461799496Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Beaufort Scale
2022-07-14T23:50:29.462637717Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Cloud Base Altitude
2022-07-14T23:50:29.474724038Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Delta T
2022-07-14T23:50:29.479242644Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Dew Point
2022-07-14T23:50:29.483959417Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Dewpoint Comfort Level
2022-07-14T23:50:29.485610934Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Feels Like Temperature
2022-07-14T23:50:29.486182544Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Freezing Level Altitude
2022-07-14T23:50:29.487910987Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Illuminance
2022-07-14T23:50:29.488826578Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Lightning Count
2022-07-14T23:50:29.489666133Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Lightning Count (Last hour)
2022-07-14T23:50:29.490834002Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Lightning Count (3 hours)
2022-07-14T23:50:29.491676001Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Lightning Count (Today)
2022-07-14T23:50:29.492658389Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Lightning Distance
2022-07-14T23:50:29.493377518Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Lightning Energy
2022-07-14T23:50:29.494016943Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Last Lightning Strike
2022-07-14T23:50:29.494547239Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Precipitation Type
2022-07-14T23:50:29.495433942Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Pressure Trend
2022-07-14T23:50:29.496365441Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Rain Duration (Today)
2022-07-14T23:50:29.497265199Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Rain Duration (Yesterday)
2022-07-14T23:50:29.498079198Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Rain Intensity
2022-07-14T23:50:29.498973604Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Rain Rate
2022-07-14T23:50:29.499560585Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Last Rain start
2022-07-14T23:50:29.500328844Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Rain Today
2022-07-14T23:50:29.501276324Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Rain Yesterday
2022-07-14T23:50:29.502103471Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Humidity
2022-07-14T23:50:29.503138378Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Sea Level Pressure
2022-07-14T23:50:29.504159080Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Solar Radiation
2022-07-14T23:50:29.504953357Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Station Pressure
2022-07-14T23:50:29.505922708Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Temperature Level
2022-07-14T23:50:29.506296134Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: UV Index
2022-07-14T23:50:29.507066855Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: UV Level
2022-07-14T23:50:29.508046669Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Visibility
2022-07-14T23:50:29.511624906Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Wet Bulb Globe Temperature
2022-07-14T23:50:29.515063754Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Wet Bulb Temperature
2022-07-14T23:50:29.515993253Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Wind Bearing
2022-07-14T23:50:29.516802437Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Wind Bearing Avg
2022-07-14T23:50:29.517661696Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Wind Direction
2022-07-14T23:50:29.518574509Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Wind Direction Avg
2022-07-14T23:50:29.519577731Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Wind Gust
2022-07-14T23:50:29.520455230Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Wind Lull
2022-07-14T23:50:29.521402414Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Wind Speed
2022-07-14T23:50:29.522249339Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Wind Speed Avg
2022-07-14T23:50:29.523300690Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Solar Elevation
2022-07-14T23:50:29.523670671Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Solar Insolation
2022-07-14T23:50:29.524805669Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Zambretti Number
2022-07-14T23:50:29.525258336Z INFO:weatherflow2mqtt.weatherflow_mqtt:Setting up Tempest sensor: Zambretti Text

$ date
Sat Jul 16 21:13:48 CEST 2022
GlennGoddard commented 2 years ago

How does the solar elevation look? Solar Insulation is proportional to solar elevation, so if there is an issue with elevation then it would be shown on Solar Insulation.

Please post your docker run command. Feel free to replace lat/long/station id/api key with 'xxxx'. See the Zambretti issue for an example.

I'll probably ask more questions when I get back to my computer.

Do you use MQTT explorer? It will allow you to see all MQTT postings without have to rely on HA auto or manual sensors.

nilvanis commented 2 years ago

Hi Glenn, Solar elevation has exactly the same issue. But I did noticed one thing. All sensors I checked are affected the same way except current wind speed I have uploaded few more screenshots including solar elevation here: https://imgur.com/a/5sHprRN

my docker-compose.yaml

version: "2"
services:
  weatherflow2mqtt:
    image: briis/weatherflow2mqtt:latest
    restart: unless-stopped
    environment:
      - TZ=<cut>
      - UNIT_SYSTEM=metric
      - LANGUAGE=en
      - RAPID_WIND_INTERVAL=0
      - DEBUG=False
      - ELEVATION=67
      - LATITUDE=<cut>
      - LONGITUDE=<cut>
      - ZAMBRETTI_MIN_PRESSURE=960
      - ZAMBRETTI_MAX_PRESSURE=1060
      - WF_HOST=0.0.0.0
      - WF_PORT=50222
      - MQTT_HOST=<cut>
      - MQTT_PORT=1883
      - MQTT_USERNAME=<cut>
      - MQTT_PASSWORD=<cut>
      - MQTT_DEBUG=False
      - STATION_ID=<cut>
      - STATION_TOKEN=<cut>
      - FORECAST_INTERVAL=30
    volumes:
      - /var/docker_containers_data/weatherflow2mqtt:/data
    ports:
      - 0.0.0.0:50222:50222/udp
GlennGoddard commented 2 years ago

Do you get a Zambretti output?

nilvanis commented 2 years ago

Do you get a Zambretti output?

Normally? yes During the ~30min freeze? no

Screenshots of Zambretti history from the same timespan as previous ones: https://imgur.com/a/degtW5Q

nilvanis commented 2 years ago

I managed to solve it. It looks like it was a sensor - hub communication problem. I've moved the hub to another location and I don't have these 30min freezes ever since.

I was misleaded by the fact I was receiving current wind speed without a problem all the time and historically all the data were present on the weatherflow website. Like these were 'cached' on the sensor and resent until it receive acknowledgment.