mstenta / atmospi

Atmospheric monitoring app for logging and graphing temperatures and humidities over time using a Raspberry Pi and DS18B20, DHT11, DHT22, and AM2302 sensor(s).
31 stars 9 forks source link

Device identification #10

Closed mstenta closed 9 years ago

mstenta commented 10 years ago

There needs to be a better way to identify sensor devices.

Currently, when the Atmospi web app is loaded, it searches through all the DATA (Temperature, Humidity, and Flags) tables to determine what different devices are available. This allowed for DS18B20 auto-detection, but it is very expensive when more and more data is recorded. There is also now way to label devices.

Requirements:

mstenta commented 10 years ago

Data consistency considerations:

If a device is moved or repurposed, we don't want to lose, or be confused by, old data. Should it start a new graph, or continue from the old one (and possibly use the Flags table to make a note of the move).

Similarly, if a device fails, and needs to be replaced with another (with a different serial number), how should that be handled? Should it be a continuation of the same graph as before? Or a new one?

Ultimately, it seems that we may need a higher-level concept of a measured value, separate from specific measurement sensors/devices. For example, "Basement Humidity" is what I want to see, but the specific sensor that measures that may change over time.

ultima-originem commented 9 years ago

Now I got Atmospi up and running, this seems the most useful enhancement. Your last remark summarizes the basic requirement and I agree with your analysis.

For now I'd me happy with a quick and dirty workaround as I have 5 sensors and it's hard to keep them apart.

ultima-originem commented 9 years ago

I have hard coded the required changes [not a pretty solution]. Apple the following code twice:

/**

where the device IDs will have to be changed into your device IDs and the device names will have to be customized.

It's not pretty but it works.

ultima-originem commented 9 years ago

See also my solution to https://github.com/mstenta/atmospi/issues/20

mstenta commented 9 years ago

I am working on this issue in the new "devices" branch: https://github.com/mstenta/atmospi/tree/devices

It will require a fair bit of database updating to get it to work, so I am documenting all of that in CHANGELOG.md: https://github.com/mstenta/atmospi/blob/devices/CHANGELOG.md

When it's all done, I will officially release v0.2.0. Until then, it's a work in progress (including the instructions in CHANGELOG.md) so don't do it unless you're comfortable fixing things that break (AND BACKUP BEFOREHAND!)

More soon...

mstenta commented 9 years ago

OK! This was a big one, but it's done!

Please read the release notes for instructions on how to update: https://github.com/mstenta/atmospi/releases/tag/v0.2.0

If you have any issues, let me know! And be sure to back up your database and custom code changes first! Chance are this will conflict with some of the work you did to hard-code things...