Bogus tweet line contains the formatting in some occasional cases

35 views
Skip to first unread message

Invisible Man

unread,
Nov 2, 2019, 9:58:41 AM11/2/19
to weewx-user

Hi,


I am using weewx 3.9.2 with Twitter extension 0.12. The weather station is a WMR200. In weewx.conf, my format is the following:


[[Twitter]]
   ...
   format = {dateTime:%H:%M} Temp: {outTemp:%.1f} °C; Humidité: {outHumidity:%.0f}%; Pression: {barometer:%.0f} hPa; Pluie 1h: {rain:%.1f} mm; Vent: {windSpeed:%.1f} km/h; Dir: {windDir:%03.0f}

This works quite well, and I generally get nice tweets e.g. 14:40 Temp: 19.3 °C; Humidité: 64%; Pression: 1013 hPa; Pluie 1h: 0.0 mm; Vent: 2.7 km/h; Dir: 182

However, occasionally, I get bogus tweets: 22:10 Temp: 14.4 °C; Humidité: 81%; Pression: 1019 hPa; Pluie 1h: 0.0 mm; Vent: {windSpeed:%.1f} km/h; Dir: {windDir:%03.0f}, as you can see it prints the formatting for wind speed and wind dir, instead of formatting it.


My intuition is that this occurs when for some reason, windSpeed and WindDir are not defined, or null, or something like that. I think that probably something needs to fixed in twitter python script, so that the values are not tweeted if not present. I'm not exactly sure what the test should be. `!= None` ? `is not null `, `if defined...` ?


Thanks

mwall

unread,
Nov 2, 2019, 1:03:35 PM11/2/19
to weewx-user
On Saturday, November 2, 2019 at 9:58:41 AM UTC-4, Invisible Man wrote:


My intuition is that this occurs when for some reason, windSpeed and WindDir are not defined, or null, or something like that. I think that probably something needs to fixed in twitter python script, so that the values are not tweeted if not present. I'm not exactly sure what the test should be. `!= None` ? `is not null `, `if defined...` ?


is the extension configured to tweet each LOOP packet or each archive record?

the WMR200 emits partial packets, so LOOP packets may not have every observation.

the twitter extension will use '-' for an observation that is 'None' (for example, the wind direction if there is no wind speed, or when a sensor is not reporting properly).  if keyword does not exist in the packet/record, then the twitter extension leaves the keyword unmodified.

m
Reply all
Reply to author
Forward
0 new messages