Pure Java library for Telldus

Moderator: Telldus

Zapper
Posts: 212
Joined: Fri Mar 17, 2023 9:45 am
Location: Där det är kallt

Re: Pure Java library for Telldus

Post by Zapper »

Hittade inte någon ticket men det skulle vara nice om det som skrivits tidigare om att kunna använda udp/tcp sockets för kommunikation med telldusd.
Så man kan slippa köra socat eller helt enkelt kunna använda tdtool från en annan maskin. Eller kunna köra TelldusCenter på en windowsmaskin medans tellsticken sitter i en linuxburk på nätverket.
Zapper
Posts: 212
Joined: Fri Mar 17, 2023 9:45 am
Location: Där det är kallt

Re: Pure Java library for Telldus

Post by Zapper »

Har äntligen fått tag på min duo så man kan leka lite. Upptäckte att man kan få flera meddelanden från eventsocketen i en read så la till while loopen runt msg handlern så att den tömmer bufferten varje gång annars kommer den att samla på sig massa data och halka efter med uppdateringarna.
Såg det när uppdateringarna började halka rejält efter tdtool --list.

I TellduClient.java start rad 87

Code: Select all

while (bb.position() > 0) {     
	 if (!Message.nextIsString(bb)) {
		 throw new IllegalStateException("Illegal data in buffer, expected string");
	 }

	 Message msg = new Message(bb);
	 if (!handleEvent(msg)) {
		 // Unhandled; clear out bb
		 bb.clear();
	 }
}
Dock så får jag nu dubba event från min THGN132N med temp varje gång !? Sänder den 2 ggr och det blir i nästa version av telldus core så att dubbletten försvinner eller har det något med den försvunna luftfuktigheten.
freedomotic
Posts: 1
Joined: Fri Mar 17, 2023 9:45 am
Location: Italy
Contact:

Re: Pure Java library for Telldus

Post by freedomotic »

Hi jstrom,
good work!
We are working on a plugin for our domotic framework Freedomotic. Is it possibile to use your library integrating it?
We have no hardware, so we are searching testers for the software.
If you want to contribute please reply.
Thanks in advance
Freedomotic Open Source Building Automation
freedomotic.com
e85
Posts: 8
Joined: Fri Mar 17, 2023 9:45 am

Re: Pure Java library for Telldus

Post by e85 »

Bra jobbat! Synd bara att det inte kommer några uppdateringar längre... Jag använder liben i en egenskriven android-app för att styra belysningen hemma. Saknar t.ex nån slags felhantering ifall servern inte kan nås (t.ex om wlan inte är påslaget på telefonen). Som det är nu kraschar hela appen... Men det borde jag nog kunna fixa till på nåt vis själv. Vore iallafall riktigt kul om utvecklingen skulle fortsätta. :)
Zapper
Posts: 212
Joined: Fri Mar 17, 2023 9:45 am
Location: Där det är kallt

Re: Pure Java library for Telldus

Post by Zapper »

Märkte att det går att klistra ihop detta med junixsocket för att slippa använda socat med man måste då ha ett par naitive librarys på sin path för jvmen, funkar däremot inte 100% eftersom att junixsocket inte är nio så det är ihopklistrat med "silvertejpskod". Skulle kanske kolla på vad xnio kan göra.
jstrom
Posts: 36
Joined: Fri Mar 17, 2023 9:45 am

Re: Pure Java library for Telldus

Post by jstrom »

Hi!

(tar detta på engelska, så alla hänger med.. :))

Sorry I haven't made any updates on this for long, I havent really used it myself so the incentive to work on it have been quite low. And I haven't gotten any email notifications for some reason..

If you have any further improvements, feel free to fork the repo and continue development! If the patches looks good I'll merge them back down to the mainline.
Regarding use of the library in other applications, the license I set was LGPL, which means you can very well use it, shipping it as a third party JAR. If you make any improvements on the actual library, please clone the git repo and share your work with the community!

Regarding crashing on errors, I suppose the command calls throws NPE if it doesn't receive any response, since sendToService hides any IOExceptions by returning null.. So yeah, pretty flawed error handling indeed! The retry support included mimicked the C clients retry handling at that time.

Regarding events, I haven't really tested that, I don't have a tellstick DUO so that code was mostly written by looking at the C client. Not sure what can be improved, or for that matter, what have changed in the telldus core library.

Again, any improvements are welcome, even though I havent used the library in a while I plan to do it sometime in the future (famous last words..)!

/Johan
Post Reply