2021-08-29 12:08:52 +00:00
|
|
|
alias gas_sensor d0
|
2021-11-10 16:29:01 +00:00
|
|
|
# d1= Logic Switch, Dial variant (Max=30)
|
|
|
|
alias thermostat d1
|
|
|
|
# d2 = Logic Memory, must be more than 0
|
|
|
|
alias temp_variance d2
|
|
|
|
# d3 = Console, LED Display variant, optional
|
|
|
|
alias temp_disp d3
|
2022-06-21 20:31:54 +00:00
|
|
|
# d4 = Wall Cooler
|
|
|
|
alias w_cooler d4
|
|
|
|
# d5 = Wall Heater
|
|
|
|
alias w_heater d5
|
2021-11-10 16:29:01 +00:00
|
|
|
|
2021-08-29 12:08:52 +00:00
|
|
|
alias curr_temp r0
|
|
|
|
alias target_temp r1
|
|
|
|
alias variance r2
|
|
|
|
alias min_temp r3
|
|
|
|
alias max_temp r4
|
|
|
|
alias cooling_active r5
|
|
|
|
alias heating_active r6
|
2022-06-21 20:31:54 +00:00
|
|
|
alias cooler r7
|
|
|
|
alias heater r8
|
2021-08-29 12:08:52 +00:00
|
|
|
|
2021-11-15 13:32:10 +00:00
|
|
|
define TEMP_CONVERT 273.15
|
2021-08-29 12:08:52 +00:00
|
|
|
|
2021-11-10 17:48:52 +00:00
|
|
|
move cooling_active 0
|
|
|
|
move heating_active 0
|
|
|
|
|
2022-06-21 20:31:54 +00:00
|
|
|
l cooler w_cooler PrefabHash
|
|
|
|
l heater w_heater PrefabHash
|
|
|
|
|
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
|
|
|
|
l variance temp_variance Setting
|
|
|
|
l min_temp thermostat Setting
|
|
|
|
sub min_temp min_temp variance
|
|
|
|
l max_temp thermostat Setting
|
|
|
|
add max_temp max_temp variance
|
|
|
|
|
|
|
|
l target_temp thermostat Setting
|
|
|
|
|
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
|
|
|
|
brdns temp_disp 2
|
|
|
|
jal display
|
|
|
|
|
2021-08-29 12:08:52 +00:00
|
|
|
# compare current temp to max/min temp and
|
|
|
|
# initiate cooling or heating if needed
|
|
|
|
bgt curr_temp max_temp cooling
|
|
|
|
blt curr_temp min_temp heating
|
|
|
|
|
2022-06-21 20:31:54 +00:00
|
|
|
sb cooler On cooling_active
|
|
|
|
sb heater On heating_active
|
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:
|
|
|
|
l curr_temp gas_sensor Temperature
|
2021-11-15 13:32:10 +00:00
|
|
|
sub curr_temp curr_temp TEMP_CONVERT
|
2021-11-10 17:15:31 +00:00
|
|
|
j ra
|
|
|
|
|
2021-11-10 16:29:01 +00:00
|
|
|
display:
|
|
|
|
s temp_disp Setting curr_temp
|
|
|
|
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
|
2021-08-29 12:08:52 +00:00
|
|
|
sgt cooling_active curr_temp target_temp
|
|
|
|
|
2021-11-10 16:29:01 +00:00
|
|
|
brdns temp_disp 2
|
|
|
|
jal display
|
|
|
|
|
2021-08-29 12:08:52 +00:00
|
|
|
# send state to coolers
|
2022-06-21 20:31:54 +00:00
|
|
|
sb cooler On cooling_active
|
2021-08-29 12:08:52 +00:00
|
|
|
|
2021-11-10 16:29:01 +00:00
|
|
|
bgtz cooling_active 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
|
2021-08-29 12:08:52 +00:00
|
|
|
slt heating_active curr_temp target_temp
|
|
|
|
|
2021-11-10 16:29:01 +00:00
|
|
|
brdns temp_disp 2
|
|
|
|
jal display
|
|
|
|
|
2021-08-29 12:08:52 +00:00
|
|
|
# send state to heaters
|
2022-06-21 20:31:54 +00:00
|
|
|
sb heater On heating_active
|
2021-08-29 12:08:52 +00:00
|
|
|
|
2021-11-10 16:29:01 +00:00
|
|
|
bgtz heating_active heating
|
2021-08-29 12:08:52 +00:00
|
|
|
j start
|