<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Weather &#8211; Lux4rd0 Labs</title>
	<atom:link href="https://labs.lux4rd0.com/category/weather/feed/" rel="self" type="application/rss+xml" />
	<link>https://labs.lux4rd0.com</link>
	<description>Create. Experience. Share. Do.</description>
	<lastBuildDate>Sat, 18 Nov 2023 22:13:40 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://labs.lux4rd0.com/wp-content/uploads/2021/01/lulx4rd0labs-favicon-150x150.png</url>
	<title>Weather &#8211; Lux4rd0 Labs</title>
	<link>https://labs.lux4rd0.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">185588299</site>	<item>
		<title>WeatherFlow Tempest Log Collector</title>
		<link>https://labs.lux4rd0.com/2021/02/weatherflow-tempest-log-collector/</link>
					<comments>https://labs.lux4rd0.com/2021/02/weatherflow-tempest-log-collector/#comments</comments>
		
		<dc:creator><![CDATA[Dave Schmid]]></dc:creator>
		<pubDate>Sun, 21 Feb 2021 20:28:50 +0000</pubDate>
				<category><![CDATA[Grafana]]></category>
		<category><![CDATA[Loki]]></category>
		<category><![CDATA[Weather]]></category>
		<category><![CDATA[WeatherFlow]]></category>
		<guid isPermaLink="false">https://labs.lux4rd0.com/?p=197</guid>

					<description><![CDATA[This started as a straightforward story with three simple things: I love IoT gadgets. I love weather gadgets. I love charts and graphs. While perusing online, it&#8217;s possible that I stumbled upon a social media advertisement for the WeatherFlow Tempest Weather System (and a 15% off coupon). It&#8217;s also entirely possible that I made a [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This started as a straightforward story with three simple things:</p>
<ol>
<li>I love IoT gadgets.</li>
<li>I love weather gadgets.</li>
<li>I love charts and graphs.</li>
</ol>
<p><img fetchpriority="high" decoding="async" class="alignnone wp-image-254 size-full" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-overview_blog.png" alt="" width="2452" height="1279" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-overview_blog.png 2452w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-overview_blog-300x156.png 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-overview_blog-1024x534.png 1024w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-overview_blog-768x401.png 768w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-overview_blog-1536x801.png 1536w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-overview_blog-2048x1068.png 2048w" sizes="(max-width: 2452px) 100vw, 2452px" /></p>
<p>While perusing online, it&#8217;s possible that I stumbled upon a social media advertisement for the <a href="https://weatherflow.com/tempest-weather-system/" target="_blank" rel="noopener">WeatherFlow Tempest Weather System</a> (and a 15% off coupon). It&#8217;s also entirely possible that I made a quick purchase.</p>
<p><img decoding="async" class="size-full wp-image-201 aligncenter" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/149946ea408fc2d692ba79174e9f8889_original.png" alt="" width="680" height="500" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/149946ea408fc2d692ba79174e9f8889_original.png 680w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/149946ea408fc2d692ba79174e9f8889_original-300x221.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<p>WeatherFlow Tempest started as a <a href="https://www.kickstarter.com/projects/weatherflow/tempest-a-revolutionary-personal-weather-system" target="_blank" rel="noopener">Kickstarter project</a> but is now shipping directly outside of just the backers. The WeatherFlow Tempest is a solar-powered weather station that collects measurements of wind, rain, lightning, temperature, humidity, pressure, and sunlight. It has a wireless hub collects these data points, pushes them up to the WeatherFlow cloud for processing and weather forecasting, and then provides a personalized weather app. Data can be collected with a <a href="https://weatherflow.github.io/Tempest/api/" target="_blank" rel="noopener">few different APIs</a> &#8211; one from WeatherFlow&#8217;s processed stream of events and metrics (<a href="https://weatherflow.github.io/Tempest/api/swagger/" target="_blank" rel="noopener">REST API</a>) or locally via my network with <a href="https://weatherflow.github.io/Tempest/api/udp.html" target="_blank" rel="noopener">UDP listener API</a>.</p>
<p>Yes. Now we&#8217;re talking. APIs. Raw data. Wireless. Weather data. All that means &#8220;How can I use my data to make charts and graphs!&#8221;</p>
<h2>Logs Into Metrics</h2>
<p>With any new project &#8211; it&#8217;s always best to start and see what other great work has already been shared with the <a href="https://community.weatherflow.com/" target="_blank" rel="noopener">community</a>. I found a great InfluxDB listener from Vince Skahan called <a href="https://github.com/vinceskahan/weatherflow-udp-listener" target="_blank" rel="noopener">weatherflow-udp-listener</a>. I made the first set of <a href="https://grafana.com/grafana/dashboards?search=weatherflow&amp;dataSource=influxdb" target="_blank" rel="noopener">Grafana dashboards</a> that used his system, which worked well. But as much as I loved Vince&#8217;s efforts &#8211; the project isn&#8217;t currently supported (but should work just fine for the foreseeable future&#8230;)</p>
<p>I wanted to work with the raw JSON logs being streamed over UDP from the Tempest to the WeatherFlow hub. I needed a way to collect those JSON logs and push them into a logging system that provides long-term storage AND a way to turn <strong>logs into metrics</strong>. What better solution than <a href="https://grafana.com/oss/loki/" target="_blank" rel="noopener">Grafana&#8217;s Loki</a> log aggregation system?</p>
<h2>JSON Logs</h2>
<p>The WeatherFlow hub sends JSON logs broadcast over UDP port 50222 on my local network. Based on the <a href="https://weatherflow.github.io/Tempest/api/udp.html" target="_blank" rel="noopener">WeatherFlow Tempest UDP Reference</a>, these logs can be broken out by type (among a few other measurements):</p>
<p><strong>obs_st (Observation &#8211; Tempest)</strong></p>
<pre>{"serial_number":"ST-00028209","type":"obs_st","hub_sn":"HB-00038302","obs":[[1613934241,0.00,1.34,5.45,93,3,988.74,9.39,28.68,7761,0.23,65,0.000000,0,0,0,2.808,1]],"firmware_revision":134}</pre>
<p><strong>device_status</strong></p>
<pre>{"serial_number":"ST-00028209","type":"device_status","hub_sn":"HB-00038302","timestamp":1613934241,"uptime":1478650,"voltage":2.81,"firmware_revision":134,"rssi":-69,"hub_rssi":-66,"sensor_status":0,"debug":0}</pre>
<p><strong>hub_status</strong></p>
<pre>{"serial_number":"HB-00038302","type":"hub_status","firmware_revision":"160","uptime":895935,"rssi":-39,"timestamp":1613934260,"reset_flags":"PIN,SFT","seq":89486,"fs":[1,0,15675411,524288],"radio_stats":[25,1,0,3,4248],"mqtt_stats":[119,29]}</pre>
<p><strong>rapid_wind</strong></p>
<pre>{"serial_number":"ST-00028209","type":"rapid_wind","hub_sn":"HB-00038302","ob":[1613934245,0.67,152]}</pre>
<p>Using a slightly modified weatherflow-listener.py script (from P-Doyle&#8217;s <a href="https://github.com/p-doyle/Simple-WeatherFlow-Python-Listener" target="_blank" rel="noopener">Simple-WeatherFlow-Python-Listener</a>), I could use the following command to send the broadcast JSON logs into Loki via Promtail.</p>
<pre>/usr/bin/stdbuf -oL /usr/bin/python weatherflow-listener.py <span class="pl-k">|</span> /usr/bin/promtail --stdin --client.url http://loki:3100/loki/api/v1/push --client.external-labels=app=weatherflow,hostname=weatherflow</pre>
<p><em>(Using stdbuf here to reduce the STDOUT/STDIN buffer wait&#8230;)</em></p>
<p>Once the logs are in Grafana Loki &#8211; I used Loki&#8217;s LogQL to crack open some of the JSON arrays into useful metrics:</p>
<pre>max(max_over_time({app="weatherflow"} |= "obs_st" | json obs_Air_Temperature="obs[0][7]" | unwrap obs_Air_Temperature | __error__="" [$__interval])) * 9/5 + 32</pre>
<p><img decoding="async" class="alignnone wp-image-248 size-full" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-loki_query.png" alt="" width="1162" height="674" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-loki_query.png 1162w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-loki_query-300x174.png 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-loki_query-1024x594.png 1024w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-loki_query-768x445.png 768w" sizes="(max-width: 1162px) 100vw, 1162px" /></p>
<p>Using the WeatherFlow UDP API as a guide, I made metrics from each of the index values:</p>
<div class="doc-section">
<h4>Observation Value Layout</h4>
<table>
<tbody>
<tr>
<th>Index</th>
<th>Field</th>
<th>Units</th>
</tr>
<tr>
<td>0</td>
<td>Time Epoch</td>
<td>Seconds</td>
</tr>
<tr>
<td>1</td>
<td>Wind Lull (minimum 3 second sample)</td>
<td>m/s</td>
</tr>
<tr>
<td>2</td>
<td>Wind Avg (average over report interval)</td>
<td>m/s</td>
</tr>
<tr>
<td>3</td>
<td>Wind Gust (maximum 3 second sample)</td>
<td>m/s</td>
</tr>
<tr>
<td>4</td>
<td>Wind Direction</td>
<td>Degrees</td>
</tr>
<tr>
<td>5</td>
<td>Wind Sample Interval</td>
<td>seconds</td>
</tr>
<tr>
<td>6</td>
<td>Station Pressure</td>
<td>MB</td>
</tr>
<tr>
<td>7</td>
<td>Air Temperature</td>
<td>C</td>
</tr>
<tr>
<td>8</td>
<td>Relative Humidity</td>
<td>%</td>
</tr>
<tr>
<td>9</td>
<td>Illuminance</td>
<td>Lux</td>
</tr>
<tr>
<td>10</td>
<td>UV</td>
<td>Index</td>
</tr>
<tr>
<td>11</td>
<td>Solar Radiation</td>
<td>W/m^2</td>
</tr>
<tr>
<td>12</td>
<td>Precip Accumulated</td>
<td>mm</td>
</tr>
<tr>
<td>13</td>
<td>Precipitation Type</td>
<td>0 = none, 1 = rain, 2 = hail</td>
</tr>
<tr>
<td>14</td>
<td>Lightning Strike Avg Distance</td>
<td>km</td>
</tr>
<tr>
<td>15</td>
<td>Lightning Strike Count</td>
<td></td>
</tr>
<tr>
<td>16</td>
<td>Battery</td>
<td>Volts</td>
</tr>
<tr>
<td>17</td>
<td>Report Interval</td>
<td>Minutes</td>
</tr>
</tbody>
</table>
</div>
<h2>Grafana Dashboards</h2>
<p><img decoding="async" class="alignnone wp-image-255 size-full" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-today_so_far_blog.png" alt="" width="2452" height="860" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-today_so_far_blog.png 2452w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-today_so_far_blog-300x105.png 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-today_so_far_blog-1024x359.png 1024w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-today_so_far_blog-768x269.png 768w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-today_so_far_blog-1536x539.png 1536w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-today_so_far_blog-2048x718.png 2048w" sizes="(max-width: 2452px) 100vw, 2452px" /></p>
<p><img decoding="async" class="alignnone wp-image-253 size-full" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-device_details_blog.png" alt="" width="4904" height="1266" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-device_details_blog.png 4904w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-device_details_blog-300x77.png 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-device_details_blog-1024x264.png 1024w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-device_details_blog-768x198.png 768w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-device_details_blog-1536x397.png 1536w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-device_details_blog-2048x529.png 2048w" sizes="(max-width: 4904px) 100vw, 4904px" /></p>
<p>The rest of my efforts were turning those metrics into usable information &#8211; coming up with an Overview, Today So Far, and a Device Details set of Grafana dashboards.</p>
<p><img decoding="async" class="alignnone size-full wp-image-211" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-dashboards-aio-title.png" alt="" width="874" height="456" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-dashboards-aio-title.png 874w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-dashboards-aio-title-300x157.png 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-dashboards-aio-title-768x401.png 768w" sizes="(max-width: 874px) 100vw, 874px" /></p>
<p>Like my previous <a href="https://labs.lux4rd0.com/2021/01/oldskool-syslog-meets-newskool-loki/">Loki Syslog All-In-One project</a> &#8211; I created an All-In-One project for this WeatherFlow collector. Details on installing your own collector, including all the files needed to download, are over at my <a href="https://github.com/lux4rd0/weatherflow-dashboards-aio" target="_blank" rel="noopener">WeatherFlow Dashboards AIO</a> Github repository. These dashboards are also available in Grafana&#8217;s Community <a href="https://grafana.com/grafana/dashboards?search=weatherflow&amp;dataSource=loki" target="_blank" rel="noopener">Dashboards</a>. With some help from P-Doyle&#8217;s <a href="https://github.com/p-doyle/Simple-WeatherFlow-Python-Listener" target="_blank" rel="noopener">Simple-WeatherFlow-Python-Listener</a> and <a href="https://grafana.com/docs/loki/latest/clients/promtail/" target="_blank" rel="noopener">Promtail</a> &#8211; you too can deploy a quick and easy WeatherFlow log collector with Grafana Loki and Grafana dashboards.</p>
<p>If you&#8217;re a WeatherFlow fan, I&#8217;d love any feedback on how this works. If you&#8217;d like to share your dashboards, I&#8217;d happily include them here to share with the community!</p>
<p><a href="https://grafana.lux4rd0.com/d/lux4rd0labs_weatherflow_loki_01/weatherflow-overview" target="_blank" rel="noopener">These dashboards</a> are also part of my Internet-facing set of current <a href="https://labs.lux4rd0.com/grafana/" target="_blank" rel="noopener">Grafana</a> dashboards. Enjoy!!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://labs.lux4rd0.com/2021/02/weatherflow-tempest-log-collector/feed/</wfw:commentRss>
			<slash:comments>22</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">197</post-id>	</item>
	</channel>
</rss>
