11
Element
Tag:
<outlet>
Attribute:
id = “bank”
“bank” is the affected outlet bank number
Content
0 | 1
0 = outlet bank is OFF
1
=
outlet
bank
is
ON
Example:
<outlet id=”1”>0</outlet>
Outlet bank 1 is OFF
EVENTS
Event messages are sent autonomously from M4000-PRO when some change occurs within the device – they are not replies to a query.
Subscribing to Event Messages
After start-up, M4000-PRO will not send any event messages. To receive event messages a command to “subscribe” to events must be sent.
The event subscription command is enclosed within the XML declaration and <device> element and is as follows:
...<commands><eventmgr><subscribe uri=”ctrlsys:
//IPADDR:PORT”/></eventmgr>
</commands>
...
IPADDR
is the IP address and port number where the event messages should be sent. It may be a different IP address than the control system which sent the request.
PORT
is the UDP port number.
Only one IP address / port event subscription is allowed.
For example, to have event messages sent from a M4000-PRO with MAC address 10-65-A3-03-FF-FF to a control system at IP address 192.168.0.127 listening
on port 1726:
<?xml version=”1.0” ?><device class=”m4000” id=”1065a303ffff”><eventmgr><subscribe uri=”ctrlsys://192.168.0.127:1726”/></event-
mgr></device>
The unsubscribe command follows the same format
...<commands><eventmgr><unsubscribe uri=”ctrlsys://IPADDR:PORT”/></eventmgr></commands>
...
General Event Element Structure
All event messages are contained within an <event> element, which will contain a timestamp attribute, “time”, and an event ID attribute, “evtid”. The time attribute is
a UNIX timestamp, up to 10 decimal digit characters and represents the number of seconds that have passed since January 1st 1970 GMT. The evtid attribute is the
numeric ID value of the event message, starting from 0 after each device start-up.
A sample
event
element:
<event time=”1234567890” evtid=”123” subsid=”1”>…</event>
Event Messages:
Outlet State Change
An Outlet State Change event is posted when any of the outlet banks turn ON->OFF or OFF->ON.
Element
Tag:
<seq>
Attribute: None
Content
0 | 1 | 2
0 = sequence done/finished/complete
1
=
turn
on
sequence
initiated
2
=
turn
off
sequence
initiated
Example: <seq>0</seq>
Sequence
has
completed
Sequence Status
A Sequence Status event is posted when a power on or power off sequence is initiated or completed.
A subscriber ID, “subsid” is assigned to each event subscription.
A sample event message for outlet bank 2 switching ON:
…<event time=”1234567890” evtid=”123” subsid=”1”><outlet id=”2”>1</outlet></event></device>
Event messages will be repeated until an acknowledgement message is sent back to M4000-PRO, or after a timeout period of approximately 20 minutes. The acknowl-
edgement message must contain the same evtid and subsid as the event message.
The acknowledgement message syntax is:…<command><eventmgr><ack evtid=”123” subsid=”1”></eventmgr></command></device>