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