Irrigation Temperature rule

Tips and Techniques for using MLServer's Automation Rules
ccharmatz
Intermediate
Intermediate
Posts: 344
Joined: Wed Oct 15, 2003 12:51 pm
Location: Clearwater Florida
Contact:

Irrigation Temperature rule

Postby ccharmatz » Mon Jan 19, 2009 4:00 pm

Just wanted to get feedback to see if this was the best way. I do not want my irrigation program 1 to run if the temperature is below xx.

My thought and what I just implemented was:

Whenever mlweather_currenttemp is less than or equal nn
Then SetVariable|mlirrigation_program_001_schedule_enabled~False

Whenever mlweather_currenttemp is greater than or equal nn
Then SetVariable|mlirrigation_program_001_schedule_enabled~True

tnx,

Charles

User avatar
mcascio
Founder
Founder
Posts: 8270
Joined: Tue Jan 28, 2003 4:03 pm
Location: Kenosha, Wi
Contact:

Postby mcascio » Mon Jan 19, 2009 4:24 pm

Charles,

You'll need to actually send a command to MLIrrigation as opposed to setting a variable. Changing the variable (unlike DVDLobby) will not enable or disable a program.


Whenever mlweather_currenttemp is less than or equal nn
Then MLIrrigation|SetSystemMode~Off


Whenever mlweather_currenttemp is greater than or equal nn
Then MLIrrigation|SetSystemMode~Schedule
Mario Cascio
Cinemar, Inc.
http://www.cinemaronline.com

ccharmatz
Intermediate
Intermediate
Posts: 344
Joined: Wed Oct 15, 2003 12:51 pm
Location: Clearwater Florida
Contact:

Postby ccharmatz » Mon Jan 19, 2009 4:28 pm

Thank you kind sir. This covers all programs as well. nice

Charles.

ccharmatz
Intermediate
Intermediate
Posts: 344
Joined: Wed Oct 15, 2003 12:51 pm
Location: Clearwater Florida
Contact:

Postby ccharmatz » Mon Jan 19, 2009 4:59 pm

It would seem mlirrigation does not like the rule. I set the currenttemp value for testing, and get the following error.



1/19/2009 4:55:59 PM Processing (1) client06 SetVariable|mlweather_currenttemp~70
1/19/2009 4:55:59 PM Conditional Server Event Triggered for Whenever mlweather_currenttemp is greater than or equal 56
1/19/2009 4:55:59 PM Conditional Server And mlirrigation_system_mode equals Manual
1/19/2009 4:55:59 PM Conditional Server Then MLServeCmd.MLIrrigation|SetSystemMode~Schedule
1/19/2009 4:55:59 PM Push [1] MLServeCmd.MLIrrigation|SetSystemMode~Schedule
1/19/2009 4:55:59 PM Pop [1] MLServeCmd.MLIrrigation|SetSystemMode~Schedule
1/19/2009 4:55:59 PM Processing (1) MLServeCmd.MLIrrigation|SetSystemMode~Schedule
1/19/2009 4:55:59 PM MLIrrigation Server There was and error while processing a command: -2147467259~Field 'Clients.Name' cannot be a zero-length string.

User avatar
mcascio
Founder
Founder
Posts: 8270
Joined: Tue Jan 28, 2003 4:03 pm
Location: Kenosha, Wi
Contact:

Postby mcascio » Mon Jan 19, 2009 5:00 pm

Make sure your drivers and MLIrrigation Family are the latest from the Cinemar Installation Assistant.
Mario Cascio

Cinemar, Inc.

http://www.cinemaronline.com

ccharmatz
Intermediate
Intermediate
Posts: 344
Joined: Wed Oct 15, 2003 12:51 pm
Location: Clearwater Florida
Contact:

Postby ccharmatz » Mon Jan 19, 2009 5:17 pm

Looks like version is current. 3.75.22

User avatar
CinemarDave
Site Admin
Site Admin
Posts: 10535
Joined: Fri Feb 07, 2003 8:56 am
Location: Planet Earth
Contact:

Postby CinemarDave » Mon Jan 19, 2009 5:35 pm

I believe the issue is that the Irrigation plugin expects to see a client name associated with all its commands. However, when fired from an automation rule there is no client associated with the command.

You could get around this by building a MLScript function and calliing the MLScript function in the automation rule.

For example.

Change your Then clause from

MLServeCmd.MLIrrigation|SetSystemMode~Schedule

to

MLServeCmd.MLScript|TurnOnIrrigation

Then in MLScript create a new script called TurnOnIrrigation

The body of the script should read

Code: Select all

Option Explict

Sub ScheduleOn ()
    MLServer.CmdReceiveClient "MLIrrigation|SetSystemMode~Schedule", "Wingnut"
End Sub

ScheduleOn


When the script is run MLServer will think the client named "Wingnut" is issuing the command. You can substitute Wingnut for anything you like.

ccharmatz
Intermediate
Intermediate
Posts: 344
Joined: Wed Oct 15, 2003 12:51 pm
Location: Clearwater Florida
Contact:

Postby ccharmatz » Tue Jan 20, 2009 2:01 pm

Dave,

Thank you for the help. I am using the following and it works beautifully.

The scripts were named to keep them together in the MLScript Interface, and I am switching between Manual Mode, and Scheduled so that I can still use system off to completely shut down the system and not have it run.

cc-

Whenever mlweather_currenttemp is less than or equal 45
And mlirrigation_system_mode equals Schedule
Then MLServeCmd.MLScript|IrrigationManual


Whenever mlweather_currenttemp is less than or equal 46
And mlirrigation_system_mode equals Manual
Then MLServeCmd.MLScript|IrrigationSchedule



IrrigationManual


Option Explicit

Sub ScheduleOn
MLServer.CmdReceiveClient "MLIrrigation|SetSystemMode~Manual", "Automation"
End Sub

ScheduleOn



IrrigationSchedule

Option Explicit

Sub ScheduleOn ()
MLServer.CmdReceiveClient "MLIrrigation|SetSystemMode~Schedule", "Automation"
End Sub

ScheduleOn


Return to “Automation Rules”

Who is online

Users browsing this forum: No registered users and 2 guests