def __init__(self, room, nick=None, **kwargs): self.room = room self.nick = nick self.account = kwargs.get('account') self.password = kwargs.get('password') self.room_pass = kwargs.get('room_pass') self.proxy = kwargs.get('proxy', None) self.users = Users() self.state = RoomState() self.console = Console(self.room, log_path=config.CONFIG_PATH, chat_logging=config.CHAT_LOGGING, use_colors=config.CONSOLE_COLORS) self._connect_args = None self._ws = None self._is_connected = False self._req = 1 captcha.MAX_TRIES = kwargs.get('captcha_tries', 11) captcha.CAPTCHA_TIMEOUT = kwargs.get('captcha_timeout', 5) if self.nick is None or self.nick == '': self.nick = string_util.create_random_string(3, 20)
# This file is executed on every boot (including wake-boot from deepsleep) from machine import I2C, Pin from env import config from util import Wifi, Console, Clock, BME import gc led = Pin(2, Pin.OUT) led.off() i2c = I2C(-1, Pin(5), Pin(4)) console = Console(i2c) # Clear Serial Monitor console.log(['', '', '']) console.log('Hello from boot!') console.log(' Init Wifi', console.y) wifi = Wifi() wifi.connect(config['SSID'], config['PASSWORD']) console.log('IP: ' + wifi.ip, console.y) IS_MAIN_SERVER = config['MAIN_SERVER_IP'] == wifi.ip console.log('Is main: ' + str(IS_MAIN_SERVER), console.y) console.log(' Init Clock', console.y) Clock.fetch_time() Clock.set_time() current_time = Clock.get_time() console.log(current_time, console.y) bme = BME(i2c)