Simple java app to read sensor values from Telldus Live!

Moderator: Telldus

liverpoolarn
Posts: 65
Joined: Fri Mar 17, 2023 9:45 am

Re: Simple java app to read sensor values from Telldus Live!

Post by liverpoolarn »

Well got the answer from Telldus that it is only net-version that shows this on the web... I have a duo. Does that mean I can't use this??
logge
Posts: 14
Joined: Fri Mar 17, 2023 9:45 am

Re: Simple java app to read sensor values from Telldus Live!

Post by logge »

liverpoolarn wrote:Well got the answer from Telldus that it is only net-version that shows this on the web... I have a duo. Does that mean I can't use this??
Yes, if that's the case this tool will not work for you as it retrieves the values from Telldus web api.
liverpoolarn
Posts: 65
Joined: Fri Mar 17, 2023 9:45 am

Re: Simple java app to read sensor values from Telldus Live!

Post by liverpoolarn »

logge wrote:
liverpoolarn wrote:Well got the answer from Telldus that it is only net-version that shows this on the web... I have a duo. Does that mean I can't use this??
Yes, if that's the case this tool will not work for you as it retrieves the values from Telldus web api.
Crapsters... That's to bad. :-(
Very unfortunate that it is so much difference on features on duo and net...

Anyone got a just as easy way of logging temps with the duo?
mph
Posts: 4
Joined: Fri Mar 17, 2023 9:45 am

Re: Simple java app to read sensor values from Telldus Live!

Post by mph »

Hello everyone.
As a rank amateur where Java is concerned I took the challenge to get this program working. This post shows what I needed to do to get this to work. Forgive me if all this seems very simple to you. Constructive comments are welcome.

To get SensorReader.jar to work I needed to:
  • Figure out how to make the program Java.exe executable anywhere (hint: the system variable "PATH").
  • Install an FTP server and define a user. This is needed in order to copy the sensor data to the text files.
  • Create a .bat script to start SensorReader.jar.
A few more details:
  • Redefining the system variable PATH can be done permanantly or every time a command window is started up to run the program - I do this the second way (for now) using the .bat script.
  • The .bat script has two lines of code. The first adds the "jre 7\bin" directory to the PATH variable (so Java.exe can be found from anywhere) and the second calls up the .jar program with its parameteres.
  • My secret keys and tokens are readable in the .bat file - not so good I guess - so I will find a better solution later on.
  • The FTP server can be on the same or another computer (which I guess is the whole point of using FTP).
  • I installed FileZilla FTP Server (not client) on the same computer. Lifehacker.com gave me a link to instructions to install FileZilla, set up the user/password and define a default directory where sensor data should be stored.
  • I run on Windows 7.
  • I have a Tellstick Net (the only Tellstick device this program works on) with my three temperature/humidity sensors visible (and nearly a couple of hundred crazy scramble sensors hidden - lots of neighbours around me apparently).
  • I now need to figure out how to use the data. The most easy thing for me to start with is problably to import the file into Excel and graph it there. Interpreting the date/time will be the challenge since graphs in Excel suck at that.
Thats it for now. I hope this may help others with no Java experience start googling this stuff so they too can get sensor data from the Tellstick Net.
Hilsen MPH
Windows 7 Ultimate SP1, Tellstick Net V4, 5 stk Nexa (self learning), 2 stk GOA (self learning), 1 stk Nexa door bell, 3 skt temp sensorer
petzno
Posts: 116
Joined: Fri Mar 17, 2023 9:45 am

Re: Simple java app to read sensor values from Telldus Live!

Post by petzno »

Just tried to compile the SensorReader.java into a jar-file, without any changes just to see that I could make it. But it seems like there are some more dependencies. Did you use a project environment setup when this was initially made? I can see there is a .classpath and .project file so that is why I was wondering what software did you use?
logge
Posts: 14
Joined: Fri Mar 17, 2023 9:45 am

Re: Simple java app to read sensor values from Telldus Live!

Post by logge »

petzno wrote:Just tried to compile the SensorReader.java into a jar-file, without any changes just to see that I could make it. But it seems like there are some more dependencies. Did you use a project environment setup when this was initially made? I can see there is a .classpath and .project file so that is why I was wondering what software did you use?
Hi, I used Eclipse. You need to put the included ftp4j-1.7.2.jar in the path.
simoleh
Posts: 7
Joined: Fri Mar 17, 2023 9:45 am

Re: Simple java app to read sensor values from Telldus Live!

Post by simoleh »

mph wrote: [*]The FTP server can be on the same or another computer (which I guess is the whole point of using FTP).
[*]I installed FileZilla FTP Server (not client) on the same computer. Lifehacker.com gave me a link to instructions to install FileZilla, set up the user/password and define a default directory where sensor data should be stored.
Very nice java app! Thanks! But, I have one question; is it possible use this app to save txt-data straight to the working folder of the app without ftp-server? It would be more suitable for me because I am using same computer for every step. Ftp is useless step in my case.
perkabolo
Posts: 40
Joined: Fri Mar 17, 2023 9:45 am

Re: Simple java app to read sensor values from Telldus Live!

Post by perkabolo »

Works great on my computer running java 1.6 but not on my web host running java 1.5. Seems to be something with the OAUTH library.

It bails out when it gets to:

Code: Select all

lobj_OAuthService.signRequest(lobj_AccessToken, lobj_Request);
Any ideas?
logge
Posts: 14
Joined: Fri Mar 17, 2023 9:45 am

