ArchiveSW - Display & Data Archive Storage

Nice! Looks good. It seems so simple at first, but it took me ages to get this working in the PiConsole as well. I’ve had it running in my development version for the last week or so, and haven’t noticed anything weird yet.

PS. I think you have a typo in your thread title!

1 Like

Thank you Peter and thank you for pointing out the title. I did that same error with a search and replace. Geez, Sometimes I wonder why my fingers don’t pay attention.

I have one formula working well and have therozied a second… I will test it out tomorrow and see which one is simpler. The formula is not as complicated as the issue. Funny how that works. I remember math being a lot easier 45 years ago. I had to work with pencil and paper then. Not sure how I survived.

Ah yes I see there are some cases that will have a strange result like the 333 to 320.

I guess it moved all the way around to the right didn’t it?

I think there needs to be checks for that delta and then determine which way to go.
I knew there were going to be a few other cases to deal and had to stop…

I have a compass application for work that had similar issues- will review how I did things for that.

Watched video looks good.

2 Likes

Thanks.

I knew there were some other cases that required more thought. I saw your post below…yes, agree.

1 Like

Here is the code I am testing. It’s darn simple.

if (WD == null) {
    WD = 0;
}
degree = j.ob[2];
if (WD < 0) {
    V = degree + (WD * -1);
} else {
    V = degree - WD;
}
if (Math.abs(V) > 180) {
    moveto = ((360 - V) * -1) + WD;
} else {
    moveto = degree;
}
WD = moveto;

If anyone has a formula that moves a compass, I’d like to see how it works. I know there are different ways to solve the same issue.

2 Likes

Quick look - seems pretty good.
I will take a look at what I have for another app.

Wouldn’t it be a good idea to keep a hint to weatherflow in the name… like
wfswsarchiver or archive4WFsws?
Just an idea for easy identification for us and especially those running m9re services on one system… :wink:

I am thinking about making shorter. Just “a”.

Or a little more telling what it is “wfsws.a” ?

1 Like

I’m only changing the “short” name of the application, not the scripts.

1 Like

Here is my method used to move a compass indicator in another application.
I did change some of my variable names to more closely match the topic but logic did not change.
Very similar to your new and improved approach.

I ran a comparison of both approaches and they are a match!

Will not post the comparison stuff unless someone wants to see more…

private double GetWDChange(double? value, double previousWD)
{
  double min = 0;
  double max = 0;

  double adjustedWD = value.GetValueOrDefault();

  if (previousWD < 180)
  {
    min = previousWD;
    max = min + 180;
  }
  else
  {
    min = previousWD - 180;
    max = previousWD;
  }

  if (value > min && value <= max)
  {
    adjustedWD = value.GetValueOrDefault() + 360;
  }
  else
  {
    adjustedWD = value.GetValueOrDefault() - 360;
  }

  return adjustedWD;
}
3 Likes

Thank you for posting this. I’ll try this method and see how each performs.

1 Like

checked the logs tonight (didn’t do any update manually since last night cron)

alert.err

    at /home/eric/wfarchive/alert.js:134:114
    at ClientRequest.<anonymous> (/home/eric/wfarchive/node_modules/pushover-notifications/lib/pushover.js:180:7)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at TLSSocket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)
    at TLSSocket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:66:8)
    at args.(anonymous function) (/usr/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:133:29)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
ReferenceError: remaining is not defined
    at /home/eric/wfarchive/alert.js:134:114
    at ClientRequest.<anonymous> (/home/eric/wfarchive/node_modules/pushover-notifications/lib/pushover.js:180:7)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at TLSSocket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)
    at TLSSocket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:66:8)
    at args.(anonymous function) (/usr/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:133:29)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)

That is an easy fix. There was an error connecting to Pushover. When it went to report the error, there is an actual error in the reporting. I have just fixed it and uploaded a new file.

Thank you for the report.

1 Like

Mark ( @mao ),

I have a new version ready for testing. Let me know when you are at your RPI and I’ll have you pull new files.

Gary

I added a visual aid to update the tables.

Capture

2 Likes

A new version with many updated files is ready. You will need to run updatefiles (twice) then run altertables.

When that is completed, you may run updatefiles again to get the new version. Restart the updated processes and check each Tab in the Server to ensure the proper data is present.

Will check it out this evening.

1 Like

No errors in the logs, But… (There is always a but isn’t there…)
In the “solar” cell, the first light - last light and total light don’t update until I refresh / start a new device.
We have a cool new flashing red date and time? alert maybe? I’m only running “Server, Panel and Archive”
so I don’t have a clue what that is. Not a criticism, I love your program!
Chuck

P.S. I’m in Ohio and starting to get cold and snow, might be related.

1 Like

The red flashing let’s you know there are updated files. I am currently working on this.

2 Likes