This simple piece of XML sets the gateway up to adjust the mimic brightness dependant on DayPhase.
DayPhase is a piece of base functionaality that splits the day into up to 8 segments, these are based around the user configured start times for Morning, Day, Evening and Night.
So first the Xml.
<eventInterfaces>
<eventInterface module='EventHandlers.HttpAction' name='HttpAction'>
<eventtype type="http://id.webbrick.co.uk/events/time/dayphaseext">
<eventsource source="time/dayphaseext" >
<event>
<params>
<!-- Unknown -->
<testEq name='dayphase' value='0' />
</params>
<!-- SM command takes Off Level, On Level, Fade Rate, 5V/12V -->
<url address="10.100.100.100" uri="/hid.spi?COM=SM16;63:" cmd="GET" />
</event>
<event>
<params>
<!-- Night:Dark -->
<testEq name='dayphase' value='1' />
</params>
<url address="10.100.100.100" uri="/hid.spi?COM=SM1;8:" cmd="GET" />
</event>
<event>
<params>
<!-- Night:Light -->
<testEq name='dayphase' value='2' />
</params>
<url address="10.100.100.100" uri="/hid.spi?COM=SM4;16:" cmd="GET" />
</event>
<event>
<params>
<!-- Morning:Dark -->
<testEq name='dayphase' value='3' />
</params>
<url address="10.100.100.100" uri="/hid.spi?COM=SM4;16:" cmd="GET" />
</event>
<event>
<params>
<!-- Morning:Light -->
<testEq name='dayphase' value='4' />
</params>
<url address="10.100.100.100" uri="/hid.spi?COM=SM8;32:" cmd="GET" />
</event>
<event>
<params>
<!-- Day:Dark -->
<testEq name='dayphase' value='5' />
</params>
<url address="10.100.100.100" uri="/hid.spi?COM=SM4;16:" cmd="GET" />
</event>
<event>
<params>
<!-- Day:Light -->
<testEq name='dayphase' value='6' />
</params>
<url address="10.100.100.100" uri="/hid.spi?COM=SM16;63:" cmd="GET" />
</event>
<event>
<params>
<!-- Evening:Dark -->
<testEq name='dayphase' value='7' />
</params>
<url address="10.100.100.100" uri="/hid.spi?COM=SM4;16:" cmd="GET" />
</event>
<event>
<params>
<!-- Evening:Light -->
<testEq name='dayphase' value='8' />
</params>
<url address="10.100.100.100" uri="/hid.spi?COM=SM8;32:" cmd="GET" />
</event>
</eventsource>
</eventtype>
</eventInterface>
</eventInterfaces>
+element: <eventInterfaces>
Each event despatch control file has a single top level container element called eventInterfaces, inside of which are 1 or more eventInterface elements.
element: <eventInterface>
An eventInterface element configures one instance of a named eventInterface, the configuration of an instance is private to itself. Most of the event interfaces can be loaded multiple times in the same configuration files or across multiple configuration files. A few can only be loaded once as they use dedicated resources or there is no point loading multiple times - these are typically listed in BaseHandlers.xml.
An event interface element lists two attributes that are used to dynamically load the event interface, these will be documented for each event interface. The dynamic loading means that it is possible to develop bespoke event interfaces and deploy without rebuilding the complete gateway. Each event interface element typically has one or more eventType elements, not typically but it is possible to have event interfaces that handle the configuration differently.
The sample above loads the event interface HttpAction, this event interface performs an HTTP request when it sees the configured event.
element: <eventtype>
Most event interface then lists one or more event types that it is interested in, this may be blank if it wants to see all event types and filter on the other things. The event log is an example of an event interface that listend to all events from all event sources (see BaseHandlers.xml).
The sample above listens for the event type "http://id.webbrick.co.uk/events/time/dayphaseext".
element: <eventsource>
Within the event type element the event interface lists one or more eventsource entries, these are the event source's that the interface it is interested in. It is possible again to put the empty string in here which means listen to all events of the named type.
The sample listens for time/dayphaseext.
element: <event>
The elements contained within the eventsource element tend to be more event interface dependant and reference should be made to the event interface documentation at. http://docs.webbrick.co.uk/eventinterfaces/EventInterfaces.html
In the case of the HttpAction each event source element contains one event element, within each of these is one or more uri elements.
element: <params>
Do selection based on day phase. See http://docs.webbrick.co.uk/events/time/index.html look for dayphaseext
element: <uri>
Each URI element has 3 attributes. These are address, uri and cmd. The address is the network address of the server to send the HTTP request to, this may be a dotted IP address or a hostname that can be resolved by the host platform. The uri is the full uri to access on the targetted server and cmd is the HTTP command verb to use.
In the sample we issue a DO7N command when we see lights/garage/on and a DO7F command when we see lights/garage/off.
Comment
This could be simplified to just changing on whether it is dark out or not.
