current cost xAP
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
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
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
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
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
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
.. 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