ArchiveSW - Display & Data Archive Storage

Those errors have been fixed in the newest code. You can rerun the DailyStats from the command line by using the data.

node dailystats -date 2018-10-28

You can do this for every date as it will just recalculate the data.

First, run altertables to make sure the database is up-to-date.

You may run is manually by installing the command in CRON via crontab, run node updatefiles from the command line or click the link on the about page. The next version of Server will do it automatically if you have the Config option set to Yes.

I have been thinking about this and there is not great solution. So, I will have the application send an alert if you have Pushover or Prowl installed and I will place a notice on the Home page of the built in Server.

There is no good way to limit the size but I can consider doing so. I recommend that you view the logs and delete them if there are no errors or issues. At this point, I suggest you delete all the logs and check them at least once a week.

Thank you. I have tablets all over my house as part of my home automation system. My wife likes to see the temperature so she knows if she will freeze. She’s from Saigon and there it is only have hot and hotter.

There are several good tools. I use Sysyog. You can even use the free GUI from MySQL.

1 Like

On linux you can use Logrotate to compress logs, and delete them after a certain time/number of logs

Search for a tuto how to install on your raspberry and then config it to rotate the logs from wfarchive ÂŽ, else the good old way when you see them grow to big, delete via the server page. :slight_smile:

3 Likes

Thanks for the responses and suggestions.

So far the HeidiSQL is working for me - as I just wanted to see the data for now.

Running DailyStats filled in the missing rows.
I did have to add the -date for it work for other than today
node dailystats -date 2018-10-04

1 Like

Yes. Even I forget how these scripts work.

I don’t see the need for major changes in the near future so the applications should remain stable for the next two months. I will be working on all current issues that get reported and making small enhancements. The next addition is to add uploading to PWSWeather. Otherwise I will spend time cleaning the current code and playing with internal temperature sensors.

I am also working on a non-cloud based video doorbell.

5 Likes

solved in tonight’s update, thanks

1 Like

Are you saying the white circle is no longer an issue?

indeed, the circle is back to ‘grey’ as it should.

30

1 Like

Gary - playing around with the code this am (hope you do not mind) and came up with a slightly improved wind direction animation.

We have a small cold front with winds almost from due north and I noticed that when the wind is flipping from the 20s to the 350s, the arrow indicator sweeps all the way around to 350s.

Seems more natural to me to have it sweep from right to left from 20 to 358.

image

image

Here is one solution which I believe works to handle this case. Just a few lines of code and a local var moveDir and WindDirLast is global.

image

2 Likes

why not paste the code directly in the forum between 3 backticks like I force show below,

 ` ` `
code 
 ` ` `

this will show the code in a formatted way and is easy to copy if needed

3 Likes

Sure.

socket.on('wind', function(data) {
	let j = JSON.parse(data);
	let aa, dir, moveDir, windspeed;
	
	W = j.ob[1];
	let windColor = window.WeatherCalc.getWindColor(W);
	if (j.ob[2] == null) {
		//$('.windArrow').css('display', "none");
		$('.windcompass').css('border', "9px solid rgba(" + windColor + ", .7)");
		document.getElementById("winddirection").innerHTML = '';
		document.getElementById("winddirectiontext").innerHTML = '';
		windspeed = 0;
	} else {
		if (j.ob[2] == 0) { 
			dir = 360;
		} else {
			dir = j.ob[2];
		}

		// default to the current wind direction
		moveDir = dir;
		
		// handle case where wind changes from 0 to 90 to 270 to 360(0)
		// This will rotate the arrow to the left instead of all the around to the right
		if( dir > 270 && WindDirLast < 90) 
		{
			moveDir = dir - 360;
		}
		
		// save current wind direction for next time around
		WindDirLast = dir;

		aa = 'rotate(' + moveDir + 'deg)';
		$('.windArrow').css('display', "block");
		$('.windArrow').css('-webkit-transform', aa);
		$('.windArrow').css('-moz-transform', aa);
		$('.windArrow').css('-o-transform', aa);
		$('.windArrow').css('-ms-transform', aa);
		$('.windArrow').css('transform', aa);
		$('.windcompass').css('border', "9px solid rgba(" + windColor + ", .7)");
		document.getElementById("winddirection").innerHTML = dir + '&deg;';
		document.getElementById("winddirectiontext").innerHTML = window.WeatherCalc.GetCompass16(dir);
		windspeed = window.WeatherCalc.convertWindSpeed(j.ob[1], panel.unit.wind);
	}
	document.getElementById("windspeed").innerHTML = windspeed.toFixed(1);
});

2 Likes

You are close and I have tested this. The issue is the degrees can wind up like a watch and end up being a direction value that can increase to 1700 which is shown as 264 degrees…

The compass is not actually a circle but a line that is curved. It starts at zero and ends at 359. If you set it to 360 it goes to 359 then wraps to 0 moving left to right. If you then set it to 0, it will actually look as it it is unwinding in a complete circle.

As for the formula, the method to accomplish this is calculate the amount of movement. We will set the default movement to left-to-right. Then calculate value of degrees to move. If that value is greater than 180, the movement would be right-to-left and the value would be the value to move - 360.

This works if the previous direction is less than the new direction. If the previous direction is greater than the new direction and the movement is more than 180 then an entire new set of code is needed. Once this is in place there is even more code to keep track and convert the actual direction to the pseudo direction.

It’s actually several lines of code and while not complicated it can get confusing to non-programmers. It’s a lot of IFs and I’ll put the code in if users really want this.

1 Like

@GaryFunk, is this an issue because polar coordinates are not being used? I’m not sure what routines or functions are available but it seems like a polar coordinate issue with a fixed radius. Calculate the polar coordinate steps and run the results through a polar to Cartesian routine to plot the results.

1 Like

I have not considered that approach but that would be even more code added to the application.

It’s hard to justify extra code for some things. What does it look like if motion isn’t animated? Is it too jumpy? I like seeing the animation on the WF app but I’m not keen on the “swinging all the way around” just for a few degrees across north.

3 Likes

it works but looks a little strange. The motion gives a better visual indication of direction.

I’m testing the code between watching episodes of “King of the Hill” on Hulu. I truly like the idea of the animation emulating a physical compass. After all, it’s just a few lines of code on the browser side.

2 Likes

I have added the code suggestion provided by Mark (@mao) since preliminary testing shows it to be 99% accurate.

Full testing would require running through 46,656,001 irritations of previous and current wind variables. So, until I can prove exactly where it fails, I feel it is a good change.

A big Thank You to Mark for providing this change.

Gary

2 Likes

ATTENTION:

WeatherFlow has many more products than the Smart Weather Station and this application only deals with this one product. Therefore, I am renaming this application to ArchiveSW.

Updates will not affect current installs but future installs will be placed in the folder “archivesw” or the folder of your choice.

These number demonstrate the flaw in this formula.

WD = previous wind direction
degree = current wind direction
moveTo = position to move arrow to

WD degree moveTo
11 10 10
10 7 7
7 333 -27
333 320 320

The last move did not go the intended direction.

WD degree moveTo
348 343 343
343 329 329
329 328 328
328 9 9

The last move did not go the intended direction.

I think I created a formula that actually works 100% for compass direction.

https://drive.google.com/file/d/1ODCtkcqUDtYY-PAvH6ZooMBACeKOwDqH/view?usp=drivesdk

5 Likes