Mercurial > code > home > repos > homeauto
changeset 1741:097bfd91187d
cam deploy code that might not work
author | drewp@bigasterisk.com |
---|---|
date | Fri, 01 Sep 2023 17:14:25 -0700 |
parents | c77b5ab7b99d |
children | 1c1b38b145f8 |
files | espNode/tasks.py |
diffstat | 1 files changed, 24 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/espNode/tasks.py Fri Sep 01 17:13:51 2023 -0700 +++ b/espNode/tasks.py Fri Sep 01 17:14:25 2023 -0700 @@ -1,9 +1,9 @@ from invoke import task from pathlib import Path -port = '/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0' +port = 'usb-1a86_USB_Serial-if00-port0' -tag = 'docker.io/esphome/esphome:2022.7.0-dev20220807' +tag = 'docker.io/esphome/esphome:2023.2.4' esphome = ( 'docker run --rm ' + # @@ -59,18 +59,6 @@ # nmap -Pn -p 3232,6053 10.2.0.21 -@task -def program_cam_usb(ctx, name='0'): - idVendor = '1a86' - port = f'/dev/serial/by-id/usb-{idVendor}_USB_Serial-if00-port0' - ctx.run( - f"{esphome} " # - + f"-s camname cam{name}" # - + " run cam.yaml " # - + f'--device={port} ', - pty=True, - echo=True) - # -s k v seemed to have no effect def config_replace(in_file, out_file, repls): @@ -88,15 +76,32 @@ return tmp +def replace_yaml_for_cam(inPath, outPath, camName): + config_replace(inPath, outPath, { + '$build_path': outPath.parent, + '$addr': '10.2.0.22', + '$name': camName, + }) + +@task +def program_cam_usb(ctx, name='cam-foo'): + idVendor = '1a86' + port = f'/dev/serial/by-id/usb-{idVendor}_USB_Serial-if00-port0' + tmp = prep_tmp(ctx, 'cam') + tmpyaml = tmp / 'cam.yaml' + replace_yaml_for_cam("cam.yaml", tmpyaml, name) + ctx.run( + f"{esphome} " # + + f" run {tmpyaml} " # + + f'--device={port} ', + pty=True, + echo=True) + @task def program_cam_ota(ctx, name='0'): tmp = prep_tmp(ctx, 'cam') tmpyaml = tmp / 'cam.yaml' - config_replace('cam.yaml', tmpyaml, { - '$build_path': tmp, - '$addr': '10.2.0.22', - '$name': f'cam{name}' - }) + replace_yaml_for_cam("cam.yaml", tmpyaml, name) ctx.run( f"{esphome} " # + f"run {tmpyaml} " #