SCHEDULE.pm

SCHEDULE

DESCRIPTION

Module for scheduling state changes for objects in misterhouse via the web UI. This module is useful for scheduling for objects that do not inherit scheduleing from the Generic_Item or do not have the states that you need by default.

It is also very useful for thermostat scheduleing as the child object SCHEDULE_Temp is built exactly for that and allows the scheduled temp changes to be set in real time from the MH web UI.

CONFIGURATION

At minimum, you must define the SCHEDULE and one of the following objects SCHEDULE_Temp or SCHEDULE_Generic.

The SCHEDULE_Generic objects are for scheduling state changes for any object in misterhouse. You can make custom states to be listed in the MH web UI. See SCHEDULE_Generic

The SCHEDULE_Temp objects are for scheduling thermostat temp changes throughout the day. Its linked to sets of object which hold the schedule temps and can be changed in the MH web UI in real time. It also has several overrides such as occupancy checking and outdoor temp. See SCHEDULE_Temp

Interface Configuration

This object has no mh.private.ini configuration.

Defining the Interface Object

The object must be defined in the user code.

In user code:

$Night = new SCHEDULE('THERMO1');

Wherein the format for the definition is:

   $Night = new SCHEDULE(INSTANCE);

NOTES

The instance is only needed when multiple schedule object are used together for a thermostat schedule.

An example user code for a SCHEDULE_Generic:

        #noloop=start
        use SCHEDULE;
        $SCHEDULE_LIGHT1 = new SCHEDULE();
        $SCHEDULE_SG_LIGHT1 = new SCHEDULE_Generic($SCHEDULE_LIGHT1,$light1,'on','off');  #The states (on and off in this example) are optional. 
        $SCHEDULE2->set_schedule_default(1,'00 1 * * 1-5','off');  #Optionally sets 1st the default schedule. 
        $SCHEDULE2->set_schedule_default(2,'00 5 * * 1-5','on');   #Optionally sets 2nd the default schedule. 
        #noloop=stop

        

An example user code for a SCHEDULE_Temp:

        #noloop=start
        $Night = new SCHEDULE('THERMO1');
        $Normal = new SCHEDULE('THERMO1');
        $Conserve = new SCHEDULE('THERMO1');
        $NightWinter = new SCHEDULE('THERMO1');

        # $NormalCool/$NormalHeat have an UP and DOWN states to change the temp settings in the web interface and they are linked to the Normal schedule object above.
        # $thermostat is the thermostat object that controls my Insteon thermostat, cool_setpoint and heat_setpoint are the subs that are used to set the thermostat setpoint.
        $NormalCool = new SCHEDULE_Temp($Normal,'cool',$thermostat,'cool_setpoint');
        $NormalHeat = new SCHEDULE_Temp($Normal,'heat',$thermostat,'heat_setpoint');

        $NightCool = new SCHEDULE_Temp($Night,'cool',$thermostat,'cool_setpoint');
        $NightHeat = new SCHEDULE_Temp($Night,'heat',$thermostat,'heat_setpoint');

        $NightWCool = new SCHEDULE_Temp($NightWinter,'cool',$thermostat,'cool_setpoint');
        $NightWHeat = new SCHEDULE_Temp($NightWinter,'heat',$thermostat,'heat_setpoint');

        $ConserveCool = new SCHEDULE_Temp($Conserve,'cool',$thermostat,'cool_setpoint');
        $ConserveHeat = new SCHEDULE_Temp($Conserve,'heat',$thermostat,'heat_setpoint');


        # Occupancy Override (optional, I track occupancy by checking to see if my cell is connected to wifi)
        # If the $mode_occupied state is home use the $Normal object temps (from $NormalCool/$NormalHeat), 
        # if the $mode_occupied state changes to work change the temp settings to the $Conserve object temps (from $ConserveCool/$ConserveHeat)
        $Normal->set_occpuancy('home','work',$Conserve); 
        $Night->set_occpuancy('home','work',$Normal);
        $Conserve->set_occpuancy('work','home',$Normal);

        #Forcasted temps equal or below this (50) cause the $NightWinter temps to be used. Pulled from $Weather{Forecast Tonight}.
        $Night->set_winter($NightWinter,'50');

        # Vacation mode. During any active schedule, override the linked temps with the $Conserve temps.
        $Normal->set_vacation($Conserve,'vacation');
        $Night->set_vacation($Conserve,'vacation');
        $Conserve->set_vacation($Conserve,'vacation');
        #noloop=stop

INHERITS

Generic_Item

METHODS

register()

Used to associate child objects with the interface.

SCHEDULE_Generic

SYNOPSIS

User code:

    $SCHEDULE_SG_LIGHT1 = new SCHEDULE_Generic($SCHEDULE_LIGHT1,$light1,'on','off'); 

     Wherein the format for the definition is:
    $SCHEDULE_SG_LIGHT1 = new SCHEDULE_Generic(MASTER_SCHEDULE_OBJECT,CONTROLLED_OBJECT,STATES);

NOTES

The master schedule object (SCHEDULE object) holds the scheduling data which is set using the MH web UI. The SCHEDULE_Generic object links the master schedule object to the controlled object and optionally allows the user to set custom states to be used in the schedules in the MH web. The controlled object can be any MH object such as a light.

DESCRIPTION

Links the master schedule object to the controlled object and optionally allows the user to set custom states to be used in the schedules in the MH web.

INHERITS

Generic_Item

METHODS

set_sub()

Allows the user to change the sub used to set the state of the controlled object. By default 'set' is used.

User code:

    $SCHEDULE_SG_LIGHT1->set_sub('set_cool')
        
         Wherein the format for the definition is:
        $SCHEDULE_SG_LIGHT1->set_sub(SUB)

SCHEDULE_Temp

SYNOPSIS

User code:

    $NormalCool = new SCHEDULE_Temp($Normal,'cool',$thermostat,'cool_setpoint'); 

     Wherein the format for the definition is:
    $NormalCool = new SCHEDULE_Temp(MASTER_SCHEDULE_OBJECT,cool/heat,CONTROLLED_THERMOSTAT_OBJECT,SUB);

NOTES

The master schedule object (SCHEDULE object) holds the scheduling data which is set using the MH web UI. The SCHEDULE_Temp object holds the temp setting for the schedule and links the master schedule object to the controlled object. The controlled object is the thermostat object used to change your thermostat set points. cool/heat is literally 'heat' or 'cool', you should have 1 SCHEDULE_Temp object set to 'cool' and 1 set to 'heat'.

DESCRIPTION

This object holds the temp setting and links the master schedule object to the controlled thermostat object, its also where the user can easily change the temp settings for the schedule in the MH web UI.

INHERITS

Generic_Item

METHODS

set_sub()

Allows the user to change the sub used to set the state of the controlled object. By default 'set' is used. This can also be set in the SCHEDULE_Temp definition.

User code:

        $NormalCool->set_sub('set_cool');

        Wherein the format for the definition is:
        $NormalCool->set_sub(SUB)

SCHEDULE_Temp_Active

SYNOPSIS

User code:

    $TEMP1_ACTIVE = new SCHEDULE_Temp_Active('THERMO1');

     Wherein the format for the definition is:
    $TEMP1_ACTIVE = new SCHEDULE_Temp_Active(INSTANCE);

NOTES

The SCHEDULE_Temp_Active object is used to track the active temp schedule for the defined instance.

DESCRIPTION

INHERITS

Generic_Item

METHODS

NOTES

AUTHOR

Wayne Gatlin <wayne@razorcla.ws>

SEE ALSO

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

 SCHEDULE.pm