X10 SharedMem.pm zmMonitorEnable -- Very strange!!!

Support and queries relating to all previous versions of ZoneMinder
Locked
dimiz
Posts: 17
Joined: Sat Oct 06, 2007 1:06 pm

X10 SharedMem.pm zmMonitorEnable -- Very strange!!!

Post by dimiz »

Hi to all i'm new in the forum, but i have read a lot of thread about X10 and ZoneMinder..Now i have bought a SmartHome Kit (sold in Italy) with RS232 and works very great!!! Most of ZoneAlarm Function works like charm..
For example for my DeviceCamera i have set "Trigger" option to X10 and
under X10 Tab the follow option:
- X10 Activation String => "4" (Number of X10 Unit code to active Camera)
- X10 Input Alarm String => "" (Blank not used)
- X10 Output Alarm String => "2+10" (when the camera go on alarm put in on the X10 unit 2 for 10 seconds)

Ok...is very simple..:-) So if my camera have an allarm i can able to see my Lamp on...from zmx10.log i can able to view every signal come from my CM11...
But my Idea is to use my KeyChain to Active and Deactive my camera detection, like normal alarm system... So i put on "X10 Activation String" => "4" ... I can able to see from log file the Signal received but nothing happend...As i read in other post there are lot of people ask Why????
So check the zmx10.pl script to under what happend when the Activation string come...The script catch the command from X10 KeyChain in good way!! But..nothing...Ok from the script:
---------
zmx10.pl
---------
if ( $class eq "active" )
{
Debug( "StringaInputAttivazione\n" );
if ( $instruction eq "start" )
{
Debug( "Attivazione Monitor\n" );
zmMonitorEnable( $task->{monitor} );
if ( $task->{limit} )
{
addPendingTask( $task );
}
}
elsif( $instruction eq "stop" )
{
Debug( "Disattivazione Monitor\n" );
zmMonitorDisable( $task->{monitor} );
}
}
------

So...from this script the function that put the Camera in Deactive mode is zmMonitorEnable/zmMonitorDisable... ok i go in SharedMem.pm to vie what kind of function is and how it work...
------------------
sub zmMonitorEnable( $ )
{
my $monitor = shift;

my $action = zmShmRead( $monitor, "shared_data:action" );
$action |= ACTION_SUSPEND;
zmShmWrite( $monitor, { "shared_data:action" => $action } );
}

sub zmMonitorDisable( $ )
{
my $monitor = shift;

my $action = zmShmRead( $monitor, "shared_data:action" );
$action |= ACTION_RESUME;
zmShmWrite( $monitor, { "shared_data:action" => $action } );
}
----------------------
As i can understand they seems like a Suspend/Resume function but inverted :-)..In ENABLE state i call a Suspend and on DISABLE i call resume!!!!Why?
------------
sub zmMonitorSuspend( $ )
{
my $monitor = shift;

my $action = zmShmRead( $monitor, "shared_data:action" );
$action |= ACTION_SUSPEND;
zmShmWrite( $monitor, { "shared_data:action" => $action } );
}

sub zmMonitorResume( $ )
{
my $monitor = shift;

my $action = zmShmRead( $monitor, "shared_data:action" );
$action |= ACTION_RESUME;
zmShmWrite( $monitor, { "shared_data:action" => $action } );
}
---------
As i can understand there is something very strange...but im not developer...so i can missunderstand... Is i use zmMonitorSuspend/Resume function the Activation function of X10 device works...but i can Supend only for some seconds the function dont stop...How can i do???
Many thanks!!!
dimiz
Posts: 17
Joined: Sat Oct 06, 2007 1:06 pm

Post by dimiz »

Ok...at moment..i solved in this mode...is not so good but work for me!!! :-(
---------------------
sub processTask
{
my $task = shift;

if ( $task->{type} eq "device" )
{
my ( $instruction, $class ) = ( $task->{function} =~ /^(.+)_(.+)$/ );

if ( $class eq "active" )
{
Debug( "StringaInputAttivazione\n" );
if ( $instruction eq "start" )
{
Debug( "Attivazione Monitor\n" );
#zmMonitorEnable( $task->{monitor} ); #Rimosso da Dimi
system("/usr/local/bin/zmpkg.pl On"); #Nuovo tentativo con CommandLine
#zmMonitorResume( $task->{monitor} ); #Aggiunto da Dimi
#zmMonitorDisable( $task->{monitor} ); #Modifica da Dimi
if ( $task->{limit} )
{
addPendingTask( $task );
}
}
elsif( $instruction eq "stop" )
{
Debug( "Disattivazione Monitor\n" );
system("/usr/local/bin/zmpkg.pl Off"); #Nuovo Tentativo con CommandLine
#zmMonitorDisable( $task->{monitor} ); #Rimosso da Dimi
#zmMonitorSuspend( $task->{monitor} ); #Aggiunto da Dimi
#zmMonitorEnable( $task->{monitor} ); #Modifica da Dimi
}
}
...etc
----------------
I hope in some suggest!!!
Thanks
dalvis
Posts: 3
Joined: Thu Sep 27, 2007 10:24 pm

Post by dalvis »

I ran into the same problem, everything seemed to be working fine until it hit the shared memory section and then nothing seemed to happen. See my post here: http://www.zoneminder.com/forums/viewtopic.php?t=10455.

I considered doing something like that to fix it, but I wanted to see if there was a better fix, but no one has responded.

I also noticed that the activation and deactivation seemed to be working in reverse, but since it never did anything anyway, I wasn't going to worry about it until I had it working.

If no other fixes or suggestions are forthcoming, I might just try out your fix for my problem.
dimiz
Posts: 17
Joined: Sat Oct 06, 2007 1:06 pm

Post by dimiz »

Hi dalvis.. i have read your post when i try to configure X10 device on ZoneAlarm... I hope in some guru can help us.
Thanks to all
dimiz
Posts: 17
Joined: Sat Oct 06, 2007 1:06 pm

Post by dimiz »

...No more news about ShareMemory Function? I have work around my problem but using the zmpkg solution is very brute force.. ;-) i dont like it..
Also every time the stop & restart to switch from ON to OFF profile take some long time... Some other suggest is appreciated..
Thanks so much
mikepont
Posts: 6
Joined: Mon Apr 07, 2008 9:28 am
Location: Brisbane Australia

Post by mikepont »

Hi Dimiz

Read your post and I'm having a similar problem (as I posted below) with latest version of ZM.

http://www.zoneminder.com/forums/viewtopic.php?t=11452

Did you ever get a resolution to this problem? I don't think many people are using X10 and so it doesn't get much attention on the forum

Regards,
Locked