View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 10 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Mon Apr 11, 2005 12:05 pm 
Offline
Joined: Mon Jun 21, 2004 11:25 am
Posts: 291
Location: Ontario, CA
I have been playing again with some Home Automation things, and working on integrating some basic things with my Myth box. Since I use a mac for the automation control (you can't beat AppleScript and Indigo.) One thing I do now, is when someone is coming up the walk way to the front door, I have an apple script that basically ssh's into the myth box and then sends:
Code:
mythtvosd --template=alert --alert_text="Someone is at the front door."

This works, but takes a little more time then I would like. Pauses are needed for the connection, and password to be sent, and sometime ssh takes a few seconds to make a connection (myth gets weird every now and then.)

I am looking for a quicker way to do this. Is there a way to send a message straight to the port, or something that does not require a full log in, wait, send password, wait, send command.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 11, 2005 5:30 pm 
Offline
Joined: Mon Oct 06, 2003 10:38 am
Posts: 4978
Location: Nashville, TN
I don't know that there is any quicker way than what you are doing. I just saw something over on the asterisk wiki about mythtv integration with asterisk, but I think it was using mythosd just like you are, but It might be worth a look.

_________________
Have a question search the forum and have a look at the KnoppMythWiki.

Xsecrets


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 11, 2005 11:02 pm 
Offline
Joined: Mon Jun 21, 2004 11:25 am
Posts: 291
Location: Ontario, CA
I will have to check that out. I am working on an asterisk pbx next anyway, so this may be good. Thanks for the tip.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 12, 2005 5:37 am 
Offline
Joined: Wed Mar 03, 2004 7:43 pm
Posts: 748
Location: Sydney, Australia
wififun, I just built you a Max OS X binary of mythtvosd. Download it from here:
http://www.users.bigpond.com/pear_computers

You can run it exactly the same way as the one you are ssh'ing. It should save a few seconds (ssh negotiations can take a while, particularly over wireless networks)

_________________
| Nigel Pearson, nigel.pearson.au@gmail.com
| "Things you own end up owning you" - Tyler, Fight Club


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 12, 2005 7:39 am 
Offline
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location: Groton, MA
Does your MAC environment provide command line http access similar to wget? you may be able to script a telnet session to the apache port.

You could use the apache server and some PHP to execute your commands. I'm not a PHP coder but have written lots of shell script based CGI.

you could have a script say x10.php that accepted parms for different event which is called from the MAC

From the MAC
Code:
wget http://mythweb.local.domain:<port>/x10.php?event=FrontDoor


On the mythbox in PHP syntax

Code:
x10.php

if event = 'FrontDoor" then
   mythtvosd --template=alert --alert_text="Someone is at the front door."
elseif event = 'BackDoor" then
   mythtvosd --template=alert --alert_text="Someone is at the back door."
elseif
   ...
end if


Of course, with cgi enabled, this could be wrtten in sh, ksh, perl, anything.

While this is not as secure as ssh, you can use htaccess schemes to limit access to this script to trusted machines.

_________________
R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 12, 2005 8:30 am 
Offline
Joined: Mon Jun 21, 2004 11:25 am
Posts: 291
Location: Ontario, CA
Wow, those are both great ideas.

nigelpearson, thank for compiling mythtvosd. At about 12:20 this morning, I had the idea of compiling this, mythnotify, and a few other things I saw on different groups. I spent a while trying to get it to work. I could not get it to compile. Running your compiled version returned
Code:
mythtvosd can't open library: /usr/local/lib/libfreetype.6.dylib  (No such file or directory, errno = 2)
Trace/BPT trap

This evening I will spend some time tracking down and likely compiling libs to get this working. Thanks for the help. UPDATE: Good old Fink. I think I am on to the answer now. I will report back. UPDATE 2: well, I set up on a different clean 10.3.8 mac and followed the myth compile steps here http://www.mythtv.info/moin.cgi/MythOnMacOsx At the end, rather than doing the whole of myth I just did the mythtvosd. This all worked well. I wish I new how to statically build this, so these libs would not be needed. I had to edit main.cpp since it seams that the ip is bound to 255.255.255.255. I changed this to the ip of my mythbox. My c is so rusty, I don't remember where to begin to try and make the --bcastaddr switch actually work. It does not seem to function. As soon as I get home where I can see the OSD I will know if all this worked.

khrusher - I am also going to implement this idea. This looks great. Very in secure, but then this box is pretty isolated from the outside. Looks like fun, and may solve some other ideas I have had as well. Very cool.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 12, 2005 4:42 pm 
Offline
Joined: Mon Oct 06, 2003 10:38 am
Posts: 4978
Location: Nashville, TN
you do realize that 255.255.255.255 is the broadcast address, which I believe is what mythosd uses, so you really probably didn't need to change that.

_________________
Have a question search the forum and have a look at the KnoppMythWiki.

Xsecrets


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 13, 2005 6:16 am 
Offline
Joined: Wed Mar 03, 2004 7:43 pm
Posts: 748
Location: Sydney, Australia
wififun wrote:
Running your compiled version returned
Code:
mythtvosd can't open library: /usr/local/lib/libfreetype.6.dylib  (No such file or directory, errno = 2)
Trace/BPT trap


Do'h. Sorry about that. I did it in a hurry last night, and didn't even think about dependant libraries. It shouldn't need freetype, but it does need libqt, which is a little bit large and wastefull.

The PHP idea is good.

The best way would be to find a Perl hacker to make a script to do the equivalent of mythtvosd. But I ain't volunteering for that :-)

_________________
| Nigel Pearson, nigel.pearson.au@gmail.com
| "Things you own end up owning you" - Tyler, Fight Club


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 13, 2005 9:53 am 
Offline
Joined: Mon Jun 21, 2004 11:25 am
Posts: 291
Location: Ontario, CA
to build and run it, it did require freetype, mysql client libs, qt, lame, etc... No biggie once I got it all figured out. And yea, it did not click that 255.255.255.255 was the broadcast address. Once compiled and libs in place, it works great. It takes less than 1 second now to get the trigger from Indigo to the display on the myth box. Nice, shaved 5 seconds off the response time. I know enough perl that I may be able to hack this together. I really would like to ditch the libs and convoluted process of getting it running. Thanks for the help, it works great.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 19, 2005 1:32 pm 
Offline
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location: Groton, MA
simple, no error checking ....
Code:
mythtv@mythtv:/var/www $ cat x10.php
<?
if (isset($_GET['event'])) {

    switch ($_GET['event']) {
    case "FrontDoor":
       echo "FrontDoor\n";
       $cmdline=escapeshellcmd(" mythtvosd --template=alert --alert_text=\"Someone is at the front door.\" ");
       break;
    case "Backdoor":
       echo "Backdoor\n";
       $cmdline=escapeshellcmd(" mythtvosd --template=alert --alert_text=\"Someone is at the back door.\" ");
       break;
    case "Garage":
       echo "Garage\n";
       $cmdline=escapeshellcmd(" mythtvosd --template=alert --alert_text=\"Someone is in the garage.\" ");
       break;
    }
    system($cmdline, $retval);
}
else
{
   echo "No Event";
}

    exit;
?>


to call, sent http to server, substitute your IP and port

Code:
http://68.163.156.159:8080/x10.php?event=FrontDoor

_________________
R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 28 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu