Scripting

Description

Queries re using the xap-plugboard component to script xAP action events.

Forums

A happy evening playing with the scheduler.  I found that www.cronmaker.com confusing since it seems to create 7 parameters and not five.

Ask it to for something at 7.01 each morning it gives 0 1 7 1/1 * ? * instead of 1 7 * * * which is what I think it should be - or at least works!

I found the quick reference at http://adminschoice.com/crontab-quick-reference was more suited to my simple brain.

Useful using the "bscmsg" at the # prompt but should it also work with "aliasmsg"? - if so I can't get it to work - and it did seem to work through

googlecal et al.

Either way its a nice new facility.

Regards

Kim 

Forums

Applogies as this is not a HAH specific question but I have spent far too long trying to get the answer to this and had no luck from other Linux forums.

All I want to do is use the cron scedhuler to write to a file located on the HAH (to reset my daily cumulative energy totals)

the command I want to use is
echo '0'>/etc/plugboard/BoilerRunTime

I have therefor added this to the Cron file as 1 0 * * * echo '0'>/etc/plugboard/BoilerRunTime

which doesnt work.

 I have also tried to put this in a file and chmod a+x and then run that file but cannot get this to work either. Anyone got any bright ideas where I am going wrong. I obviously am missing some fundamental knowledge still :(

 

Thanks

 

GArry

Forums

I already use the script which reads the rf ststes and keeps them on a reboot which is excellent. but heres my problem.

 

the rf is one way so if it's on it's on (but it might not be)

 

what would be nice is a script which analyzez the on/off script file and re-sends the relevant commands every XXseconds (5 minutes by default?) as the RF althougth much more stable sometimes the sockets do not respond to the command.

 

anyone else notice this?

 

i have both status and new lidl

 

Dean

Forums

I would like to be able to query my data more intelligently than i think pachube will currently allow. For example:

Show me the day I used the most electricity last week/month

Show me the coldest/hottest day last week/month

Show me sunrise/sunset each day for the last month (using light level from hahnode)

You get the picture :) I saw this asked elsewhere and the recommendation was to look at http://www.dbzoo.com/livebox/xap_cacti & /content/webserver-written-lua-serve-xa…

I have had a look and this seems like a great solution for Cacti as it connects directly, but not sure how to pull the data in from SQL / mySQL. I guess I might be able to use and schedule an SSIS package? Or possibly some form of curl/wget script?

Any suggestions?

Thanks!

Forums

In a blog post recently I suggested that it would be nice to have my hah collect not only data from my CurrentCost enviR (CC128) and WSN but also my LAN (read: Free/Total disk space on the fileserver, Data In/Out from my pfSense box etc). Hopefully with the intention of posting to pachube.

What do you think?

How would I best achieve this? (I imagine the devices I intend to poll support SNMP).

L

Forums

Well, I didn't think that I was thick until I started trying to use the HAH livebox. But having struggled my way to getting a system running trying to use Google calendar to schedule appliance switching with pretty limited success, I was looking forward to a simple scheduling system, which was what cron/tab appeared to be.

Unfortunately it appears that I really am too thick to work it out. In spite of reading the wiki several times, reading the Wikipedia items and reading the forum posts related to the beta firmware I am simply unable to understand what on earth I'm supposed to do with it.

If I issue the command "/usr/bin/bscmsg -t dbzoo.livebox.controller:rf.2 -s on" then the appropriate rf command is issued.

If I do anything with the command crontab like crontab 0 20 * * * /usr/bin/bscmsg -t dbzoo.livebox.controller:rf.2 -s then I get an "illegal option --t" response. I've tried other forms of the command which result in "can't open 'root' no such file or directory", I've created a file /etc/crontabs/crontab or /etc/crontabs/CRONTAB which contains the the same text string but nothing happens. I can't create, edit or list anything. I'm sure that I must be missing something which others find glaringly obvious but after 2 hours of mind numbing frustration I really am about to throw in the towel.

If anybody has an idiots guide rather than a wiki then perhaps some others may be grateful as well, but for now I'm going to lie down in a darkened room with a large bevarage!

Forums

Firstly, excellent work on the new scheduler Brett. Coupled with the google cal option this really does make this the perfect home heating controller(amongst a million other things!) As you know I found googlecal a bit twitchy and was always concerned about events not being carried out if my Internet drops out as it sometimes does. This fixes that but still allows scheduling on line if required.  That said I am struggling to set up the cron correctly.  Firstly I didn't have a /etc/cron folder so I created one.  I then put the bsc file (as described in another script) in there and chmod a+x'd it.  I altered my cron file to switch the rf.1 on but am not seeing any action. Xfx viewer also shows no xap from chron.  Am I right in thinking that I should be able to test the bsc script by simply putting the following command into the command line? /etc/cron/bsc -t dbzoo.livebox.controller:rf.1 -s on If so this just returns file not found.  I am on 296.4 firmware, any ideas Am I missing something obvious? Thanks As always Garry

Forums

I'm just starting out with the HAH and a couple of jeenodes.

I've got them setup with roomnode2 and rf12demo and can see data coming into the HAH from the remote device using microcom - 

 

 [RF12demo.7] A i1 g212 @ 433 MHz

