Browse Source

Initial readme y0

Wazakindjes 1 year ago
parent
commit
d387bac30c
1 changed files with 19 additions and 0 deletions
  1. 19 0
      README.md

+ 19 - 0
README.md

@@ -0,0 +1,19 @@
+# The fuck is this
+This shit is a qt lil Pyth0n implementation ov reading ein `DS18B20` temperature sens0r, the values of which get stored in a MySQL database somewhere. =]]]
+
+It will run 5 samples (with a required 1 second delay between em) and get the average of that to store in the DB. It also supports multiple sensors but it will only store the first average. xd
+
+# Dependencies
+You prolly need to install a few Pythinz modules cuz they may not be available by default:
+* `ConfigParser`
+* `MySQLdb`
+
+# Installation
+Copy `muhconf.ini.example` to `muhconf.ini` and fire up een editor. All the options are self-explanatory or explained in there so git to reading fam. The config file must be kept in the same dir as the skrip.
+
+Then simply slam a new entry in your `crontab` to make it run periodically (the skrip is set up to read/store once, then quit). You should be able to run it as any non-root user, since the `sysfs` path belonging to the sensor data (e.g. `/sys/bus/w1/devices/28-02155265b0ff/w1_slave`) should be world-readable. My cr0n looks leik dis:
+`*/2 * * * * kill -9 $(ps aux | grep '[p]ython.*temps.py' | grep -v '/bin/sh' | awk '{ print $2 }') >/dev/null 2>&1 ; /usr/bin/python /home/hecks/temp_sensor/temps.py`
+
+As you can see I have it set to run every 2 minutes, faster is not really necessary and would only clutter the DB. The `kill` part is in case a previous instance is hanging on something for some reason, and should usually fail (hence the redirections to `/dev/null` ;]). To me this only really happens when my internetz connection is being gay and takes 2+ minutes to set up a usable MySQL connection. This logic is not present in the code itself because of the "set up to read/store once, then quit" reasoning. ;];];];] It would be p hard to account for anyways, since the TCP handshake has been completed and there __are__ packets flowing, just many get dropped and have to be resent.
+
+ez pz ;]