def __init__(self, serial_address=None):
        super().__init__()

        # Make logger
        logger = logging.getLogger('AAG_cloud_sensor')
        if len(logger.handlers) == 0:
            logger.setLevel(logging.DEBUG)
            # Set up console output
            LogConsoleHandler = logging.StreamHandler()
            LogConsoleHandler.setLevel(logging.INFO)
            LogFormat = logging.Formatter('%(asctime)23s %(levelname)8s: %(message)s')
            LogConsoleHandler.setFormatter(LogFormat)
            logger.addHandler(LogConsoleHandler)
            # Set up file output
            LogFilePath = os.path.join('/', 'var', 'panoptes', 'logs', 'PanoptesWeather')

            if not os.path.exists(LogFilePath):
                os.mkdir(LogFilePath)

            now = dt.utcnow()
            LogFileName = now.strftime('AAGCloudSensor.log')
            LogFile = os.path.join(LogFilePath, LogFileName)
            LogFileHandler = logging.handlers.TimedRotatingFileHandler(LogFile,
                                                                       when='midnight', interval=1, utc=True)
            LogFileHandler.setLevel(logging.DEBUG)
            LogFileHandler.setFormatter(LogFormat)
            logger.addHandler(LogFileHandler)

        self.logger = logger

        # Read configuration
        self.cfg = load_config()['weather']['aag_cloud']

        # Initialize Serial Connection
        if not serial_address:
            serial_address = self.cfg.get('serial_port', '/dev/ttyUSB0')

        if self.logger:
            self.logger.debug('Using serial address: {}'.format(serial_address))

        if serial_address:
            if self.logger:
                self.logger.info('Connecting to AAG Cloud Sensor')
            try:
                self.AAG = serial.Serial(serial_address, 9600, timeout=2)
                self.logger.info("  Connected to Cloud Sensor on {}".format(serial_address))
            except OSError as e:
                self.logger.error('Unable to connect to AAG Cloud Sensor')
                self.logger.error('  {}'.format(e.errno))
                self.logger.error('  {}'.format(e.strerror))
                self.AAG = None
            except:
                self.logger.error("Unable to connect to AAG Cloud Sensor")
                self.AAG = None
        else:
            self.AAG = None

        # Thresholds

        # Initialize Values
        self.last_update = None
        self.safe = None
        self.ambient_temp = None
        self.sky_temp = None
        self.wind_speed = None
        self.internal_voltage = None
        self.LDR_resistance = None
        self.rain_sensor_temp = None
        self.PWM = None
        self.errors = None
        self.switch = None
        self.safe_dict = None
        self.hibernate = 0.500  # time to wait after failed query

        # Set Up Heater
        if self.cfg in 'heater':
            self.heater_cfg = self.cfg['heater']
        else:
            self.heater_cfg = {
                'low_temp': 0,
                'low_delta': 6,
                'high_temp': 20,
                'high_delta': 4,
                'min_power': 10,
                'impulse_temp': 10,
                'impulse_duration': 60,
                'impulse_cycle': 600,
            }
        self.heater_PID = PID(Kp=3.0, Ki=0.02, Kd=200.0,
                              max_age=300,
                              output_limits=[self.heater_cfg['min_power'], 100])

        self.impulse_heating = None
        self.impulse_start = None

        # Command Translation
        self.commands = {'!A': 'Get internal name',
                         '!B': 'Get firmware version',
                         '!C': 'Get values',
                         '!D': 'Get internal errors',
                         '!E': 'Get rain frequency',
                         '!F': 'Get switch status',
                         '!G': 'Set switch open',
                         '!H': 'Set switch closed',
                         'P\d\d\d\d!': 'Set PWM value',
                         '!Q': 'Get PWM value',
                         '!S': 'Get sky IR temperature',
                         '!T': 'Get sensor temperature',
                         '!z': 'Reset RS232 buffer pointers',
                         '!K': 'Get serial number',
                         'v!': 'Query if anemometer enabled',
                         'V!': 'Get wind speed',
                         'M!': 'Get electrical constants',
                         '!Pxxxx': 'Set PWM value to xxxx',
                         }
        self.expects = {'!A': '!N\s+(\w+)!',
                        '!B': '!V\s+([\d\.\-]+)!',
                        '!C': '!6\s+([\d\.\-]+)!4\s+([\d\.\-]+)!5\s+([\d\.\-]+)!',
                        '!D': '!E1\s+([\d\.]+)!E2\s+([\d\.]+)!E3\s+([\d\.]+)!E4\s+([\d\.]+)!',
                        '!E': '!R\s+([\d\.\-]+)!',
                        '!F': '!Y\s+([\d\.\-]+)!',
                        'P\d\d\d\d!': '!Q\s+([\d\.\-]+)!',
                        '!Q': '!Q\s+([\d\.\-]+)!',
                        '!S': '!1\s+([\d\.\-]+)!',
                        '!T': '!2\s+([\d\.\-]+)!',
                        '!K': '!K(\d+)\s*\\x00!',
                        'v!': '!v\s+([\d\.\-]+)!',
                        'V!': '!w\s+([\d\.\-]+)!',
                        'M!': '!M(.{12})',
                        }
        self.delays = {
            '!E': 0.350,
        }

        if self.AAG:
            # Query Device Name
            result = self.query('!A')
            if result:
                self.name = result[0].strip()
                if self.logger:
                    self.logger.info('  Device Name is "{}"'.format(self.name))
            else:
                self.name = ''
                if self.logger:
                    self.logger.warning('  Failed to get Device Name')
                sys.exit(1)

            # Query Firmware Version
            result = self.query('!B')
            if result:
                self.firmware_version = result[0].strip()
                if self.logger:
                    self.logger.info('  Firmware Version = {}'.format(self.firmware_version))
            else:
                self.firmware_version = ''
                if self.logger:
                    self.logger.warning('  Failed to get Firmware Version')
                sys.exit(1)

            # Query Serial Number
            result = self.query('!K')
            if result:
                self.serial_number = result[0].strip()
                if self.logger:
                    self.logger.info('  Serial Number: {}'.format(self.serial_number))
            else:
                self.serial_number = ''
                if self.logger:
                    self.logger.warning('  Failed to get Serial Number')
                sys.exit(1)
dataset/ETHPy150Open panoptes/POCS/scripts/read_weather.py/AAGCloudSensor.__init__/swapped operands of `in`