Accessing the Elk log from javascript?

MarkJames

Member
I'm working on a web page to integrate my cameras, ISY, Elk and other devices.  It's all written and working but I have one missing piece - the Elk log.
 
Does anyone know how I can read the elk log in Javascript?
 
I'm hosting my webpage on a Raspberry Pi 3 within my own network.
I've got websockets connected to the ISY so I get real-time device and variable updates which is pretty neat
The ISY has an Elk interface and it gives me absolutely everything about the Elk EXCEPT access to the log.
 
I can connect to the Elk using Putty and when I send it  09ld00100D6 it will respond, as expected, with the first log entry.  That's perfect - proof of concept is there.
 
But I'm stymied as to how to get at it from javascript....
 
I've tried to do it with Ajax but I can't switch ports due to the same origin rule.  
I've tried websockets but it doesn't look like Elk supports them.
I can't find a TCP library for javascript....
 
Any gurus out there with some thoughts?
 
Thanks!
 
 
 
I own an ElkM1g, but it's not installed yet, so I dont know much about the system.

But, what if you use another process (cron job?) to connect to the Elk and grab the log(s) every few minutes and write them to a file that you can then parse via Java?

Sent from my HTC One_M8 using Tapatalk
 
That's actually a pretty good idea.
 
I did manage to sort it out, though. I created a php script that reads the log and an ajax call to run the php script.  The data is returned in the ajax callback and then it's easily parsed in javascript.
 
If you decide to do the same let me know and I'll shoot you the code
 
Cheers,
 
mark
 
Back
Top