ArchiveSW - Display & Data Archive Storage

I had set the outputs to turn on LEDs on certain events. Now would be a good time to work on makjng it configurable and setting ways to trigger the outputs.

hint, hint

2 Likes

Proximity sensor to turn on the backlight for a period of time
Ambient light sensor to adjust display brightness
Turn on/off a relay based on internal or external temperature values
Turn on/off a relay based on Lux
etc.

No wonder RPi’s are like rabbits! Except these don’t need a pair to multiply. :laughing:

1 Like

These are panned and I am looking at the parts and code required.

This is what I had in mind for the triggers.

The current code has three inputs and three outputs. The outputs are not programmed. I need to write the web code to allow one to pick the Key and Value to trigger on. Then I have to figure out how complicated to let it become.

And you know, no matter what I do, some will still want more.

It is easy to do:

Output 1 on:
AIR TEMP - GREATER THAN xx

Output 2 on:
LUX - LESS THAN xx

Output 3 on:
WIND - GREATER THAN xx

1 Like

These are the two items I’m actually working on. The RPi does not have analog inputs so it will require the use of I2C sensors. These sensors are not pretty so users will need to come up with there own housing. i will be investigating different configurations.

I’m looking for a motion sensor that will report motion under 500ms. If you have any suggestions or comments please let me know.

1 Like

Haven’t found much on this one but it might work:


This link may have more information. It does have a link to a video about it being used with a RPi.

1 Like

This is strange. Your Sky developed a wind sensor failure at below 2.7vdc.

The code used by the web application uses 2.1vdc as the replace voltage.

null == o[u] || isNaN(o[u]) ? r[e.ObRecord.Battery] = o[u] : r[e.ObRecord.Battery] = o[u].toFixed(2), "obs_air" == a.type ? r[e.ObRecord.BatteryState] = o[u] >= 2.4 ? e.user.localize("battery_state_good_label") : e.user.localize("battery_state_replace_label") : "obs_sky" == a.type && (r[e.ObRecord.BatteryState] = o[u] >= 2.2 ? e.user.localize("battery_state_good_label") : e.user.localize("battery_state_replace_label"));

Something very contradictory here. Especially as others are seeing the higher voltage as the cutoff for the Sky.

Thank you for bringing this to my attention.

Hi @GaryFunk

Yes please Gary I am ready to try your script.

cheers Ian :slight_smile:

1 Like

It is a few posts up at ArchiveSW - Display & Data Archive Storage

1 Like

It is here. …

There is a script to update the RPi at

