Logic Machine Forum
IrrigationCaddy integration module - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: IrrigationCaddy integration module (/showthread.php?tid=575)



IrrigationCaddy integration module - lpala - 24.01.2017

<- 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:

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


RE: IrrigationCaddy integration module - Domoticatorino - 02.05.2017

Dear Luca,
I am purchasing the ICEthS1 irrigation caddy products.
I read your scripts but I have not seen about reading, for example, the group address related to status of a valve.
What do you think about that?
Thanks.


RE: IrrigationCaddy integration module - Domoticatorino - 06.05.2017

Hi there,
reading the script on the "gateway example" of the web site, it seems that we can verify on HL the status of irrigation system.

But I cannot identify in which part of the script we can command manually a zones. Is it possible in your opinion?

Thanks.


RE: IrrigationCaddy integration module - lpala - 12.05.2017

(06.05.2017, 07:52)Domoticatorino Wrote: Hi there,
reading the script on the "gateway example" of the web site, it seems that we can verify on HL the status of irrigation system.

But I cannot identify in which part of the script we can command manually a zones. Is it possible in your opinion?

Thanks.

Hi, please have a look at example file. You have status' variables in object that can assign in you script.
Actully the module doesn't handle programs and zones start/stop. But it shouldn't diffifcult to add.

Luca


RE: IrrigationCaddy integration module - lpala - 12.05.2017

I've just uploded latest version.
It adds support for starting and stopping programs, including "run now" with single zones' timers.


Luca