Re: Simple java app to read sensor values from Telldus Live!

Post by logge »

simoleh wrote:
mph wrote: [*]The FTP server can be on the same or another computer (which I guess is the whole point of using FTP).
[*]I installed FileZilla FTP Server (not client) on the same computer. Lifehacker.com gave me a link to instructions to install FileZilla, set up the user/password and define a default directory where sensor data should be stored.
Very nice java app! Thanks! But, I have one question; is it possible use this app to save txt-data straight to the working folder of the app without ftp-server? It would be more suitable for me because I am using same computer for every step. Ftp is useless step in my case.
Thanks! Actually the app creates the same text file that it uploads to the FTP server in the working folder. As it is now, you are required to supply FTP details, but if you just enter some fake data it will still create the files in the working folder (you will see an exception every time it tries to upload, but the program will still continue).

For a nicer solution, it could be possible to make the FTP details optional. The source code is available so feel free to make the change.
RH_Dreambox
Posts: 69
Joined: Fri Mar 17, 2023 9:45 am
Location: Södra Säm, Västra Götaland
Contact:

Re: Simple java app to read sensor values from Telldus Live!

Post by RH_Dreambox »

Logge, your script works great, but is it possible to add an path in the bat-file.
The logfile is saved in the root on my WEB/FTP, but it is not the right place for the file.
If the file name is "1234567.txt" I would like to save it to "/temp/1234567.txt"

And next, The date stamp does not follow the european standard.
Would it possible to change it to "YYYY-MM-DD HH:MM" That would open the log file to more diagram codes.
Tellstick - Tellstick Duo - Tellstick Net - Oregon TNGN132N - Raspberry - Z-Wave (RaZberry) - Fibaro HC2 http://www.temp.swedenroots.se/
logge
Posts: 14
Joined: Fri Mar 17, 2023 9:45 am

Re: Simple java app to read sensor values from Telldus Live!

Post by logge »

RH_Dreambox wrote:Logge, your script works great, but is it possible to add an path in the bat-file.
The logfile is saved in the root on my WEB/FTP, but it is not the right place for the file.
If the file name is "1234567.txt" I would like to save it to "/temp/1234567.txt"

And next, The date stamp does not follow the european standard.
Would it possible to change it to "YYYY-MM-DD HH:MM" That would open the log file to more diagram codes.
The source code is available on github (see link in first post) so you can easily customize the program for your own needs.

To change the date format, modify this line in SensorReader.java and replace the date format with something that suits you:

SimpleDateFormat dateFormatter = new SimpleDateFormat("dd/MM/yyyy/HH/mm");

To upload the file in a different directory, adding something like this after client.login(...) should do the trick:

client.changeDirectory("temp");
RH_Dreambox
Posts: 69
Joined: Fri Mar 17, 2023 9:45 am
Location: Södra Säm, Västra Götaland
Contact:

Re: Simple java app to read sensor values from Telldus Live!

Post by RH_Dreambox »

Great! I'm on my way.
Is it possible to have an headerline in the file like

Date,Temp inside,Humidity inside,Temp outside;Humidity outside
2013-02-01 01:00,22.2,42,14.5,65
2013-02-01 01:30,22.3,42,14.4,66
2013-02-01 02:00,22.2,42,14.5,65

Where in your code can I add that info?
My diagram program would like that wery much:-)
Tellstick - Tellstick Duo - Tellstick Net - Oregon TNGN132N - Raspberry - Z-Wave (RaZberry) - Fibaro HC2 http://www.temp.swedenroots.se/
logge
Posts: 14
Joined: Fri Mar 17, 2023 9:45 am

Re: Simple java app to read sensor values from Telldus Live!

Post by logge »

You have two options for that:

1. You have to add some code before the line below to check if the sensor logfile exists. If it does not, you make sure to first add the header.

check if file exists before this line
FileWriter file = new FileWriter(sensorList.elementAt(i) + ".txt", true);
write your header if the file didn't exist here (file.write("my header");)

2. You can also add the header manually if you don't want to alter the program. As the log files are only created once and then appended to, if you edit the file(s) and add your header, it will stay in the logfile forever.
RH_Dreambox
Posts: 69
Joined: Fri Mar 17, 2023 9:45 am
Location: Södra Säm, Västra Götaland
Contact:

Re: Simple java app to read sensor values from Telldus Live!

Post by RH_Dreambox »

The problem is solved (by Eclipse) but I do'nt understand how.
Now is my logfile OK with header and date format.
And I also got a shadow copy on my own computer!!?? That will be the next thing to solve:-)


I have installed Eclipse to make my own custom made JAR-file.
I can make the JAR-file but there is a fault in the code I don't understand

"main(String[]) void" and it Points to this code-lines.

public class SensorReader {
/**
* @param args
*/
public static void main(String[] args) {

Have I forgot something or have I done the JAR-file in wrong way? I have downloaded logge's code so the code should be ok.
The code I have changed is the date-format and path-change after logged in to FTP.
My SensorReader is 153 092 bytes and logge's original file is 153 027 bytes so I Think all code is in Place.

When I run the my Jar-file i got the message "No headmanifest attribute" (translated from Swedish)
Please, help needed...
Tellstick - Tellstick Duo - Tellstick Net - Oregon TNGN132N - Raspberry - Z-Wave (RaZberry) - Fibaro HC2 http://www.temp.swedenroots.se/
Post Reply