Available commands:

  <nn> i     - set node ID (standard node ids are 1..26)
               (or enter an uppercase 'A'..'Z' to set id)
  <n> b      - set MHz band (4 = 433, 8 = 868, 9 = 915)
  <nnn> g    - set network group (RFM12 only allows 212, 0 = any)
  <n> c      - set collect mode (advanced, normally 0)
  t          - broadcast max-size test packet, with ack
  ...,<nn> a - send data packet to node <nn>, with ack
  ...,<nn> s - send data packet to node <nn>, no ack
  <n> l      - turn activity LED on PB1 on or off
  <n> q      - set quiet mode (1 = don't report bad packets)
Remote control commands:
  <hchi>,<hclo>,<addr>,<cmd> f     - FS20 command (868 MHz)
  <addr>,<dev>,<on> k              - KAKU command (433 MHz)
Current configuration:

 A i1 g212 @ 433 MHz
 ? 18 36 216 230 116 139 102 48 20 206 172 103 247 98 27 65 26 14 75 93 77
 ? 34 229 215 36 57 146 85 99 47 192 154 100 180 96 3 118 68 229 192 140 71
 ? 12 223 131 243 41 180 74 219 223 103 56 213 236 106 179 30 100 113 160 128 108
 ? 184 216 15 59 106 108 242 94 19 156 12 93 49 25 8 13 232 64 227 123 188

> 1q

OK 2 0 0 211 0

The remote device is configured as node 2 and I have added the following to /etc/plugboard/jeenodeApplet.lua
# cat jeenodeApplet.lua
--[[
    JeeNode to xAP Endpoint mapping
--]]

_DEBUG=1
module(...,package.seeall)

monitor = require("xap.jeenode").monitor
RoomNode = require("xap.roomnode").RoomNode
OutputNode = require("xap.outputnode").OutputNode

info={
   version="2.0", description="JeeNode"
}

       local jeemon={
       port="/dev/ttyUSB0",
       baud=57600,
       stop=1,
       databits=8,
       parity="none",
       flow="none"
}

-- Keyed by NODE ID
local nodes = {
   [2] = RoomNode{base="dbzoo.livebox.jeenode:attic", endpoints={temp=1,lobat=1,light=1}, ttl=900},
   [3] = RoomNode{base="dbzoo.livebox.jeenode:basement", endpoints={temp=1,lobat=1}, ttl=900},
   [4] = OutputNode{base="dbzoo.wombat.jeenode:bedroom",endpoints={p1="light",p2="heater",p3="amp",p4=0}},
}

function init()
   monitor(jeemon, nodes)
end
However, the messages I am receiving in xfx don't seem to contain the information received in the serial data -
xap-header
{
v=12
hop=1
uid=FF00D804
class=xAPBSC.info
source=dbzoo.livebox.jeenode:attic.temp
}
input.state
{
state=?
text=?
}
I've tried running xap-plugboard with the debug option -d 9 but it doesn't appear to be supported with v2? I've also tried increasing the debug value in the jeenodeApplet.lua file but again it doesn't seem to log any more than at level 1?
Can anyone help with this please? 
Many thanks,
Andy

 

Forums

I want to get started with the more intelligent stuff. So, I started with sample script to switch off the relay1 after its on for 30 secs., but I get this error:-

 

# cd /etc

# cd plugboard

# ls

relay1AutoOffApplet.lua

# lua relay1AutoOffApplet.lua

lua: relay1AutoOffApplet.lua:7: bad argument #1 to 'module' (string expected, got nil)

stack traceback:

        [C]: in function 'module'

        relay1AutoOffApplet.lua:7: in main chunk

        [C]: ?

I have checked the zap-livebox.ini and it shows that scripting is enabled
[plugboard]
enable=1
output of ps is :-
  PID USER       VSZ STAT COMMAND
    1 root      2256 S    init
    2 root         0 SW   [keventd]
    3 root         0 RWN  [ksoftirqd_CPU0]
    4 root         0 SW   [kswapd]
    5 root         0 SW   [bdflush]
    6 root         0 SW   [kupdated]
    7 root         0 SW   [mtdblockd]
    8 root         0 SW   [khubd]
   29 root         0 SWN  [jffs2_gcd_mtd2]
  107 root      1668 S    dropbear -p 22
  120 root      2240 S    inetd
  126 root      1028 S    /usr/bin/xap-hub -i br0
  129 root      3368 S    /usr/bin/xap-pachube -i br0
  130 root      1068 S    /usr/bin/xap-livebox -s /dev/ttyS0 -i br0
  139 root      5000 S    /usr/bin/kloned
  141 root      5012 S    /usr/bin/kloned
  142 root      2608 S    /usr/bin/xap-currentcost -s /dev/ttyUSB0 -i br0
  144 root      3628 S    /usr/bin/xap-twitter -i br0
  147 root      3712 S    lua /etc_ro_fs/plugboard/plugboard.lua
  157 root      5012 S    /usr/bin/kloned
  161 root      1740 S    dropbear -p 22
  162 root      2260 S    -ash
  187 root      1740 S    dropbear -p 22
  188 root      2276 S    -ash
  198 root      1456 S    /usr/bin/iServer -i br0
  199 root      1456 S    /usr/bin/iServer -i br0
  210 root      2244 R    ps
What am I missing?  - I looked at the wiki, but it seems to be for an older version in terms of where the files need to be etc.
I am running build 289/1.0
Any pointers gratefully received
Alan

 

Forums

Hi,

I was wondering if someone could offer me yet more help?.

I am trying to do the simple LED arduino script discussed in the wiki to test serial xap transmission to my arduino Deumilanova.

I have plugged it in and got the port address as tty/usb1 port

I have set up the bridge as per the wiki with the above address.

however, I do not see any xap messages in XFX viewer and cannot control the LED with a xAPBSC command.

If I log in to microcom I can see the heartbeat message being sent via serial but thay do not appear in xfx viewer, does this point to a bridge issue? (see below)

any advice of pointers as to what I am doing wrong would be great.

 

Thanks,

Garry