matt.york Posted June 14, 2020 Posted June 14, 2020 For a few years, I have been trying to replicate the function of an adjustable thermostat to control my attic fan using Multi-senor 6. Can anyone suggest an improvement for this program?
MrBill Posted June 14, 2020 Posted June 14, 2020 I'd separate this into two programs so that it can turn on at >= 90 and off at <88 or somethings. With only a single program two things come to mind the fan would go on/off frequently. Also I'd use and AND in If's to prevent excess traffic because each time the temp changes on or off is sent regardless of whether it's already on / off. Here's examples I use with my fireplace: Fireplace-cycle off - [ID 0078][Parent 007C] If $Fireplace.down.cycle is 1 And '#1704 / Downstairs Fireplace' Temperature >= '$Fireplace.down.setpoint Fahrenheit' And 'DN Fireplace#' Status is On Then Set 'DN Fireplace#' Off Else - No Actions - (To add one, press 'Action') Fireplace-cycle on - [ID 0079][Parent 007C] If $Fireplace.down.cycle is 1 And '#1704 / Downstairs Fireplace' Temperature < '$Fireplace.down.setpoint.hysteresis Fahrenheit' And 'DN Fireplace#' Status is Off Then Set 'DN Fireplace#' On Else - No Actions - (To add one, press 'Action')
jfai Posted June 14, 2020 Posted June 14, 2020 (edited) Variable name Purpose cCoat_closet_fan_off_temperature Temperature at or below which the fan turns off [⁰F]. Set to 92.0 Invariant: cCoat_closet_fan_off_temperature < cCoat_closet_fan_on_temperature cCoat_closet_fan_on_temperature Temperature at or above which the fan turns on [⁰F]. Set to 93.0 Invariant: cCoat_closet_fan_off_temperature < cCoat_closet_fan_on_temperature Coat closet fan on when hot If 'Foyer / Coat closet multi-sensor' Temperature > '$cCoat_closet_fan_on_temperature Fahrenheit' Then $sCoat_closet_fan = 1 Else - No Actions - (To add one, press 'Action') Sets the state variable to the "fan on" state if the temperature is above the upper limit. Coat closet fan off when cool If 'Foyer / Coat closet multi-sensor' Temperature < '$cCoat_closet_fan_off_temperature Fahrenheit' Then $sCoat_closet_fan = 0 Else - No Actions - (To add one, press 'Action') Sets the state variable to the "fan off" state if the temperature is below the lower limit. Coat closet fan on/off If $sCoat_closet_fan is 0 Then Wait 10 seconds Set 'Foyer / Coat closet vent fan' Off Else Wait 10 seconds Set 'Foyer / Coat closet vent fan' On Turns the fan in the coat closet on or off depending on the value of the state variable. The delays make sure that the fan runs at least a certain amount of time (debouncing). Edited June 14, 2020 by jfai
matt.york Posted June 14, 2020 Author Posted June 14, 2020 Thanks for your feedback so quickly! Mr. Bill - Are these 3 things Devices? or variables? $Fireplace.down.cycle '#1704 / Downstairs Fireplace' Temperature '$Fireplace.down.setpoint Fahrenheit'Is
lilyoyo1 Posted June 14, 2020 Posted June 14, 2020 In addition to what MrBill said, I would add a wait to the then command. I do this with my ceiling fans so that they arent triggered due to a temporary temperature change. Its not needed but its helped prevent my fans from cycling on and off for no reason.
matt.york Posted June 14, 2020 Author Posted June 14, 2020 thank you iliyoyo1 4 hours ago, MrBill said: I'd separate this into two programs so that it can turn on at >= 90 and off at <88 or somethings. With only a single program two things come to mind the fan would go on/off frequently. Also I'd use and AND in If's to prevent excess traffic because each time the temp changes on or off is sent regardless of whether it's already on / off. Here's examples I use with my fireplace: Fireplace-cycle off - [ID 0078][Parent 007C] If $Fireplace.down.cycle is 1 And '#1704 / Downstairs Fireplace' Temperature >= '$Fireplace.down.setpoint Fahrenheit' And 'DN Fireplace#' Status is On Then Set 'DN Fireplace#' Off Else - No Actions - (To add one, press 'Action') Fireplace-cycle on - [ID 0079][Parent 007C] If $Fireplace.down.cycle is 1 And '#1704 / Downstairs Fireplace' Temperature < '$Fireplace.down.setpoint.hysteresis Fahrenheit' And 'DN Fireplace#' Status is Off Then Set 'DN Fireplace#' On Else - No Actions - (To add one, press 'Action')
matt.york Posted June 14, 2020 Author Posted June 14, 2020 jfai, Thanks you your advice. Is Foyer / Coat closet multi-sensor' a device?
MrBill Posted June 15, 2020 Posted June 15, 2020 (edited) 23 hours ago, matt.york said: Mr. Bill - Are these 3 things Devices? or variables? $Fireplace.down.cycle = State Variable '#1704 / Downstairs Fireplace' Temperature = Wireless tag Temperature Node '$Fireplace.down.setpoint Fahrenheit'Is = State Variable If you don't want to have an override switch, you could skip $Fireplace.down.cycle There is actually 3 more programs that work with these 2 for a group of 5. Essentially there are 2 buttons on a 8 button controller that are controllers for the scene. 'DN Fireplace#' is also a responder to the scene. The extra "status" line in the IF of the cycle-on and cycle-off programs takes are of updating when the scene is turned on / off via alexa, or an iphone APP. the single Status is perhaps all that's needed, except this forum taught me to use Control in If's early on.... then when Alexa came along I added the 'status' lines also. I actually have another set of 5 programs for another fireplace.... these have worked very. Haven't needed delays, the temps only update once per minute. All 5: =================================================================================== Fireplace-Downstairs - [ID 007C][Parent 0001] Folder Conditions for 'Fireplace-Downstairs' If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Allow the programs in this folder to run. ----------------------------------------------------------------------------------- Fireplace-cycle off - [ID 0078][Parent 007C] If $Fireplace.down.cycle is 1 And '#1704 / Downstairs Fireplace' Temperature >= '$Fireplace.down.setpoint Fahrenheit' And 'DN Fireplace#' Status is On Then Set 'DN Fireplace#' Off Else - No Actions - (To add one, press 'Action') ----------------------------------------------------------------------------------- Fireplace-cycle on - [ID 0079][Parent 007C] If $Fireplace.down.cycle is 1 And '#1704 / Downstairs Fireplace' Temperature < '$Fireplace.down.setpoint.hysteresis Fahrenheit' And 'DN Fireplace#' Status is Off Then Set 'DN Fireplace#' On Else - No Actions - (To add one, press 'Action') ----------------------------------------------------------------------------------- Fireplace-Downstairs-off - [ID 007B][Parent 007C] If 'DN Back Door Recessed+# / {hide}Fireplace Downstairs' is switched Off Or 'DN Back Door Recessed+# / {hide}Fireplace Downstairs' is switched Fast Off Or '{hide}OUT Lower Fans - High / {hide}DN Fireplace' is switched Off Or '{hide}OUT Lower Fans - High / {hide}DN Fireplace' is switched Fast Off Or '{hide}OUT Lower Fans - High / {hide}DN Fireplace' Status is Off Or 'DN Back Door Recessed+# / DN All Off' is switched Off Or 'DN Back Door Recessed+# / DN All Off' is switched Fast Off Then $Fireplace.down.cycle = 0 Else - No Actions - (To add one, press 'Action') ----------------------------------------------------------------------------------- Fireplace-Downstairs-on - [ID 007A][Parent 007C] If '{hide}OUT Lower Fans - High / {hide}DN Fireplace' is switched On Or 'DN Back Door Recessed+# / {hide}Fireplace Downstairs' is switched On Or 'DN Back Door Recessed+# / {hide}Fireplace Downstairs' Status is not Off Then $Fireplace.down.cycle = 1 Else - No Actions - (To add one, press 'Action') ----------------------------------------------------------------------------------- Setpoint hysteresis - [ID 00E4][Parent 007C] If $Fireplace.down.setpoint < 80 And $Fireplace.down.setpoint >= 60 Then $Fireplace.down.setpoint.hysteresis = $Fireplace.down.setpoint $Fireplace.down.setpoint.hysteresis -= 1 Else $Fireplace.down.setpoint = 73 $Fireplace.down.setpoint.hysteresis = 72 When the setpoint value changes, and the new value is sane, then set hysteresis value. When the new value is NOT sane, set default values. Edited June 15, 2020 by MrBill
Recommended Posts