The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: Advice of best xAP structure for OWL Electricity Monitor



--------------030908090203040107010402
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

One other thing worth mentioning ..

If you presented your KWHr as a BSC level device then it can easily be
recognised and imported as a numeric value into other xAP aware software
. Perhaps HomeSeer  could test and take action based on a certain
consumption or display software could present it as a gauge or slider.
Something like OPNMax could log it to a database and offer graphing.

As levels must be positive and not include a decimal scale the value to
watt/hours and set a maximum of  50 KWHrs or whatever is appropriate for
that circuit.  If you must have that extra information in the same
message insert it as a data= parameter although it really belongs in
another schema.   You could have this  an additional endpoint to your
text= 'stream' one if you wish.

...
class=xAPBSC.event
...
}
input.state
{
state=on
level=1180/50000
data=DC1F447B1F41F4083
displaytext= 1.18 KWh (0.5 Amps)
}


K

On 02/04/2011 00:57, Kevin Hawkins wrote:
>
> Hi Marcus....
>
>     First of all how and what you present is really your choice so the
> encoded data and displaytext= is fine if that's how you want to do
> it.   You could of course split it across several endpoints as well if
> you prefer.
>
>    Although not very tidy you could add your own parameters within the
> BSC message should you wish , perhaps presenting your extra
> information as data= or even a series of parameters, or as you say you
> can create your own schema to present more info in one message. The
> latter is perhaps better.
>
>     I wouldn't worry too much about the packet length as you have a
> lot of headway in a UDP packet, you can even delimit decimal values if
> you wish  text=1,2,3,45,666  but I'm thinking it maybe better to
> present each as an individual parameter  in the body.
>
> Amps=1.23
> Volts=235
> etc
>
>
>    One thing you should change for the BSC schema  is to create an
> endpoint (sub address) and don't use the main application address
> (which ends in 00).  So change the end digit of the UID and create a
> sub address .. something like..
>
> UID=FF111101
> source=MJW.U-Mon.MW_Laptop:KWHr
>
>   Now if you later want to add more info presented in different BSC
> messages you can just create more sub addresses and change the UID.
>
>   Remember BSC is a two way schema so you must receive and respond
> (with a xapBSC.info) to a xAPBSC.query message targeted at your
> endpoint (and any wildcarded variant of it's address).
>
>   I note there is no hop= parameter in the header (it's mandatory) ,
> but I'm thinking that might just be an omission in the posting
>
>   Using your own schema to create a way of querying a database is
> absolutely allowable - you can use xAP just as you wish.  Actually
> this same requirement comes up quite frequently in weather
> applications - high/low figures over minute/hour/day/month/year
> etc.    Before you ask ...there is no standard schema for this query
> approach.
>
>   You could also create several BSC reporting end nodes for the same
> info (KWHr) but over the different periods you wish to use eg a 2
> minute node with the peak or average consumption.  A little untidy but
> workable.
>
> source=MJW.U-Mon.MW_Laptop:KWHr.2min.peak
> source=MJW.U-Mon.MW_Laptop:KWHr.2min.average
> source=MJW.U-Mon.MW_Laptop:KWHr.30min.peak
> source=MJW.U-Mon.MW_Laptop:KWHr.30min.average
>
>  I'll add MJW to the list of xAP vendor ID's.
>
>
>    Cheers Kevin
>
>  On 01/04/2011 16:32, Marcus Warrington wrote:
>
>> I've just knocked up a little program to extract the current
>> electricity usage (KWh/Amps) from a USB OWL Connect I purchased on
Ebay.
>>
>> I ended up paying about £7 for the OWL Connect receiver , but
>> apparently Tesco were selling these off a few months ago for less
>> than a fiver !
>>
>> I've successfully retrieved the usage information in real time
(every
>> 6 seconds) but am unsure of the best way or presenting this onto
the
>> xAP network. Currently the program is obtaining the information
and
>> if its changed then sending the usage value in a
"standard" BSC event
>> format. If nothing changed for 60seconds then its sends an info
>> message. I'm using the xAP dll from the mi4 website to handle the
xAP
>> side of things.
>>
>> At the moment I'm encoding the usage as a "stream" in
Hex format in
>> the "text" key, and presenting it in a human readable
form in the
>> displaytext key.
>>
>> e.g.
>>
>> {
>>     v=12
>>    uid=FF111100
>>    class=xAPBSC.event
>>    source=MJW.U-Mon.MW_Laptop
>> }
>> input.state
>> {
>>   State=on
>>    text=DC1F447B1F41F4083
>>   displaytext= 1.18 KWh (0.5 Amps)
>> }
>>
>> The text encoding format I've chosen is hex encoded to keep the
down
>> the size of the packet and consists of;
>>
>> 2 chars for supply voltage  (DC=220)
>>
>> 3 chars for Current usage in Amps (1F4 = 500 = /100 = .5amps)
>>
>> From these 2 pieces of information the client can calculate the
KWh
>> usage.
>>
>> The next 3 chars are for the currently defined electricity cost
i.e.
>> 47B = 1147 = 11.47pence per KWh
>>
>> The next 3 are the minimum Amps used figure (still not sure
exactly
>> what the OWL is actually reporting with this)
>>
>> The next 3 are the maximum Amps used figure (still not sure
exactly
>> what the OWL is actually reporting with this)
>>
>> The next 2 chars are the Green House Gas figure (008)
>>
>> And the final single character represents the trend,0=unknown,
>> 1=downward,2=neutral,3=upward
>>
>> I'm also thinking of implementing a custom packet structure
instead
>> of BSC that will provide more information, such as the last two
>> minutes worth of figures or even a query structure to allow a date
>> range selection to be return (maybe then used for graphing etc?).
I'm
>> not sure if this would be considered an abuse the xAP protocol,
since
>> its actually being used simply to transferring data from a
database.
>>
>> So the question is.... is what I'm doing OK or does anyone think I
>> should be doing it differently either for efficiency or best
practice
>> reasons ?
>>
>> I'm slightly unsure of the hex encoding since it would only be
>> slightly longer to encode in decimal but would be much easier for
the
>> client to handle (i.e. no Hex to decimal conversion)
>>
>> Also do I need to register "MJW" as an official xAP
vendor name?
>>
>> Regards
>>
>> *Marcus *
>>
>
>


--------------030908090203040107010402
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit





<head>

<style type="text/css">
<!--

/* start of attachment style */
.ygrp-photo-title{
clear: both;
font-size: smaller;
height: 15px;
overflow: hidden;
text-align: center;
width: 75px;
}
div.ygrp-photo{
background-position: center;
background-repeat: no-repeat;
background-color: white;
border: 1px solid black;
height: 62px;
width: 62px;
}

div.photo-title
a,
div.photo-title a:active,
div.photo-title a:hover,
div.photo-title a:visited {
text-decoration: none;
}

div.attach-table div.attach-row {
clear: both;
}

div.attach-table div.attach-row div {
float: left;
/* margin: 2px;*/
}

p {
clear: both;
padding: 15px 0 3px 0;
overflow: hidden;
}

div.ygrp-file {
width: 30px;
valign: middle;
}
div.attach-table div.attach-row div div a {
text-decoration: none;
}

div.attach-table div.attach-row div div span {
font-weight: normal;
}

div.ygrp-file-title {
font-weight: bold;
}
/* end of attachment style */
-->
</style>
</head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">


<!-- **begin egp html banner** -->

<br><br>

<!-- **end egp html banner** -->



One other thing worth mentioning ..<br>
<br>
If you presented your KWHr as a BSC level device then it can easily
be recognised and imported as a numeric value into other xAP aware
software . Perhaps HomeSeer&nbsp; could test and take action based on a
certain consumption or display software could present it as a gauge
or slider.&nbsp; Something like OPNMax could log it to a database and
offer graphing. <br>
<br>
As levels must be positive and not include a decimal scale the value
to watt/hours and set a maximum of&nbsp; 50 KWHrs or whatever is
appropriate for that circuit.&nbsp; If you must have that extra
information in the same message insert it as a data= parameter
although it really belongs in another schema.&nbsp;&nbsp; You could
have this&nbsp;
an additional endpoint to your text= 'stream' one if you wish.<br>
<br>
...<br>
class=xAPBSC.event<br>
...<br>
}<br>
input.state<br>
{<span style="font-size: 12pt;"><br>
&nbsp;&nbsp;&nbsp; state=on</span><br>
&nbsp;&nbsp;&nbsp; level=1180/50000<span
style="font-size: 12pt;"><br>
&nbsp;&nbsp;&nbsp; data=DC1F447B1F41F4083<br>
&nbsp;&nbsp;&nbsp; displaytext= 1.18 KWh (0.5
Amps)</span><br>
}<br>
<br>
<br>
&nbsp;&nbsp; K<br>
<br>
On 02/04/2011 00:57, Kevin Hawkins wrote:
<blockquote cite="mid:4D966658.3070308@xxxxxxx"
type="cite">
<span style="display: none;">&nbsp;</span>

<div id="ygrp-text">
<p> Hi Marcus.... <br>
<br>
&nbsp;&nbsp;&nbsp; First of all how and what you present is
really your
choice so the encoded data and displaytext= is fine if
that's how you want to do it.&nbsp;&nbsp; You could of course split
it across several endpoints as well if you prefer.<br>
<br>
&nbsp;&nbsp; Although not very tidy you could add your own
parameters within the BSC message should you wish ,
perhaps presenting your extra information as data= or even
a series of parameters, or as you say you can create your
own schema to present more info in one message. The latter
is perhaps better.<br>
<br>
&nbsp;&nbsp;&nbsp; I wouldn't worry too much about the packet
length as
you have a lot of headway in a UDP packet, you can even
delimit decimal values if you wish&nbsp; text=1,2,3,45,666&nbsp;
but
I'm thinking it maybe better to present each as an
individual parameter&nbsp; in the body.<br>
<br>
Amps=1.23<br>
Volts=235<br>
etc<br>
<br>
<br>
&nbsp;&nbsp; One thing you should change for the BSC
schema&nbsp; is to
create an endpoint (sub address) and don't use the main
application address (which ends in 00).&nbsp; So change the end
digit of the UID and create a sub address .. something
like..<br>
<br>
<span style="font-size: 12pt;">UID=FF111101<br>
source=MJW.U-Mon.MW_Laptop:KWHr<br>
<br>
&nbsp; Now if you later want to add more info presented in
different BSC messages you can just create more sub
addresses and change the UID.<br>
<br>
&nbsp; Remember BSC is a two way schema so you must receive
and respond (with a xapBSC.info) to a xAPBSC.query
message targeted at your endpoint (and any wildcarded
variant of it's address).<br>
<br>
&nbsp; I note there is no hop= parameter in the header (it's
mandatory) ,&nbsp; but I'm thinking that might just be an
omission in the posting<br>
<br>
&nbsp; Using your own schema to create a way of querying a
database is absolutely allowable - you can use xAP just
as you wish.&nbsp; Actually this same requirement comes up
quite frequently in weather applications - high/low
figures over minute/hour/day/month/year etc.&nbsp;&nbsp;&nbsp;
Before
you ask ...there is no standard schema for this query
approach.&nbsp;&nbsp; <br>
<br>
&nbsp; You could also create several BSC reporting end nodes
for the same info (KWHr) but over the different periods
you wish to use eg a 2 minute node with the peak or
average consumption.&nbsp; A little untidy but workable.<br>
<br>
</span><span style="font-size:
12pt;">source=MJW.U-Mon.MW_Laptop:KWHr.2min.peak<br>
</span><span style="font-size:
12pt;">source=MJW.U-Mon.MW_Laptop:KWHr.2min.</span>average<br>
<span style="font-size:
12pt;">source=MJW.U-Mon.MW_Laptop:KWHr.30min.peak<br>
</span><span style="font-size:
12pt;">source=MJW.U-Mon.MW_Laptop:KWHr.30min.</span>average<br>
<span style="font-size: 12pt;"><br>
&nbsp;I'll add MJW to the list of xAP vendor ID's.<br>
<br>
<br>
&nbsp;&nbsp; Cheers Kevin<br>
<br>
</span>&nbsp;On 01/04/2011 16:32, Marcus Warrington wrote:
</p>
<blockquote
cite="mid:38DB8F60848A594CBF1B5BE0732099781B173C52@xxxxxxx"
type="cite"> <span>&nbsp;</span>
<div id="ygrp-text">
<p> </p>
<div class="WordSection1">
<p class="MsoNormal"><span>I&#8217;ve just
knocked up a
little program to extract the current electricity
usage (KWh/Amps) from a USB OWL Connect I
purchased on Ebay.<o></o></span></p>
<p class="MsoNormal"><span>I ended up paying about
&pound;7
for the OWL Connect receiver , but apparently
Tesco were selling these off a few months ago for
less than a fiver !<o></o></span></p>
<p
class="MsoNormal"><span><o>&nbsp;</o></span></p>
<p class="MsoNormal"><span>I&#8217;ve
successfully retrieved
the usage information in real time (every 6
seconds) but am unsure of the best way or
presenting this onto the xAP network. Currently
the program is obtaining the information and if
its changed then sending the usage value in a
&#8220;standard&#8221; BSC event format. If nothing changed
for 60seconds then its sends an info message. I&#8217;m
using the xAP dll from the mi4 website to handle
the xAP side of things.<o></o></span></p>
<p
class="MsoNormal"><span><o>&nbsp;</o></span></p>
<p class="MsoNormal"><span>At the moment
I&#8217;m encoding
the usage as a &#8220;stream&#8221; in Hex format in the
&#8220;text&#8221; key, and presenting it in a human readable
form in the displaytext key.<o></o></span></p>
<p
class="MsoNormal"><span><o>&nbsp;</o></span></p>
<p
class="MsoNormal"><span>e.g.<o></o></span></p>
<p
class="MsoNormal"><span><o>&nbsp;</o></span></p>
<p class="MsoNormal"> <span style="font-size:
12pt;">{<br>
&nbsp;&nbsp; &nbsp;v=12 <br>
&nbsp;&nbsp;&nbsp;uid=FF111100 <br>
&nbsp;&nbsp;&nbsp;class=xAPBSC.event <br>
&nbsp;&nbsp;&nbsp;source=MJW.U-Mon.MW_Laptop <br>
} <br>
input.state<br>
{<br>
</span><span style="font-size:
12pt;">&nbsp;&nbsp;State=on<br>
&nbsp; &nbsp;text=DC1F447B1F41F4083<br>
&nbsp; displaytext= 1.18 KWh (0.5 Amps)<br>
} <br>
</span><span><br>
The text encoding format I&#8217;ve chosen is hex
encoded to keep the down the size of the packet
and consists of;<br>
<br>
<o></o></span></p>
<p class="MsoNormal"><span>2 chars for supply voltage
&nbsp;(DC=220)<o></o></span></p>
<p class="MsoNormal"><span>3 chars for Current usage
in Amps (1F4 = 500 = /100 = .5amps)<br>
<br>
<o></o></span></p>
<p class="MsoNormal"><span>From these 2 pieces of
information the client can calculate the KWh
usage.<br>
<br>
The next 3 chars are for the currently defined
electricity cost i.e. 47B = 1147 = 11.47pence per
KWh<o></o></span></p>
<p class="MsoNormal"><span>The next 3 are the minimum
Amps used figure (still not sure exactly what the
OWL is actually reporting with
this)<o></o></span></p>
<p class="MsoNormal"><span>The next 3 are the maximum
Amps used figure (still not sure exactly what the
OWL is actually reporting with
this)<o></o></span></p>
<p class="MsoNormal"><span>The next 2 chars are the
Green House Gas figure (008)<o></o></span></p>
<p class="MsoNormal"><span>And the final single
character represents the trend,0=unknown,
1=downward,2=neutral,3=upward<o></o></span></p>
<p
class="MsoNormal"><span><o>&nbsp;</o></span></p>
<p class="MsoNormal"><span>I&#8217;m also
thinking of
implementing a custom packet structure instead of
BSC that will provide more information, such as
the last two minutes worth of figures or even a
query structure to allow a date range selection to
be return (maybe then used for graphing etc?). I&#8217;m
not sure if this would be considered an abuse the
xAP protocol, since its actually being used simply
to transferring data from a
database.<o></o></span></p>
<p
class="MsoNormal"><span><o>&nbsp;</o></span></p>
<p class="MsoNormal"><span>So the question
is&#8230;. is
what I&#8217;m doing OK or does anyone think I should be
doing it differently either for efficiency or best
practice reasons ?<o></o></span></p>
<p class="MsoNormal"><span>I&#8217;m slightly
unsure of the
hex encoding since it would only be slightly
longer to encode in decimal but would be much
easier for the client to handle (i.e. no Hex to
decimal conversion)<br>
<br>
<o></o></span></p>
<p class="MsoNormal"><span>Also do I need to register
&#8220;MJW&#8221; as an official xAP vendor
name?<o></o></span></p>
<p
class="MsoNormal"><span><o>&nbsp;</o></span></p>
<p
class="MsoNormal"><span><o>&nbsp;</o></span></p>
<p
class="MsoNormal"><span>Regards<o></o></span></p>
<p class="MsoNormal"><span
lang="EN-US"><o>&nbsp;</o></span></p>
<p class="MsoNormal"><b><span
style="font-size: 10pt;
color: rgb(84, 141, 212);">Marcus
</span></b><o></o></p>
<p
class="MsoNormal"><o>&nbsp;</o></p>
</div>
</div>
<!-- end group email --> </blockquote>
<br>
</div>


<!-- end group email -->
</blockquote>
<br>




<!-- **begin egp html banner** -->

<br>



<br>

<!-- **end egp html banner** -->


<div width="1" style="color: white; clear:
both;"/>__._,_.___</div>

<!-- Start Recommendations -->
<!-- End Recommendations -->



<!-- **begin egp html banner** -->

<img src="http://geo.yahoo.com/serv?s=97476590/grpId=9674343/grpspId=1705007709/msgId=4723/stime=1301704208";
width="1" height="1"> <br>

<!-- **end egp html banner** -->


<!-- **begin egp html banner** -->

<br>
<div style="font-family: verdana; font-size: 77%; border-top: 1px
solid #666; padding: 5px 0;" >
Your email settings: Individual EmailTraditional <br>
<a href="http://groups.yahoo.com/group/xap_automation/join;_ylc=X3oDMTJmdDRkdWlzBF9TAzk3NDc2NTkwBGdycElkAzk2NzQzNDMEZ3Jwc3BJZAMxNzA1MDA3NzA5BHNlYwNmdHIEc2xrA3N0bmdzBHN0aW1lAzEzMDE3MDQyMDg-";>Change
settings via the Web</a> (Yahoo! ID required) <br>
Change settings via email: <a href="mailto:xap_automation-digest@xxxxxxx?subject=Email
Delivery: Digest">Switch delivery to Daily Digest</a>  <a
href = "mailto:xap_automation-fullfeatured@xxxxxxx?subject=Change
Delivery Format: Fully Featured">Switch to Fully Featured</a>
<br>
<a href="http://groups.yahoo.com/group/xap_automation;_ylc=X3oDMTJkZDc3M2xhBF9TAzk3NDc2NTkwBGdycElkAzk2NzQzNDMEZ3Jwc3BJZAMxNzA1MDA3NzA5BHNlYwNmdHIEc2xrA2hwZgRzdGltZQMxMzAxNzA0MjA4";>
Visit Your Group
</a>
<a href="http://docs.yahoo.com/info/terms/";>
Yahoo! Groups Terms of Use
</a>
<a href="mailto:xap_automation-unsubscribe@xxxxxxx?subject=Unsubscribe";>
Unsubscribe
</a>
<br>
</div>
<br>

<!-- **end egp html banner** -->


<div style="color: white; clear:
both;"/>__,_._,___</div>
</body>
</html>

--------------030908090203040107010402--

xAP_Automation Main Index | xAP_Automation Thread Index | xAP_Automation Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.