-
Notifications
You must be signed in to change notification settings - Fork 130
Items SCHEDULE
See original
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 scheduling from the Generic_Item
or do not have the states that you need by default.
It is also very useful for thermostat scheduling 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 MisterHouse web UI.
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 CHEDULE_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
The object must be defined in the user code.
$Night = new SCHEDULE('THERMO1');
Wherein the format for the definition is:
$Night = new SCHEDULE(INSTANCE);
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
Method | Description |
---|---|
register() |
Used to associate child objects with the interface. |
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);
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.
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.
Method | Description |
---|---|
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)
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);
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'.
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.
Method | Description |
---|---|
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)
User code:
$TEMP1_ACTIVE = new SCHEDULE_Temp_Active('THERMO1');
Wherein the format for the definition is:
$TEMP1_ACTIVE = new SCHEDULE_Temp_Active(INSTANCE);
The SCHEDULE_Temp_Active
object is used to track the active temp schedule for the defined instance.
Wayne Gatlin [email protected]