Print temperature on Images?
-
- Posts: 31
- Joined: Tue May 01, 2007 4:19 pm
Print temperature on Images?
With the timestamp setting, it seems you cannot print anything dynamically loaded from an external program to the Monitor image. Is there another way to do it?
I've read about zmtrigger.pl - that it could probably be done with it. But nobody seems to know about this according to my last post:
http://www.zoneminder.com/forums/viewto ... highlight=
Also, updating the MySQL timestamp entry seems to do nothing to the current image - the timestamp entry has to be cached somewhere...?
Thanks for any hints
I've read about zmtrigger.pl - that it could probably be done with it. But nobody seems to know about this according to my last post:
http://www.zoneminder.com/forums/viewto ... highlight=
Also, updating the MySQL timestamp entry seems to do nothing to the current image - the timestamp entry has to be cached somewhere...?
Thanks for any hints
-
- Posts: 31
- Joined: Tue May 01, 2007 4:19 pm
Has anyone read the perfect description of zmtrigger?
At http://www.zoneminder.com/wiki/index.ph ... Components you can read:
http://www.zoneminder.com/wiki/index.ph ... estamp_Tab
At http://www.zoneminder.com/wiki/index.ph ... Components you can read:
andzmtrigger.pl
This is an optional script that is a more generic solution to external triggering of alarms. It can handle external connections via either internet socket, unix socket or file/device interfaces. You can either use it ‘as is’ if you can interface with the existing format, or override connections and channels to customise it to your needs. The format of triggers used by zmtrigger.pl is as follows "<id>|<action>|<score>|<cause>|<text>|<showtext>" where
* 'id' is the id number or name of the ZM monitor
* 'action' is 'on', 'off', 'cancel' or ‘show’ where 'on' forces an alarm condition on, 'off' forces an alarm condition off and 'cancel' negates the previous 'on' or 'off'. The ‘show’ action merely updates some auxiliary text which can optionally be displayed in the images captured by the monitor. Ordinarily you would use 'on' and 'cancel', 'off' would tend to be used to suppress motion based events. Additionally 'on' and 'off' can take an additional time offset, e.g. on+20 which automatically 'cancel's the previous action after that number of seconds.
* 'score' is the score given to the alarm, usually to indicate it's importance. For 'on' triggers it should be non-zero, otherwise it should be zero.
* 'cause' is a 32 char max string indicating the reason for, or source of the alarm e.g. 'Relay 1 open'. This is saved in the ‘Cause’ field of the event. Ignored for 'off' or 'cancel' messages
* 'text' is a 256 char max additional info field, which is saved in the ‘Description’ field of an event. Ignored for 'off' or 'cancel' messages.
* 'showtext' is up to 32 characters of text that can be displayed in the timestamp that is added to images. The ‘show’ action is designed to update this text without affecting alarms but the text is updated, if present, for any of the actions. This is designed to allow external input to appear on the images captured, for instance temperature or personnel identity etc.
Note that multiple messages can be sent at once and should be LF or CRLF delimited. This script is not necessarily intended to be a solution in itself, but is intended to be used as ‘glue’ to help ZoneMinder interface with other systems. It will almost certainly require some customisation before you can make any use of it. If all you want to do is generate alarms from external sources then using the ZoneMinder::SharedMem perl module is likely to be easier.
http://www.zoneminder.com/wiki/index.ph ... estamp_Tab
So...it is very easy to add dinamically a text on the timestamp over the image. Interface with zmtrigger.pl your external program and send a series of "<id>|show||||<showtext>" to add your own text over the image. Of course, add the %Q token in your monitor timestamp settings.Timestamp Label Format
This relates to the timestamp that is applied to each frame. It is a ‘strftime’ style string with a few extra tokens. You can add %f to add the decimal hundredths of a second to the frame timestamp, so %H:%M:%S.%f will output time like 10:45:37.45. You can also use %N for the name of the monitor and %Q which will be filled by any of the ‘show text’ detailed in the zmtriggers.pl section.
-
- Posts: 31
- Joined: Tue May 01, 2007 4:19 pm
That's why I mentioned zmtrigger.pl. But can you also describe how to "interface with zmtrigger.pl"? I can't see another description of zmtrigger.pl than what you posted, I also mentioned this one in my old post.Normando wrote:So...it is very easy to add dinamically a text on the timestamp over the image. Interface with zmtrigger.pl your external program and send a series of "<id>|show||||<showtext>" to add your own text over the image. Of course, add the %Q token in your monitor timestamp settings.
Do I just start zmtrigger.pl on command line and enter "1|show||||temp: 24C"? At least this doesn't work... Where you got this syntax from anyway? Thanks a lot for further help!
1- Comment those channels you will not use. In my case I only use port 6802 to control zmtrigger.pl, so comment the rest of connection in zmtrigger.pl
2- Enable triggers in options and restart zm
3- Send the command to the port 6802. You can make a script in php to access the socket in that port or send directly with your external app. I have write my own php script:
4- Add the token %Q at the end of timestamp string in your monitor settings, or where you want.
5- Change the monitor function to NoDect, MoCord or MoDect. If you want more functions to use external trigger look at http://www.zoneminder.com/forums/viewtopic.php?t=12926
6- Send the command. In my case because script, I send via URL:
in your case
Reply the results
Code: Select all
my @connections;
push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan1", channel=>ZoneMinder::Trigger::Channel::Inet->new( port=>6802 ), mode=>"rw" ) );
#push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan2", channel=>ZoneMinder::Trigger::Channel::Unix->new( path=>'/tmp/test.sock' ), mode=>"rw" ) );
#push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan3", channel=>ZoneMinder::Trigger::Channel::File->new( path=>'/tmp/zmtrigger.out' ), mode=>"w" ) );
#push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan4", channel=>ZoneMinder::Trigger::Channel::Serial->new( path=>'/dev/ttyS0' ), mode=>"rw" ) );
Code: Select all
OPT_TRIGGERS
Code: Select all
$cfgServer = "localhost";
$cfgPort = 6802;
$cfgTimeOut = 10;
if ($extTrigger) {
// open a socket
if(!$cfgTimeOut) {
// without timeout
@$conn_handle = fsockopen($cfgServer, $cfgPort);
}else{
// with timeout
@$conn_handle = fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut);
}
if(!$conn_handle) {
// echo "Connexion failed ";
exit();
}else{
// echo "Connected ";
fputs($conn_handle, $extTrigger);
}
// close connexion
fclose($conn_handle);
}
5- Change the monitor function to NoDect, MoCord or MoDect. If you want more functions to use external trigger look at http://www.zoneminder.com/forums/viewtopic.php?t=12926
6- Send the command. In my case because script, I send via URL:
Code: Select all
http://myserver/zm/myscript.php?extTrigger=<id>|<action>|<score>|<cause>|<text>|<showtex>
Code: Select all
http://myserver/zm/myscript.php?extTrigger=1|show||||your_text
Reply the results
Last edited by Normando on Wed Aug 12, 2009 10:49 pm, edited 1 time in total.
-
- Posts: 31
- Joined: Tue May 01, 2007 4:19 pm
Thanks Cordel for your gratitude. Because my english is very little, I don't know If I undertand what you said about the work. Are you saying if I want to add this to the wiki? If yes, I reply yes, but I have no access to the wikicordel wrote:Agreed, Thx Normando for a great example. Another feature that should be better defined in the Wiki LOL, At least this one is there. Let me know if you feel the inclination to work it, else I add something a bit down the road.
Regards
Normando
Edit: upsss, sorry, I have access to the wiki. If you want I will post this ASAP
-
- Posts: 31
- Joined: Tue May 01, 2007 4:19 pm
Thanks for posting this to the Wiki Normando.
Maybe you can include my little hint for people who dont have PHP (or I can do it if you want me to).
You know you can also send the commands via telnet:
For this purpose, I created this script:
Create this script "script.sh" (executable) and enter this on the console:
./script.sh '1|show||||18' | telnet
to send a command.
Easy
Maybe you can include my little hint for people who dont have PHP (or I can do it if you want me to).
You know you can also send the commands via telnet:
Code: Select all
telnet localhost 6802
1|show||||test
Code: Select all
#!/bin/sh
# ./script.sh | telnet
echo 'open localhost 6802'
sleep 1
echo $1
sleep 1
echo 'quit'
./script.sh '1|show||||18' | telnet
to send a command.
Easy
Actually Normandos example is fine and more appropriate. It's better kept generic so that it applies to and is readable by more people. It's then up to those people to tailor it to their specific needs. Maybe add another section for different script languages. It should be just to aid in understanding how it works. If you get to specific then it tends to confuse some. It's about the API, not how to do a certain thing.
We will be going though the wiki fairly shortly and trying to make it all generic in the documentation, as distro and purpose directed stuff should be under more specific headings.
We will be going though the wiki fairly shortly and trying to make it all generic in the documentation, as distro and purpose directed stuff should be under more specific headings.
Ok.. I'm missing something here.
- I've edited zm_trigger.pl and commented out the other connection methods.
- I've selected ZM_OPT_TRIGGERS in options and restarted ZM
- I've added the %Q to my #4 monitor timestamp
- I've created a .php just like yours (Didn't give any errors or work)
- I've created a perl script to write to the socket and it also didn't work.
- The socket is open
- zm_trigger.pl is running
- I've tried just about all monitor states
- my URL and script syntax seem correct
http://<myserver>/zm/zm_trigger_temp.php?extTrigger=4|show||||123
root@system-z:~# ./trigger_sock.pl 4 123
4|show||||123
What am I missing?
- I've edited zm_trigger.pl and commented out the other connection methods.
- I've selected ZM_OPT_TRIGGERS in options and restarted ZM
- I've added the %Q to my #4 monitor timestamp
- I've created a .php just like yours (Didn't give any errors or work)
- I've created a perl script to write to the socket and it also didn't work.
- The socket is open
- zm_trigger.pl is running
- I've tried just about all monitor states
- my URL and script syntax seem correct
http://<myserver>/zm/zm_trigger_temp.php?extTrigger=4|show||||123
root@system-z:~# ./trigger_sock.pl 4 123
4|show||||123
What am I missing?
MRD