July 26, 2025


    Ok, Ok, we’re fanatics about getting visibility into code, but the code that displayed what state the thermostat is in wasn’t working. 


Oops, better back up a bit. Since the BASIC script running on the X-410 controller has no visibility, no debugger or even printf, we had to invent a way of seeing what was happening. So, we added a “Thermostat State” register. The States are:

 Value  State Name

 -10     Cooling disabled

    0      Cool Enough

  10      Normal Cooling

  25      Freeze Detected

  30      Freeze Prevention

Here’s the bug. If a freeze detect is signaled while the Hall Temperature is in the “Dead Zone” between heating and cooling, the thermostat state stays the same.

Here’s the state after the bug fix.

Here’s the code showing the bug fix. The lower green block is the actual bug fix. Had to add the stuff after the “If we’re in the dead band comment”

Thermostat Script


' Thermostat states are:

' -10 Cooling disabled

'   0 Cool Enough

'  10 Normal Cooling

'  25 Freeze Detected

'  30 Freeze Prevention


DO    'Beginning of main program loop


    'Thawing the evaporator is top priority!

    IF io.evaporatorFrozen > 0 'Change to greater than 0 so can set to any value for easier log graph reading.

        LET io.hvacCooling = 0

        LET io.hvacBlower = 1

        

        LET io.thermostatState = io.evaporatorFrozen ' This will be 25 for Freeze Detection, 30 for Freeze Prevention

    ELSE

    

        'Cool Enabled is second priority

        IF io.coolEnable > 0 THEN

            

            

            'Valid temperature reading is third priority

            IF io.hallTemperature <> NAN THEN

                    

                ' Turn HVAC On

                IF io.hallTemperature >= io.coolOnTemp

                    LET io.hvacCooling = 1

                    LET io.hvacBlower = 1

                    

                    LET io.thermostatState = 10 ' Normal Cooling

                END IF

                

                ' Turn HVAC off

                IF io.hallTemperature <= io.coolOffTemp THEN

                    LET io.hvacCooling = 0

                    

                    LET io.thermostatState = 0 ' Cool Enough

                END IF

                    

            END IF 'One Wire Sensor reading was valid


            ' Check for state change from enabled to disabled only, can't blindly set to 0 

            IF io.thermostatState < 0 THEN

                LET io.thermostatState = 0

            END IF

        

            ' If we're in the dead band between cool on and cool off, we haven't set the state correctly yet.

            ' We can use the io.hvacCooling relay state to set the thermostat state correctly. We KNOW, if we're

            ' here, that we're not in Freeze Detected, Freeze Prevention or Cooling Disabled. Therefor we MUST 

            ' be in Normal Cooling or Cool Enough.

            IF io.hvacCooling > 0 THEN

                LET io.thermostatState = 10 ' Normal Cooling

            END IF

            

            IF io.hvacCooling = 0 THEN

                LET io.thermostatState = 0 ' Cool Enough

            END IF



        ELSE 'Cooling disabled

            LET io.hvacCooling = 0

            LET io.thermostatState = -10 ' Cooling Disabled

        END IF 'Check Cool Enable

            

    END IF 'Evaporator Frozen Check 


LOOP 'End of main program loop


END ' End of main program


The actual script as of today. Let’s hope there aren’t any more fixes and changes!