current cost xAP

9 replies [Last post]
percih70
Offline
Joined: 3 Jan 2011

 

Hello Bertt / Derek

I’m working on a project to log solar watts/meter – and post the results to Pachube via the HAH livebox. Just now I’m experimenting with several different sensors to see which gives the best tracking over the changing light levels, and to speed up the process I wanted to run multiple sensors in parallel –  I’ve been looking at extracting the channel 1,2,3 data from a TX unit paired as an additional sensor.

The XMl data looks good:

<msg><src>CC128-v1.29</src><dsb>00018</dsb><time>21:05:57</time><tmpr>19.3</tmpr><sensor>0</sensor><id>03402</id><type>1</type><ch1><watts>00363</watts></ch1></msg>

<msg><src>CC128-v1.29</src><dsb>00018</dsb><time>21:09:21</time><tmpr>19.4</tmpr><sensor>1</sensor><id>00759</id><type>1</type><ch1><watts>00367</watts></ch1><ch2><watts>00430</watts></ch2><ch3><watts>00411</watts></ch3></msg>

 

The 3 channels of data associated with sensor 1 seem to be sent from the CC128,

and my question is ................

can I point the existing current cost xAP to this channel data for sensor 1, and hence post the data to Pachube?

 

Regards

 

Harry

aivo
Offline
Tallinn, Estonia
Joined: 2 Mar 2011
Using plugboard

.. you probably could write small script that catches sensor 1 events and generates new, e.g with xAPBSC.light1 class for ch 1 etc.

These script-made events you now could log to Patchube, xAP source for them will be dbzoo.livebox.Plugboard.

PS. Suppose you were actually addressing Brett (not Bert ;) ?

Regards,
Aivo

percih70
Offline
Joined: 3 Jan 2011
The first thing to do is to read a little bit about the LUA....

cheers, I’ll do some reading on LUA and the plugboard - looks promising, though - I haven’t quite given up on "dbzoo.livebox.CurrentCost:sensor.1.ch1" etc...

Harry


 

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Sensors gt. 1 have but 1 channel

Harry I had a look at what you want to do yes the code only takes 1 channel per external sensor.  It was only coded that way as I never saw any other sensor except the house sensor (0) report more then 1 channel.

I guess the code could be modified to support ch1/ch2/ch3 for a sensor but it would change the endpoint somewhat breaking existing setups.   Stil a small price to pay perhaps.

Tell me how are you managing to get 3 channels on external sensor?

Brett

percih70
Offline
Joined: 3 Jan 2011
Sensor 1 with 3 channels

Thanks Bertt

 

I’ve paired a second “house transmitter unit” (the type with 3 clamp inputs) as sensor 1 on a CC128.

(The procedure is the same as for main house TX unit - but this time you select sensor 1 on the CC128 before pressing the down arrow to link it to the CC128, the main house sensor with its 3 sensors remains unharmed in the process so in theory you could set up all the sensors with 3 channels).

You seem to need the main house channel to be up and running first – else I couldn’t get the sensor channels to pair correctly.... but that might just be a prob this end...

Harry

 

percih70
Offline
Joined: 3 Jan 2011
where does the plugboard look for its scripts?

Q. does the plugboard still look to /etc/plugboard to run its scripts?

Im running on Build: 279.13/1.0

Ive dropped a test script into /etc/plugboard but its not running?


 

# xap-plugboard -d 9

[inf][init.c:116:discoverBroadcastNetwork] br0: address 192.168.55.35

[inf][init.c:128:discoverBroadcastNetwork] br0: netmask 255.255.255.0

[inf][init.c:135:discoverBroadcastNetwork] Autoconfig: xAP broadcasts on 192.168.55.255:3639

[ntc][init.c:52:discoverHub] Broadcast socket port 3639 in use

[inf][init.c:53:discoverHub] Assuming a hub is active

[ntc][init.c:62:discoverHub] Socket port 3640 in use

[ntc][init.c:62:discoverHub] Socket port 3641 in use

[ntc][init.c:62:discoverHub] Socket port 3642 in use

[ntc][init.c:62:discoverHub] Socket port 3643 in use

[inf][init.c:64:discoverHub] Discovered port 3644

[dbg][timeout.c:18:xapAddTimeoutAction] Add timeout. interval=60

[dbg][init.c:201:xapAddSocketListener] socket=5

Running...

[inf][tx.c:19:xapSend] send

xap-hbeat

{

v=12

hop=1

uid=FF00D800

class=xap-hbeat.alive

source=dbzoo.livebox.Plugboard

interval=60

port=3644

pid=192

}

Thanks

Harry

 

brett
Offline
Providence, United States
Joined: 9 Jan 2010
You're obviously not reading the documentation :)

In the new engine scripts must have filenames that end in Applet.lua -  so yourScriptApplet.lua would be its filename.

http://www.dbzoo.com/livebox/hah_plugboard_v2#writing_an_applet

BTW: I just finished re-writring the engine in pure LUA so I can ditch the C/LUA wrapper around my xaplib2 C library.  This makes the whole thing a wee bit smaller so free's up some valuable flash space.  This will be in the next beta release if/when I ever get my livebox recovered so I test it out.

Brett

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Multiple channels on a sensor

I posted a new beta with an vastly updated LUA engine - I also took a stab a fixing your multiple channels on a sensor issue.

It should report as sensor.1 which is ch1 as it does now.

The others channels will appear as sensor.1.2 (sensor 1 channel 2), and sensor.1.3

I didn't want to do sensor.1.1 as this will break existing programs and mostly this is the default everywhere.

Brett

aivo
Offline
Tallinn, Estonia
Joined: 2 Mar 2011
Trying 279.19/1.0

Some observations maybe of interest:

- in 1.0 can not open some pages (not found) on webinterface .. Automation: Configure, Currentcost, Pachube; Admin: Instance, Management

- %CPU for lua was visually (top) at 0 most of the time; peaking over 10 and more occasionally on 279.14/1.0; on 279.19/1.0 it sits around 5% most of the time, going up'n'down a bit and peaking over 10 as before

- lua memory usage (from top again) with present four applets was growing stable :( .. from 25-26% at evening say to 70% in the morning on .14; this appears to be fixed in .19 - looks to be staying :) on 29% since startup.

Regards,
Aivo

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Compilation issue

I"ve pushed 279.20 - for some reason there was a compilation problem.  I changed no code - I clear cleaned out the kloned webserver directory and made it again.

You CPU/Memory may be higher as this lua engine code not use my C libraries so if you write bad code it will leak much more severely as it now needs to use the LUA garbage collector.

/usr/share/lua/5.1/xap.lua is the new engine effectively.

Brett

Hardware Info