<- EDIT: updated version, download it again and look at last post for changes. ->
Hi,
here is a module for interacting with IrrigationCaddy controller.
As usual you can find module and example attached.
I use two event based script. I trigger them for updating status or updating configuration use a KNX group.
The script for updating the status is:
The script for updating the configuration is:
Finally the script that triggers the update is:
Where group 0/1/49 is the triggering group.
I've chosen this approach to trigger update on configuration and on scheduled base.
Luca
Hi,
here is a module for interacting with IrrigationCaddy controller.
As usual you can find module and example attached.
I use two event based script. I trigger them for updating status or updating configuration use a KNX group.
The script for updating the status is:
Code:
old_print = print
debug_level = 0
print = function(...)
if ( verbose ) then
log(...)
end
end
irrigationcaddy = require("user.IrrigationCaddy")
syslog_level = ERR
verbose = false
irrigationcaddy.ip = "192.168.1.100"
irrigationcaddy.update()
print ( string.format ( "IC status %s", irrigationcaddy.allowRun ) )
ic = grp.getvalue ( '0/1/40' )
ic_status = grp.getvalue ( '0/1/41' )
if ( ic_status ~= irrigationcaddy.allowRun ) then
print ( string.format ( "IC status (%s) different from device (%s)", tostring(ic_status), tostring(irrigationcaddy.allowRun) ) )
grp.write ( '0/1/41', irrigationcaddy.allowRun, dt.boolean )
end
The script for updating the configuration is:
Code:
irrigationcaddy = require("user.IrrigationCaddy")
debug_level = 5
verbose = true
irrigationcaddy.ip = "192.168.168.73"
ic = grp.getvalue ( '0/1/40' )
ic_status = grp.getvalue ( '0/1/41' )
print ( string.format ( 'Evento da %s per %s tipo %s', event['src'], event['dst'], event['type']) )
group = event['dst']
if ( group == '0/1/40' ) then
if ( ic_status ~= ic ) then
print ( string.format ( "Changing IC status (%s) to %s", tostring(ic_status), tostring(ic) ) )
if ( ic == false ) then
irrigationcaddy.disable()
elseif ( ic == true ) then
irrigationcaddy.enable()
end
grp.write( '0/1/49', true, dt.boolean )
end
end
Finally the script that triggers the update is:
Code:
log ( 'Triggering IC update' )
grp.write('0/1/49', true, dt.boolean )
return
Where group 0/1/49 is the triggering group.
I've chosen this approach to trigger update on configuration and on scheduled base.
Luca