changeset 1701:33747dcf57ea

rf_switch_desk update
author drewp@bigasterisk.com
date Tue, 19 Oct 2021 22:29:26 -0700
parents 11bd81eda1ef
children ac1ae0c21bb0
files .hgignore espNode/rf_switch_desk.yaml espNode/rfsetup.yaml espNode/tasks.py
diffstat 4 files changed, 65 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Tue Oct 12 20:18:59 2021 -0700
+++ b/.hgignore	Tue Oct 19 22:29:26 2021 -0700
@@ -17,6 +17,10 @@
 espNode/camtest
 espNode/ESP32CAM-MQTT
 espNode/theater_blaster
+espNode/garage_hall_cam/src/esphome
+espNode/office_back_cam/src/esphome
+espNode/rf_switch_desk/src/esphome
+espNode/workshop/src/esphome
 lib/*/*.egg-info
 lib/*/dist
 service/arduinoNode/arduino-libraries/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/espNode/rf_switch_desk.yaml	Tue Oct 19 22:29:26 2021 -0700
@@ -0,0 +1,54 @@
+# facing the receiver board,
+#  pins: 3v3  |  (cs)  | D15   | gnd
+
+
+esphome:
+  name: rf_switch_desk
+  platform: esp32
+  board: lolin32
+
+
+logger:
+  baud_rate: 115200
+  level: VERBOSE
+  logs:
+    out: VERBOSE
+
+
+wifi:
+  networks:
+  - ssid: !secret wifi_ssid
+    password: !secret wifi_password
+
+
+ota:
+
+
+mqtt:
+  broker: '10.2.0.1'
+  port: 1883
+  username: ''
+  password: ''
+
+
+remote_receiver:
+  - id: rf_in
+    pin:
+      number: GPIO15
+    tolerance: 20%
+    filter: 250us
+    idle: 8ms
+    dump: rc_switch
+    on_rc_switch:
+      then:
+#        - logger.log:
+#            level: INFO
+#            tag: out
+#            format: "RF read; proto %d; code %08llx"
+#            args: [x.protocol, x.code]
+        - mqtt.publish_json:
+            topic: rf_switch_desk/rf_received
+            payload: !lambda |-
+              root["protocol"] = x.protocol;
+              root["code0"] = static_cast<unsigned long>(x.code >> 32);
+              root["code1"] = static_cast<unsigned long>(x.code & 0xffff);
--- a/espNode/rfsetup.yaml	Tue Oct 12 20:18:59 2021 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-esphome:
-  name: rfsetup
-  platform: esp32
-  board: lolin32
-            
-logger:
-  baud_rate: 115200
-  level: VERBOSE
-  logs:
-    out: VERBOSE
-
-wifi:
-  ssid: !secret wifi_ssid
-  password: !secret wifi_password
-  # use_address: 10.2.0.38
-
-ota:
-
-mqtt:
-  broker: '10.2.0.1'
-  port: 1883
-  username: ''
-  password: ''
-  
-
-remote_receiver:
-  - id: rf_in
-    pin: GPIO4
-    tolerance: 20%
-    filter: 250us
-    idle: 8ms
-    dump: rc_switch
-    on_rc_switch:
-      then:
-        # - logger.log: 
-        #     level: INFO
-        #     tag: out
-        #     format: "RF read; proto %d; code %08llx"
-        #     args: [x.protocol, x.code]
-        - mqtt.publish_json:
-            topic: rfsetup/rf_received
-            payload: !lambda |-
-              root["protocol"] = x.protocol;
-              root["code0"] = static_cast<unsigned long>(x.code >> 32); 
-              root["code1"] = static_cast<unsigned long>(x.code & 0xffff);
--- a/espNode/tasks.py	Tue Oct 12 20:18:59 2021 -0700
+++ b/espNode/tasks.py	Tue Oct 19 22:29:26 2021 -0700
@@ -1,8 +1,11 @@
 from invoke import task
 
-tag = 'esphome/esphome:dev'
+port = '/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0'
+
+tag = 'esphome/esphome'
+
 esphome = f'docker run --rm -v `pwd`:/config -v /usr/share/fonts:/usr/share/fonts -it {tag}'
-esphomeUsb = esphome.replace('--rm', '--rm --device=/dev/ttyUSB0')
+esphomeUsb = esphome.replace('--rm', f'--rm --device={port}')
 # on dash for lcd code for theater display:
 #tag = 'esphome_dev'
 #esphome = '/home/drewp/Downloads/esphome/env/bin/esphome'
@@ -20,7 +23,7 @@
     board = board.replace('.yaml', '')
     print('connect gnd, 3v3, rx/tx per https://randomnerdtutorials.com/esp32-cam-video-streaming-web-server-camera-home-assistant/, ')
     print('rts to reset (if possible), dtr to gpio0 per https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection#automatic-bootloader')
-    ctx.run(f"{esphomeUsb} run {board}.yaml --device=/dev/ttyUSB0", pty=True)
+    ctx.run(f"{esphomeUsb} run {board}.yaml --device={port}", pty=True, echo=True)
 
 @task
 def program_board_over_wifi(ctx, board):
@@ -30,7 +33,7 @@
 @task
 def monitor_usb(ctx, board):
     board = board.replace('.yaml', '')
-    ctx.run(f"{esphomeUsb} logs {board}.yaml --device=/dev/ttyUSB0", pty=True)
+    ctx.run(f"{esphomeUsb} logs {board}.yaml --device={port}", pty=True)
 
 # device up?
 #  nmap -Pn -p 3232,6053 10.2.0.21