Reply
Thread Tools
Posts: 220 | Thanked: 19 times | Joined on Jun 2006
#1
i will pay $20 for someone to write a python script that will automatically send my 770 temperature, in degrees c, to twiter , every 6 hours.
the 770 temp sensors can be found by find /sys/ -name *temp* but they are not scaled to degrees c
 
TrueJournals's Avatar
Posts: 480 | Thanked: 378 times | Joined on Apr 2008 @ Chicago-ish
#2
This, surprisingly, wasn't too difficult. Download from http://dl.getdropbox.com/u/46230/pytwitemp.tgz. Un-tgz to the directory of your choice with:
Code:
tar xzvf pytwitemp.tgz
Then, edit pytwitemp.py and put in your twitter username and password. Finally, run the script! (./pytwitemp.py) It should add the status immediately, then update every six hours. I tested it on my n800 and it works fine. I'm assuming that the path to find the temperature is the same on the 770. If it doesn't work, can you post the EXACT path to find the temperature?

Note: I currently don't check for a connection or do any connection handling. I'm assuming that your 770 never leaves your current network, so there won't be a connectivity problem. I'll work on adding that, and cleaning up the installation and running of the script.
__________________
Disclaimer: If a program I wrote doesn't work/breaks your tablet... It's not my fault
mcedit | Utility Calculators (WIP) | PyRDesktop
My Blog | Twitter

Last edited by TrueJournals; 2009-01-24 at 01:17. Reason: D'oh! Forgot to attach
 

The Following User Says Thank You to TrueJournals For This Useful Post:
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#3
On the N800, at least, /sys/devices/platform/i2c_omao.1/i2c-1/1-0048/temp1_input seems to be 3-place fixed-point representation, with actual resolution of 0.25 °C.

Since you didn't give the output of that find, and I don't have a 770, I'm going to guess it's the same place, with the same units, and you'll need to edit it accordingly.

You'll need wget from extras. Oh, and I don't twitter, so the whole thing's untested. Let me know how broken it turns out to be.

(And I saw you already got a solution, I'm just striking a blow against python-madness here by showing how this sort of glue-together work is easily done using existing programs and a genuine scripting language.)
Code:
$ cat twittertemp.sh
#!/bin/sh
TEMP_DEV=/sys/devices/platform/i2c_omap.1/i2c-1/1-0048/temp1_input
#C
TEMP_BASE=500
TEMP_MUL=1
TEMP_DIV=1000
#F
#TEMP_BASE=18056
#TEMP_MUL=9
#TEMP_DIV=5000
TWIT_LOGIN=
TWIT_PASS=


temp=$(expr \( `cat $TEMP_DEV` + $TEMP_BASE \) \* $TEMP_MUL / $TEMP_DIV)
wget --keep-session-cookies --http-user="$TWIT_USER" --http-password="$TWIT_PASS" --post-data="status=$temp" http://twitter.com/statuses/update.xml
 
Posts: 220 | Thanked: 19 times | Joined on Jun 2006
#4
2truejournals its not at the same location and its not scaled to degrees but i should be able to handle that(as he takes his 700 from the fridge). thaks it works great

Last edited by smackpotato; 2009-01-24 at 03:22.
 
Reply


 
Forum Jump


All times are GMT. The time now is 20:55.