2022-09-13 18:22:22 +00:00
|
|
|
alias GasSensor d0
|
2021-11-10 16:29:01 +00:00
|
|
|
# d1= Logic Switch, Dial variant (Max=30)
|
2022-09-13 18:22:22 +00:00
|
|
|
alias Thermostat d1
|
2021-11-10 16:29:01 +00:00
|
|
|
# d2 = Logic Memory, must be more than 0
|
2022-09-13 18:22:22 +00:00
|
|
|
alias TempVariance d2
|
2021-11-10 16:29:01 +00:00
|
|
|
# d3 = Console, LED Display variant, optional
|
2022-09-13 18:22:22 +00:00
|
|
|
alias TempDisplay d3
|
2022-06-21 20:31:54 +00:00
|
|
|
# d4 = Wall Cooler
|
2022-09-13 18:22:22 +00:00
|
|
|
alias WallCooler d4
|
2022-06-21 20:31:54 +00:00
|
|
|
# d5 = Wall Heater
|
2022-09-13 18:22:22 +00:00
|
|
|
alias WallHeater d5
|
2021-11-10 16:29:01 +00:00
|
|
|
|
2022-09-13 18:22:22 +00:00
|
|
|
alias CurrentTemp r0
|
|
|
|
alias TargetTemp r1
|
|
|
|
alias Variance r2
|
|
|
|
alias MinTemp r3
|
|
|
|
alias MaxTemp r4
|
|
|
|
alias CoolingActive r5
|
|
|
|
alias HeatingActive r6
|
|
|
|
alias Cooler r7
|
|
|
|
alias Heater r8
|
2021-08-29 12:08:52 +00:00
|
|
|
|
2022-09-13 18:22:22 +00:00
|
|
|
define TEMPCONVERT 273.15
|
2021-08-29 12:08:52 +00:00
|
|
|
|
2022-09-13 18:22:22 +00:00
|
|
|
move CoolingActive 0
|
|
|
|
move HeatingActive 0
|
2021-11-10 17:48:52 +00:00
|
|
|
|
2022-09-13 18:22:22 +00:00
|
|
|
l Cooler WallCooler PrefabHash
|
|
|
|
l Heater WallHeater PrefabHash
|
2022-06-21 20:31:54 +00:00
|
|
|
|
2021-08-29 12:08:52 +00:00
|
|
|
start:
|
2021-09-05 17:15:06 +00:00
|
|
|
yield
|
2021-08-29 12:08:52 +00:00
|
|
|
# establish min- and max-temps to registry
|
2022-09-13 18:22:22 +00:00
|
|
|
l Variance TempVariance Setting
|
|
|
|
l TargetTemp Thermostat Setting
|
2022-10-23 11:05:50 +00:00
|
|
|
sub MinTemp TargetTemp Variance
|
|
|
|
add MaxTemp TargetTemp Variance
|
2021-08-29 12:08:52 +00:00
|
|
|
|
2021-11-15 13:32:10 +00:00
|
|
|
# get current temperature
|
2021-11-10 17:15:31 +00:00
|
|
|
jal temp_read
|
2021-08-29 12:08:52 +00:00
|
|
|
|
2021-11-10 16:29:01 +00:00
|
|
|
# update display
|
2022-10-23 11:05:50 +00:00
|
|
|
bdseal TempDisplay display
|
2021-11-10 16:29:01 +00:00
|
|
|
|
2021-08-29 12:08:52 +00:00
|
|
|
# compare current temp to max/min temp and
|
|
|
|
# initiate cooling or heating if needed
|
2022-09-13 18:22:22 +00:00
|
|
|
bgt CurrentTemp MaxTemp cooling
|
|
|
|
blt CurrentTemp MinTemp heating
|
2021-08-29 12:08:52 +00:00
|
|
|
|
2022-10-23 11:05:50 +00:00
|
|
|
# Ensure coolers and heaters are off when not needed
|
2022-09-13 18:22:22 +00:00
|
|
|
sb Cooler On CoolingActive
|
|
|
|
sb Heater On HeatingActive
|
2021-11-10 17:15:31 +00:00
|
|
|
|
2021-08-29 12:08:52 +00:00
|
|
|
j start
|
|
|
|
|
2021-11-10 17:15:31 +00:00
|
|
|
temp_read:
|
2022-09-13 18:22:22 +00:00
|
|
|
l CurrentTemp GasSensor Temperature
|
|
|
|
sub CurrentTemp CurrentTemp TEMPCONVERT
|
2021-11-10 17:15:31 +00:00
|
|
|
j ra
|
|
|
|
|
2021-11-10 16:29:01 +00:00
|
|
|
display:
|
2022-09-13 18:22:22 +00:00
|
|
|
s TempDisplay Setting CurrentTemp
|
2021-11-10 16:29:01 +00:00
|
|
|
j ra
|
2021-08-29 12:49:34 +00:00
|
|
|
|
2021-11-10 16:29:01 +00:00
|
|
|
cooling:
|
2021-11-10 17:52:25 +00:00
|
|
|
yield
|
2021-11-10 17:15:31 +00:00
|
|
|
jal temp_read
|
|
|
|
|
2021-08-29 12:49:34 +00:00
|
|
|
# test if coolers need to be on or not
|
2022-09-13 18:22:22 +00:00
|
|
|
sgt CoolingActive CurrentTemp TargetTemp
|
2021-08-29 12:08:52 +00:00
|
|
|
|
2022-10-23 11:05:50 +00:00
|
|
|
# update display
|
|
|
|
bdseal TempDisplay display
|
2021-11-10 16:29:01 +00:00
|
|
|
|
2021-08-29 12:08:52 +00:00
|
|
|
# send state to coolers
|
2022-09-13 18:22:22 +00:00
|
|
|
sb Cooler On CoolingActive
|
2021-08-29 12:08:52 +00:00
|
|
|
|
2022-09-13 18:22:22 +00:00
|
|
|
bgtz CoolingActive cooling
|
2021-08-29 12:08:52 +00:00
|
|
|
j start
|
|
|
|
|
|
|
|
heating:
|
2021-11-10 17:52:25 +00:00
|
|
|
yield
|
2021-11-10 17:15:31 +00:00
|
|
|
jal temp_read
|
|
|
|
|
2021-08-29 12:49:34 +00:00
|
|
|
# test if heaters need to be on or not
|
2022-09-13 18:22:22 +00:00
|
|
|
slt HeatingActive CurrentTemp TargetTemp
|
2021-08-29 12:08:52 +00:00
|
|
|
|
2022-10-23 11:05:50 +00:00
|
|
|
# update display
|
|
|
|
bdseal TempDisplay display
|
2021-11-10 16:29:01 +00:00
|
|
|
|
2021-08-29 12:08:52 +00:00
|
|
|
# send state to heaters
|
2022-09-13 18:22:22 +00:00
|
|
|
sb Heater On HeatingActive
|
2021-08-29 12:08:52 +00:00
|
|
|
|
2022-09-13 18:22:22 +00:00
|
|
|
bgtz HeatingActive heating
|
2021-08-29 12:08:52 +00:00
|
|
|
j start
|