mirror of
https://github.com/esphome/esphome.git
synced 2024-11-29 12:55:46 +01:00
Remove old checks
This commit is contained in:
parent
b68ad6e6f8
commit
5a269ef284
@ -86,8 +86,6 @@ def run_miniterm(config, port):
|
||||
line = raw.replace('\r', '').replace('\n', '')
|
||||
time = datetime.now().time().strftime('[%H:%M:%S]')
|
||||
message = time + line
|
||||
if core.FROM_DASHBOARD:
|
||||
message = message.replace('\033', '\\033')
|
||||
safe_print(message)
|
||||
|
||||
backtrace_state = platformio_api.process_stacktrace(
|
||||
@ -157,7 +155,7 @@ def upload_program(config, args, port):
|
||||
# if upload is to a serial port use platformio, otherwise assume ota
|
||||
serial_port = port.startswith('/') or port.startswith('COM')
|
||||
if port != 'OTA' and serial_port:
|
||||
if CORE.is_esp8266 and args.dashboard:
|
||||
if CORE.is_esp8266:
|
||||
return upload_using_esptool(config, port)
|
||||
return platformio_api.run_upload(config, args.verbose, port)
|
||||
|
||||
@ -394,24 +392,18 @@ def parse_args(argv):
|
||||
subparsers = parser.add_subparsers(help='Commands', dest='command')
|
||||
subparsers.required = True
|
||||
config = subparsers.add_parser('config', help='Validate the configuration and spit it out.')
|
||||
config.add_argument('--dashboard', help="Internal flag used by the dashboard",
|
||||
action='store_true')
|
||||
|
||||
parser_compile = subparsers.add_parser('compile',
|
||||
help='Read the configuration and compile a program.')
|
||||
parser_compile.add_argument('--only-generate',
|
||||
help="Only generate source code, do not compile.",
|
||||
action='store_true')
|
||||
parser_compile.add_argument('--dashboard', help="Internal flag used by the dashboard",
|
||||
action='store_true')
|
||||
|
||||
parser_upload = subparsers.add_parser('upload', help='Validate the configuration '
|
||||
'and upload the latest binary.')
|
||||
parser_upload.add_argument('--upload-port', help="Manually specify the upload port to use. "
|
||||
"For example /dev/cu.SLAB_USBtoUART.")
|
||||
parser_upload.add_argument('--host-port', help="Specify the host port.", type=int)
|
||||
parser_upload.add_argument('--dashboard', help="Internal flag used by the dashboard",
|
||||
action='store_true')
|
||||
|
||||
parser_logs = subparsers.add_parser('logs', help='Validate the configuration '
|
||||
'and show all MQTT logs.')
|
||||
@ -421,8 +413,6 @@ def parse_args(argv):
|
||||
parser_logs.add_argument('--client-id', help='Manually set the client id.')
|
||||
parser_logs.add_argument('--serial-port', help="Manually specify a serial port to use"
|
||||
"For example /dev/cu.SLAB_USBtoUART.")
|
||||
parser_logs.add_argument('--dashboard', help="Internal flag used by the dashboard",
|
||||
action='store_true')
|
||||
|
||||
parser_run = subparsers.add_parser('run', help='Validate the configuration, create a binary, '
|
||||
'upload it, and start MQTT logs.')
|
||||
@ -435,8 +425,6 @@ def parse_args(argv):
|
||||
parser_run.add_argument('--username', help='Manually set the MQTT username for logs.')
|
||||
parser_run.add_argument('--password', help='Manually set the MQTT password for logs.')
|
||||
parser_run.add_argument('--client-id', help='Manually set the client id for logs.')
|
||||
parser_run.add_argument('--dashboard', help="Internal flag used by the dashboard",
|
||||
action='store_true')
|
||||
|
||||
parser_clean = subparsers.add_parser('clean-mqtt', help="Helper to clear an MQTT topic from "
|
||||
"retain messages.")
|
||||
@ -444,8 +432,6 @@ def parse_args(argv):
|
||||
parser_clean.add_argument('--username', help='Manually set the username.')
|
||||
parser_clean.add_argument('--password', help='Manually set the password.')
|
||||
parser_clean.add_argument('--client-id', help='Manually set the client id.')
|
||||
parser_clean.add_argument('--dashboard', help="Internal flag used by the dashboard",
|
||||
action='store_true')
|
||||
|
||||
subparsers.add_parser('wizard', help="A helpful setup wizard that will guide "
|
||||
"you through setting up esphomeyaml.")
|
||||
@ -455,8 +441,6 @@ def parse_args(argv):
|
||||
subparsers.add_parser('version', help="Print the esphomeyaml version and exit.")
|
||||
|
||||
clean = subparsers.add_parser('clean', help="Delete all temporary build files.")
|
||||
clean.add_argument('--dashboard', help="Internal flag used by the dashboard",
|
||||
action='store_true')
|
||||
|
||||
dashboard = subparsers.add_parser('dashboard',
|
||||
help="Create a simple web server for a dashboard.")
|
||||
@ -474,16 +458,12 @@ def parse_args(argv):
|
||||
hass_config = subparsers.add_parser('hass-config',
|
||||
help="Dump the configuration entries that should be added "
|
||||
"to Home Assistant when not using MQTT discovery.")
|
||||
hass_config.add_argument('--dashboard', help="Internal flag used by the dashboard",
|
||||
action='store_true')
|
||||
|
||||
return parser.parse_args(argv[1:])
|
||||
|
||||
|
||||
def run_esphomeyaml(argv):
|
||||
args = parse_args(argv)
|
||||
if hasattr(args, 'dashboard'):
|
||||
core.FROM_DASHBOARD = args.dashboard
|
||||
|
||||
setup_log(args.verbose)
|
||||
if args.command in PRE_CONFIG_ACTIONS:
|
||||
|
@ -423,4 +423,3 @@ CORE = EsphomeyamlCore()
|
||||
|
||||
ConfigType = Dict[str, Any]
|
||||
CoreType = EsphomeyamlCore
|
||||
FROM_DASHBOARD = False
|
||||
|
@ -78,10 +78,6 @@ class EsphomeyamlCommandWebSocket(tornado.websocket.WebSocketHandler):
|
||||
data = yield self.proc.stdout.read_until_regex('[\n\r]')
|
||||
except tornado.iostream.StreamClosedError:
|
||||
break
|
||||
try:
|
||||
data = data.replace('\033', '\\033')
|
||||
except UnicodeDecodeError:
|
||||
data = data.encode('ascii', 'backslashreplace')
|
||||
self.write_message({'event': 'line', 'data': data})
|
||||
|
||||
def proc_on_exit(self, returncode):
|
||||
@ -103,50 +99,49 @@ class EsphomeyamlLogsHandler(EsphomeyamlCommandWebSocket):
|
||||
def build_command(self, message):
|
||||
js = json.loads(message)
|
||||
config_file = CONFIG_DIR + '/' + js['configuration']
|
||||
return ["esphomeyaml", config_file, "logs", '--serial-port', js["port"], '--dashboard']
|
||||
return ["esphomeyaml", config_file, "logs", '--serial-port', js["port"]]
|
||||
|
||||
|
||||
class EsphomeyamlRunHandler(EsphomeyamlCommandWebSocket):
|
||||
def build_command(self, message):
|
||||
js = json.loads(message)
|
||||
config_file = os.path.join(CONFIG_DIR, js['configuration'])
|
||||
return ["esphomeyaml", config_file, "run", '--upload-port', js["port"],
|
||||
'--dashboard']
|
||||
return ["esphomeyaml", config_file, "run", '--upload-port', js["port"]]
|
||||
|
||||
|
||||
class EsphomeyamlCompileHandler(EsphomeyamlCommandWebSocket):
|
||||
def build_command(self, message):
|
||||
js = json.loads(message)
|
||||
config_file = os.path.join(CONFIG_DIR, js['configuration'])
|
||||
return ["esphomeyaml", config_file, "compile", '--dashboard']
|
||||
return ["esphomeyaml", config_file, "compile"]
|
||||
|
||||
|
||||
class EsphomeyamlValidateHandler(EsphomeyamlCommandWebSocket):
|
||||
def build_command(self, message):
|
||||
js = json.loads(message)
|
||||
config_file = os.path.join(CONFIG_DIR, js['configuration'])
|
||||
return ["esphomeyaml", config_file, "config", '--dashboard']
|
||||
return ["esphomeyaml", config_file, "config"]
|
||||
|
||||
|
||||
class EsphomeyamlCleanMqttHandler(EsphomeyamlCommandWebSocket):
|
||||
def build_command(self, message):
|
||||
js = json.loads(message)
|
||||
config_file = os.path.join(CONFIG_DIR, js['configuration'])
|
||||
return ["esphomeyaml", config_file, "clean-mqtt", '--dashboard']
|
||||
return ["esphomeyaml", config_file, "clean-mqtt"]
|
||||
|
||||
|
||||
class EsphomeyamlCleanHandler(EsphomeyamlCommandWebSocket):
|
||||
def build_command(self, message):
|
||||
js = json.loads(message)
|
||||
config_file = os.path.join(CONFIG_DIR, js['configuration'])
|
||||
return ["esphomeyaml", config_file, "clean", '--dashboard']
|
||||
return ["esphomeyaml", config_file, "clean"]
|
||||
|
||||
|
||||
class EsphomeyamlHassConfigHandler(EsphomeyamlCommandWebSocket):
|
||||
def build_command(self, message):
|
||||
js = json.loads(message)
|
||||
config_file = os.path.join(CONFIG_DIR, js['configuration'])
|
||||
return ["esphomeyaml", config_file, "hass-config", '--dashboard']
|
||||
return ["esphomeyaml", config_file, "hass-config"]
|
||||
|
||||
|
||||
class SerialPortRequestHandler(BaseHandler):
|
||||
|
@ -15,7 +15,7 @@ const initializeColorState = () => {
|
||||
};
|
||||
|
||||
const colorReplace = (pre, state, text) => {
|
||||
const re = /(?:\033|\\033)(?:\[(.*?)[@-~]|\].*?(?:\007|\033\\))/g;
|
||||
const re = /\033(?:\[(.*?)[@-~]|\].*?(?:\007|\033\\))/g;
|
||||
let i = 0;
|
||||
|
||||
if (state.carriageReturn) {
|
||||
|
@ -50,7 +50,6 @@ def cpp_string_escape(string, encoding='utf-8'):
|
||||
|
||||
|
||||
def color(the_color, message=''):
|
||||
from esphomeyaml import core
|
||||
from colorlog.escape_codes import escape_codes, parse_colors
|
||||
|
||||
if not message:
|
||||
@ -58,8 +57,6 @@ def color(the_color, message=''):
|
||||
else:
|
||||
res = parse_colors(the_color) + message + escape_codes['reset']
|
||||
|
||||
if core.FROM_DASHBOARD:
|
||||
res = res.replace('\033', '\\033')
|
||||
return res
|
||||
|
||||
|
||||
|
@ -74,8 +74,6 @@ def show_logs(config, topic=None, username=None, password=None, client_id=None):
|
||||
def on_message(client, userdata, msg):
|
||||
time = datetime.now().time().strftime(u'[%H:%M:%S]')
|
||||
message = time + msg.payload
|
||||
if core.FROM_DASHBOARD:
|
||||
message = message.replace('\033', '\\033')
|
||||
safe_print(message)
|
||||
|
||||
return initialize(config, [topic], on_message, username, password, client_id)
|
||||
|
@ -55,7 +55,6 @@ class RedirectText(object):
|
||||
self._out = out
|
||||
|
||||
def write(self, s):
|
||||
s = s.replace('\033', '\\033')
|
||||
self._out.write(s)
|
||||
|
||||
def flush(self):
|
||||
@ -74,7 +73,6 @@ def run_external_command(func, *cmd, **kwargs):
|
||||
full_cmd = u' '.join(shlex_quote(x) for x in cmd)
|
||||
_LOGGER.info(u"Running: %s", full_cmd)
|
||||
|
||||
if core.FROM_DASHBOARD:
|
||||
sys.stdout = RedirectText(sys.stdout)
|
||||
sys.stderr = RedirectText(sys.stderr)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user