bash -e <(wget -qO - http://fsoft.com/archivesw/script/updaterpi.sh )

1 Like

I discovered an issue when ArchiveSW starts after the RPi reboots. To prevent the current errors I have coded a delay onto start.js. I will be adding checks into server.js to allow for the shortest possible delay.

5 Likes

As a test, I just ran 48 hours with the Hub and RPi on battery power. I did keep the RPi connected to the Internet so data would flow to the WeatherFlow servers. Otherwise, all data was captured and stored by the RPi

With bigger batteries I think it should be possible to run the Hub and RPi for a week with NO lose of data. One more step towards total isolation and data loss prevention during a black-out or power-failure during a storm.

5 Likes

@GaryFunk

Just saw the project discussed on the wfpiconsole thread … and was interested enough to attempt a build.

All went well using the ./install.sh script until it tried installing ‘pm2’ -
Got a bunch of errors - tried manually with the same results? can you shed some light on what I must be doing wrong?

I did update the system 3+ times without any changes in my progress.

image

Before you start please ensure your system is updated!
Press Enter to run the update script.
Do you need to update your system? [Y/n]Y

The script will update your RPi

Runnig system update
Hit:1 http://archive.raspberrypi.org/debian stretch InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian stretch InRelease
Reading package lists...

Running system upgrade
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Running system dist-upgrade
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


ArchiveSW will be installed into : /home/pi
If you want to change the location, press N to exit the script.
Change to the location you want ArchiveSW installed into and run the script.
Is this what you want? [Y/n]Y

The script will create a database named: archivesw
A user will be created named: archivesw
with the password of: weatherflow

Do you want to change these values? [y/N]n

######################################################
Starting ArchiveSW Install ...

Updating System files ...
========================================
Complete ...

Upgrading System files ...
========================================
Complete ...

Creating ArchiveSW folders ...
========================================
Complete ...

Copying files
========================================
Complete ...

Edit config.json
========================================
Complete ...

Edit ecosystem.config.js
========================================
Complete ...

Checking for MariaDB ...
========================================
MariaDB version is: 15.1

Edit /etc/mysql/my.cnf
========================================
Complete ...

Setup MariaDB
========================================
Step 1 Complete ...
A database with the name 'archivesw' already exists.
Step 2 Complete ...
Step 3 Complete ...
Complete ...

Checking for Node.js ...
========================================
Node.js version is v8.11.1
Complete ...

Checking for NPM ...
========================================
(node:1449) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.

Installing NPM
========================================
(node:1465) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
NPM version is 1.4.21
Complete ...

Checking for PM2.js ...
========================================
PM2.js version is 0.0.0

Installing PM2 for Nodejs
========================================
(node:1475) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
./install.sh: line 287: pm2: command not found
PM2.js version is
Complete ...

Installing required node modules ...
========================================
(node:1495) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
npm WARN package.json node-prowl@0.1.7 No license field.
npm WARN package.json ds18b20@0.1.0 No license field.
npm WARN package.json pushover-notifications@1.2.0 No license field.
npm ERR! Error: Method Not Allowed
npm ERR!     at errorResponse (/usr/share/npm/lib/cache/add-named.js:260:10)
npm ERR!     at /usr/share/npm/lib/cache/add-named.js:203:12
npm ERR!     at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:167:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:135:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 4.14.98-v7+
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "--unsafe-perm"
npm ERR! cwd /home/pi/archivesw
npm ERR! node -v v8.11.1
npm ERR! npm -v 1.4.21
npm ERR! code E405
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/archivesw/npm-debug.log
npm ERR! not ok code 0
Complete ...

ArchiveSW supports GPIO on the Raspberry Pi.
There are three inputs and three outputs.
Do you want to install GPIO support? [Y/n]y
Installing GPIO node modules ...
========================================
(node:1509) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
make: Entering directory '/home/pi/archivesw/node_modules/onoff/node_modules/epoll/build'
  CXX(target) Release/obj.target/epoll/src/epoll.o
  SOLINK_MODULE(target) Release/obj.target/epoll.node
  COPY Release/epoll.node
make: Leaving directory '/home/pi/archivesw/node_modules/onoff/node_modules/epoll/build'
onoff@3.2.9 node_modules/onoff
├── lodash.debounce@4.0.8
└── epoll@2.0.7 (nan@2.12.1, bindings@1.4.0)
(node:1600) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
ds18b20@0.1.0 node_modules/ds18b20
Complete ...

Edit /boot/config.txt
========================================

Edit /etc/modules
========================================
Complete ...
You MUST REBOOT the RPi after the install is finished.

Creating database and tables ...
========================================
Complete ...

All MariaDB users can only connect from the localhost!
You should create a user to connect outside of the localhost
to allow you to connect and view data from your personal comuter,
Do you want to create a SQL user for yourself? [Y/n]n

Restart MariaDB
========================================
[ ok ] Restarting mysql (via systemctl): mysql.service.
Complete ...

Add commands to crontab
========================================
Complete ...

Creating version data ...
========================================
Complete ...

Starting scripts
./install.sh: line 375: pm2: command not found
complete ...


Checking open ports for Web Server
========================================
8080
ArchiveSW Web Server set to port: 8080
DONE!
#######################################


Go to http://192.168.1.127:8080/ to finish configuring archivesw


pi@archivesw:~ $
1 Like

What is returned when you run

pm2 list

pi@archivesw:~ $ pm2 list
-bash: pm2: command not found
pi@archivesw:~ $

edit: also reflected during the install…
Starting scripts
./install.sh: line 375: pm2: command not found
complete …

1 Like

please try this

sudo npm install -g npm@latest

I tried that … but will try again …

1 Like
pi@archivesw:~ $ sudo npm install -g npm@latest
(node:2344) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
npm WARN package.json path-is-inside@1.0.2 No README data
npm WARN package.json sorted-object@2.0.1 No README data
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
npm WARN package.json config-chain@1.1.12 No license field.
npm WARN package.json cyclist@0.2.2 No license field.
npm WARN package.json json-schema@0.2.3 No license field.
npm WARN package.json punycode@1.4.1 punycode is also the name of a node core module.
npm WARN package.json qrcode-terminal@0.12.0 No license field.
npm WARN package.json string_decoder@1.2.0 string_decoder is also the name of a node core module.
npm@6.8.0 /usr/local/lib/node_modules/npm
pi@archivesw:~ $
> 

well it came up cleaner …
but still got

pi@archivesw:~ $ pm2 list

-bash: pm2: command not found

pi@archivesw:~ $

1 Like

Try this:

sudo npm cache clean -f
sudo npm install -g n

image

1 Like

run
sudo npm install -g npm

npm should be version 6.7.0