<s> from . thermostat import Thermostat , CommonThermostat , CT30v192 , CT50v109 , CT50v188 , CT50v194 , CT80RevB2v103 <EOL> from . import discover <EOL> from . import fields <EOL> THERMOSTATS = ( CT30v192 , CT50v109 , CT50v188 , CT50v194 , CT80RevB2v103 , ) <EOL> def get_thermostat_class ( model ) : <EOL> """<STR_LIT>""" <EOL> for thermostat in THERMOSTATS : <EOL> if issubclass ( thermostat , Thermostat ) and thermostat . MODEL == model : <EOL> return thermostat <EOL> def get_thermostat ( host_address = None ) : <EOL> """<STR_LIT>""" <EOL> if host_address is None : <EOL> host_address = discover . discover_address ( ) <EOL> initial = CommonThermostat ( host_address ) <EOL> model = initial . model . get ( '<STR_LIT>' ) <EOL> thermostat_class = get_thermostat_class ( model ) <EOL> if thermostat_class is not None : <EOL> return thermostat_class ( host_address ) </s>
