Cron guidance

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.

Member for

16 years 10 months

brett

14 years 11 months ago

Well I just pushed up 296.5 - as this is a beta things will change rapidily as you try to catch up and figure out what I'm up to.  What I say in old beta may not always apply to new ones.  It will be like this until I stabilize and release 297 :)

You will now need to enable cron via the ADMIN>Services TAB its not on automatically as of 296.5

Creating /etc/cron/bsc is not necessary as its now built in as /usr/bin/bscmsg.  Did you create /etc/cron/bsc btw?

A sample crontab might look like.  On at 7:00am and Off an 7:01am

0 7 * * * bscmsg -t dbzoo.livebox.controller:rf.1 -s on
1 7 * * * bscmsg -t dbzoo.livebox.controller:rf.1 -s off

ALSO as bscmsg is a built-in command you can run it from the command line to test that you have got the correct syntax before putting this same command line string into a crontab.

# bscmsg
bscmsg:missing required parameter: t

  Various flags and option types
    -t (string)   xAPBSC Target
    -s (onoff)    xAPBSC State
    -x            xAPBSC Text
    -l            xAPBSC Level
#

Brett

Member for

15 years 7 months

garrydwilms

14 years 11 months ago

thanks Brett, that clears things up.

RF control now working from command line using bscmsg. will play with scheduling from cron tomorrow.

cheers

garry

Member for

15 years 7 months

garrydwilms

14 years 11 months ago

This now works a treat, Thanks.

If I could be cheeky though, how easy would it be to alter the bscmsg to allow alias style commands. e.g. bscmsg -a rf 1 on

i think this may simplify the commands in cron and also from a selfish point of view, I use the alias function widely for thermostat setting and heating boosting, etc.

I have tried modding the file myself but the usr/bin dir is read only.

 

Thanks,

 

Garry.

Member for

16 years 10 months

brett

14 years 11 months ago

Of course you can mod the script yourself just copy it out of /usr/bin to somewhere that has write access and get your crontab to run that script instead.  This is the whole idea of have a script based scheduling engine.  For example:

0 7 * * * /root/aliasmsg "rf 1 on"

I would not add a "-a" option to /usr/bin/bscmsg as what you want to send out is not actually a xAPBSC.cmd class so it's a bit of a bastardisation of this script.   You can however create your own scripts to do what every you like.

I can add an aliasmsg script that emits an ALIAS class message as a helper this might be useful.  It would work something like this.

aliasmsg "rf 1 on"

You would need quotes so that the contents is all processed as a single argument.

The entire aliasmsg script is reproduced here. I'll add this into my next beta drop.

#!/usr/bin/lua
lapp = require("pl.lapp")
local args = lapp
[[
Various flags and option types
<alias> (string) Alias command
]]
require("xap")

local cmd = string.format([[
xap-header
{
class=alias
}
command
{
text=%s
}]],args.alias)

xap.init("dbzoo.lua.aliasmsg","FF00DF00")
xap.sendShort(cmd)

Member for

15 years 7 months

garrydwilms

14 years 11 months ago

I did in fact try this (albeit with a much poorly wriited script!) however I struggled to get it to run.

I put it in the plugboard dir and chmod a+x'd it, but when I tried to send the command via command line I just kept getting 'file not found'??

I therefore wrongly assumed it was due to the location of the file. Not sure what I was doing wrong but anyhow you have kindly sorted it for me with the new 297 update.

 

Many thanks again for your time

 

Garry