diff --git a/.github/workflows/python-app.yaml b/.github/workflows/python-app.yaml index 15a3492e..5e360a9b 100644 --- a/.github/workflows/python-app.yaml +++ b/.github/workflows/python-app.yaml @@ -9,7 +9,7 @@ jobs: strategy: matrix: # Apparently 3.10 gets converted to 3.1 if it's not a string. Brilliant. - python-version: [3.7, 3.8, 3.9, '3.10', '3.11'] + python-version: [3.8, 3.9, '3.10', '3.11'] steps: - uses: actions/checkout@v3 @@ -22,7 +22,7 @@ jobs: python -m pip install --upgrade pip pip install wheel flake8 pip install -r dev-requirements.txt - pip install -e . + pip install -r requirements.txt - name: Prime Cache run: | mkdir $HOME/.eeweather diff --git a/.github/workflows/windows_conda_testing.yaml b/.github/workflows/windows_conda_testing.yaml index c289b9a0..b7a57ac4 100644 --- a/.github/workflows/windows_conda_testing.yaml +++ b/.github/workflows/windows_conda_testing.yaml @@ -32,6 +32,6 @@ jobs: C:\Miniconda\condabin\conda.bat activate base C:\Miniconda\condabin\conda.bat install pytest pytest-cov coverage mock pip C:\Miniconda\condabin\conda.bat install -c conda-forge shapely - pip install -e . + pip install -r requirements.txt pytest diff --git a/tests/test_equipment_type.py b/tests/test_equipment_type.py index a7b6cbc2..41bc56f8 100644 --- a/tests/test_equipment_type.py +++ b/tests/test_equipment_type.py @@ -12,6 +12,7 @@ validate_heat_stage, validate_cool_stage, first_stage_capacity_ratio, + is_line_voltage, ) @@ -41,6 +42,7 @@ def test_has_heating(): 'furnace_or_boiler', # Non heat pump heating (gas or oil furnace, electric resistance) 'heat_pump_electric_backup', # Heat pump with electric resistance heat (strip heat) 'heat_pump_no_electric_backup', # Heat pump without electric resistance heat + 'electric_resistance', # Electric Resistance (Line-voltage thermostat) ]: assert(has_heating(i) is True) for i in [ @@ -112,6 +114,11 @@ def test_has_resistance_heat(): assert(has_resistance_heat('heat_pump_dual_fuel') is False) +def test_is_line_voltage(): + assert(is_line_voltage('electric_resistance') is True) + assert(is_line_voltage('heat_pump_dual_fuel') is False) + + def test_ratio(): assert(first_stage_capacity_ratio('furnace_or_boiler') == .65) assert(first_stage_capacity_ratio('heat_pump') == .72) diff --git a/thermostat/equipment_type.py b/thermostat/equipment_type.py index 6c7a8374..3618817b 100644 --- a/thermostat/equipment_type.py +++ b/thermostat/equipment_type.py @@ -5,6 +5,7 @@ 'heat_pump_electric_backup', # Heat pump with electric resistance heat (strip heat) 'heat_pump_no_electric_backup', # Heat pump without electric resistance heat 'heat_pump_dual_fuel', # Dual fuel heat pump (e.g. gas or oil fired) + 'electric_resistance', # Line voltage thermostat electric resistance heat 'other', # Multi-zone, ? 'none', # No central heating system ] @@ -17,6 +18,7 @@ 'two_speed', # Dual capacity heater or dual stage compressor (synonym) 'modulating', # Modulating or variable capacity unit 'variable_speed', # Modulating or variable capacity unit + 'none', # No central heating system ] COOL_TYPE = [ @@ -33,6 +35,7 @@ 'two_stage', # Dual stage compressor (synonym) 'modulating', # Modulating or variable capacity compressor 'variable_speed', # Modulating or variable capacity unit + 'none', # No central cooling system ] #: This mapping is for old scripts that need to refer to the old mapping, but want to use the new functionality. @@ -238,6 +241,24 @@ def has_resistance_heat(heat_type): return False +def is_line_voltage(heat_type): + """ Determines if the heat type is valid for line-voltage thermostats + + Parameters + ---------- + heat_type : str + The name of the heating type + + + Returns + ------- + boolean + """ + if heat_type == 'electric_resistance': + return True + return False + + def validate_heat_type(heat_type): if heat_type is None or heat_type == '' or heat_type in HEAT_TYPE: return True diff --git a/thermostat/importers.py b/thermostat/importers.py index 32e00309..9f087ae5 100644 --- a/thermostat/importers.py +++ b/thermostat/importers.py @@ -17,6 +17,7 @@ has_two_stage_heating, has_multi_stage_cooling, has_multi_stage_heating, + is_line_voltage, first_stage_capacity_ratio, ) @@ -384,6 +385,12 @@ def get_single_thermostat(thermostat_id, zipcode, temp_out = get_indexed_temperatures_eeweather(station, hourly_index_utc - utc_offset) temp_out.index = hourly_index + # Validate line-voltage heat-type doesn't have cooling + if is_line_voltage(heat_type) and has_cooling(cool_type): + message = ("Line-voltage thermostat thermostat_id={} has cooling type set. " + "This thermostat-type doesn't support cooling.".format(thermostat_id)) + raise RuntimeError(message) + # load daily time series values auxiliary_heat_runtime, emergency_heat_runtime = _calculate_aux_emerg_runtime(df, thermostat_id, heat_type, heat_stage, hourly_index) cool_runtime = _calculate_cool_runtime(df, thermostat_id, cool_type, cool_stage, hourly_index)