Bläddra i källkod

2024.06 update OTA and api key in package

Patryk M. Gutowski 1 år sedan
förälder
incheckning
1b56094afa
13 ändrade filer med 41 tillägg och 474 borttagningar
  1. 2 5
      bath_basic.yaml
  2. 2 1
      common/keys.yaml
  3. 1 0
      dashboard.sh
  4. 4 8
      ff-akwarium-plug-01.yaml
  5. 4 11
      ff-ala-rgb-01.yaml
  6. 5 11
      ff-asia-light-03.yaml
  7. 5 10
      ff-bath-bt-proxy-02.yaml
  8. 5 11
      gf-bt-proxy-01.yaml
  9. 4 12
      gf-office-rgb-02.yaml
  10. 4 8
      lscp01.yaml
  11. 0 199
      lscp01.yaml~
  12. 5 10
      lscp02.yaml
  13. 0 188
      lscp02.yaml~

+ 2 - 5
bath_basic.yaml

@@ -5,6 +5,8 @@ substitutions:
   friendly_devicename: FF Bath Fan Controller
 
 packages:
+  # Enable Home Assistant API
+  esphome: !include common/keys.yaml
   diag: !include common/diag.yaml
 
 # Basic Config
@@ -22,11 +24,6 @@ wifi:
   domain: .int.mmax.cloud
 
 logger:
-api:
-  encryption:
-    key: "ejeMnlF5M60w/yuYwAWn/kIBz701xLwVkUGf9iN8uLA="
-ota:
-  password: "73cea25506d095b4970dedc41e2399fb"
 
 # Device Specific Config
 binary_sensor:

+ 2 - 1
common/keys.yaml

@@ -4,5 +4,6 @@ api:
     key: "ejeMnlF5M60w/yuYwAWn/kIBz701xLwVkUGf9iN8uLA="
 
 ota:
-  password: "2c27af3ab81f992e23745c20ab5dfc02"
+  - platform: esphome
+    password: "2c27af3ab81f992e23745c20ab5dfc02"
 

+ 1 - 0
dashboard.sh

@@ -1,3 +1,4 @@
+sudo podman pull ghcr.io/esphome/esphome:latest
 #sudo podman  run --rm -v "${PWD}":/config -p 6052:6052 -e ESPHOME_DASHBOARD_USE_PING=true  --device=/dev/ttyUSB0 -it ghcr.io/esphome/esphome
 sudo podman  run --rm -v "${PWD}":/config -p 6052:6052 -e ESPHOME_DASHBOARD_USE_PING=true -it ghcr.io/esphome/esphome:latest
 #sudo podman  run --rm -v "${PWD}":/config -p 6052:6052  --device=/dev/ttyUSB0 -it ghcr.io/esphome/esphome

+ 4 - 8
ff-akwarium-plug-01.yaml

@@ -12,20 +12,16 @@ bk72xx:
   #framework:
   #   version: dev
 
+packages:
+  # Enable Home Assistant API
+  esphome: !include common/keys.yaml
+
 # Enable logging
 logger:
 
 web_server:
   port: 80
   
-# Enable Home Assistant API
-api:
-  encryption:
-    key: "ejeMnlF5M60w/yuYwAWn/kIBz701xLwVkUGf9iN8uLA="
-
-ota:
-  password: "2c27af3ab81f992e23745c20ab5dfc02"
-
 wifi:
   ssid: !secret iot_ssid
   password: !secret iot_password

+ 4 - 11
ff-ala-rgb-01.yaml

@@ -10,7 +10,10 @@ esphome:
 bk72xx:
   board: generic-bk7231n-qfn32-tuya
 
-
+packages:
+  # Enable Home Assistant API
+  esphome: !include common/keys.yaml
+  diag: !include common/diag.yaml
 
 # Enable logging
 logger:
@@ -18,14 +21,6 @@ logger:
 web_server:
   port: 80
   
-# Enable Home Assistant API
-api:
-  encryption:
-    key: "ejeMnlF5M60w/yuYwAWn/kIBz701xLwVkUGf9iN8uLA="
-
-ota:
-  password: "2c27af3ab81f992e23745c20ab5dfc02"
-
 wifi:
   ssid: !secret iot_ssid
   password: !secret iot_password
@@ -39,8 +34,6 @@ text_sensor:
   - platform: libretiny
     version:
       name: LibreTiny Version
-packages:
-  diag: !include common/diag.yaml
 
 bp5758d:
   clock_pin: P26

+ 5 - 11
ff-asia-light-03.yaml

@@ -10,20 +10,17 @@ esphome:
 bk72xx:
   board: generic-bk7231t-qfn32-tuya
 
+packages:
+  # Enable Home Assistant API
+  esphome: !include common/keys.yaml
+  diag: !include common/diag.yaml
+
 # Enable logging
 logger:
 
 web_server:
   port: 80
   
-# Enable Home Assistant API
-api:
-  encryption:
-    key: "ejeMnlF5M60w/yuYwAWn/kIBz701xLwVkUGf9iN8uLA="
-
-ota:
-  password: "2c27af3ab81f992e23745c20ab5dfc02"
-
 wifi:
   ssid: !secret iot_ssid
   password: !secret iot_password
@@ -37,9 +34,6 @@ text_sensor:
   - platform: libretiny
     version:
       name: LibreTiny Version
-packages:
-  diag: !include common/diag.yaml
-
 output:
   - platform: libretiny_pwm
     id: output_cold_white

+ 5 - 10
ff-bath-bt-proxy-02.yaml

@@ -23,9 +23,6 @@ globals:
     type: float
     initial_value: '20.0'
 
-packages:
-  diag: !include common/diag.yaml
-
 esphome:
   name: $devicename
   friendly_name: $friendly_devicename
@@ -45,19 +42,17 @@ esp32:
       # CONFIG_INT_WDT: n
       # CONFIG_TASK_WDT: n
 
+packages:
+  # Enable Home Assistant API
+  esphome: !include common/keys.yaml
+  diag: !include common/diag.yaml
+
 # Enable logging
 logger:
 
 web_server:
   port: 80
   
-# Enable Home Assistant API
-api:
-  encryption:
-    key: "ejeMnlF5M60w/yuYwAWn/kIBz701xLwVkUGf9iN8uLA="
-
-ota:
-  password: "2c27af3ab81f992e23745c20ab5dfc02"
 
 wifi:
   ssid: !secret iot_ssid

+ 5 - 11
gf-bt-proxy-01.yaml

@@ -7,29 +7,23 @@ esphome:
   name: $devicename
   friendly_name: $friendly_devicename
 
-packages:
-  diag: !include common/diag.yaml
-
 esp32:
   board: esp32dev
   framework:
     type: arduino
     # type: esp-idf
 
+packages:
+   # Enable Home Assistant API
+  esphome: !include common/keys.yaml
+  diag: !include common/diag.yaml
+
 # Enable logging
 logger:
 
 web_server:
   port: 80
   
-# Enable Home Assistant API
-api:
-  encryption:
-    key: "ejeMnlF5M60w/yuYwAWn/kIBz701xLwVkUGf9iN8uLA="
-
-ota:
-  password: "2c27af3ab81f992e23745c20ab5dfc02"
-
 wifi:
   ssid: !secret iot_ssid
   password: !secret iot_password

+ 4 - 12
gf-office-rgb-02.yaml

@@ -10,7 +10,10 @@ esphome:
 bk72xx:
   board: generic-bk7231t-qfn32-tuya
 
-
+packages:
+  # Enable Home Assistant API
+  esphome: !include common/keys.yaml
+  diag: !include common/diag.yaml
 
 # Enable logging
 logger:
@@ -18,14 +21,6 @@ logger:
 web_server:
   port: 80
   
-# Enable Home Assistant API
-api:
-  encryption:
-    key: "ejeMnlF5M60w/yuYwAWn/kIBz701xLwVkUGf9iN8uLA="
-
-ota:
-  password: "2c27af3ab81f992e23745c20ab5dfc02"
-
 wifi:
   ssid: !secret iot_ssid
   password: !secret iot_password
@@ -39,9 +34,6 @@ text_sensor:
   - platform: libretiny
     version:
       name: LibreTiny Version
-packages:
-  diag: !include common/diag.yaml
-
 bp5758d:
   clock_pin: P24
   data_pin: P26

+ 4 - 8
lscp01.yaml

@@ -14,19 +14,15 @@ bk72xx:
   #framework:
   #   version: dev
 
+packages:
+  # Enable Home Assistant API
+  esphome: !include common/keys.yaml
+
 # Enable logging
 logger:
 
 web_server:
   port: 80
-  
-# Enable Home Assistant API
-api:
-  encryption:
-    key: "ejeMnlF5M60w/yuYwAWn/kIBz701xLwVkUGf9iN8uLA="
-
-ota:
-  password: "2c27af3ab81f992e23745c20ab5dfc02"
 
 wifi:
   ssid: !secret iot_ssid

+ 0 - 199
lscp01.yaml~

@@ -1,199 +0,0 @@
-# https://github.com/FlorianSoler/OpenBeken-Action-lsc-smartplug-with-monitoring-guide/tree/main?tab=readme-ov-file
-substitutions:
-  devicename: lscp01
-  low_devicename: lscp01
-  friendly_devicename: LSC Plug 01
-  
-esphome:
-  name: $devicename
-  friendly_name: $friendly_devicename
-
-bk72xx:
-  board: generic-bk7231t-qfn32-tuya
-  #framework:
-  #   version: dev
-
-# Enable logging
-logger:
-
-web_server:
-  port: 80
-  
-# Enable Home Assistant API
-api:
-  encryption:
-    key: "ejeMnlF5M60w/yuYwAWn/kIBz701xLwVkUGf9iN8uLA="
-
-ota:
-  password: "2c27af3ab81f992e23745c20ab5dfc02"
-
-wifi:
-  ssid: !secret iot_ssid
-  password: !secret iot_password
-  domain: .int.mmax.cloud
-
-
-sensor:
-  - platform: wifi_signal
-    name: "WiFi Signal Sensor"
-    update_interval: 60s
-
-  - platform: uptime
-    name: Uptime Sensor
-    id: uptime_sensor
-    update_interval: 60s
-    on_raw_value:
-      then:
-        - text_sensor.template.publish:
-            id: uptime_human
-            state: !lambda |-
-              int seconds = round(id(uptime_sensor).raw_state);
-              int days = seconds / (24 * 3600);
-              seconds = seconds % (24 * 3600);
-              int hours = seconds / 3600;
-              seconds = seconds % 3600;
-              int minutes = seconds /  60;
-              seconds = seconds % 60;
-              return (
-                (days ? to_string(days) + "d " : "") +
-                (hours ? to_string(hours) + "h " : "") +
-                (minutes ? to_string(minutes) + "m " : "") +
-                (to_string(seconds) + "s")
-              ).c_str();
-#
-# power monitoring
-#
-    # PC191HA includes a BL0937 chip for measuring power consumption
-    #     and BL0937 is a variation of hlw8012, but using inverted SEL pin functionality
-  - platform: hlw8012
-    model: BL0937     # note that the model must be specified to use special calculation parameters
-    sel_pin:          # I believe that cf_pin reports either Voltage or Current depending on this select pin
-      inverted: false  # determine whether true reports Voltage
-      number: P11
-    cf_pin:           # current or voltage (ele_pin: 7)
-      inverted: true  # the logic of BL0937 is opposite from HLW8012
-      number: P24
-    cf1_pin:          #  Power (vi_pin: 8)
-      inverted: true  # the logic of BL0937 is opposite from HLW8012
-      number: P26
-    update_interval: 2s
-
-    # PC191HA measures and returns Voltage OR Current according to the value of sel_pin,
-    #     but it can change the value of sel_pin periodically
-    initial_mode: "VOLTAGE"
-    change_mode_every: 4294967295
-    # Adjust according to the actual resistor values on board to calibrate the specific unit
-    voltage_divider:  "895"               # LOWER VALUE GIVES LOWER VOLTAGE
-    current_resistor: "0.0006"          # HIGHER VALUE GIVES LOWER WATTAGE
-
-# how the power monitoring values are returned to ESPHome
-    voltage:
-      name: $friendly_devicename Voltage
-      id:   ${low_devicename}_voltage
-      unit_of_measurement: V
-      accuracy_decimals: 1
-      filters:
-        - skip_initial: 2
-    power:
-      name: $friendly_devicename Power
-      id:   ${low_devicename}_power
-      unit_of_measurement: W
-      accuracy_decimals: 2
-      filters:
-        - skip_initial: 2
-    # current:
-    #  name: $friendly_devicename Current
-    #  id:   ${low_devicename}_current
-    #  unit_of_measurement: A
-    #  accuracy_decimals: 3
-    #  filters:
-    #    - multiply: 0.18
-    #    - skip_initial: 2
-
-    # power is simply current x voltage -- except that the pc191ha doesn't follow that formula.
-        # Setting current_resistor to give an accurate Amperage does NOT also give the correct Wattage
-        # my work-around is to calculate current from power / voltage
-        #  - platform: template  
-        #    name: $friendly_devicename Current
-        #    id:   ${low_devicename}_current
-        #    unit_of_measurement: A
-        #    accuracy_decimals: 2
-        #    update_interval: $update_interval_seconds
-        #    lambda: |-
-        #      return (id(${low_devicename}_power).state / id(${low_devicename}_voltage).state);
-        #    filters:  
-        #      - skip_initial: 5     # give time for data to settle to avoid NaN
-  - platform: total_daily_energy
-    name: $friendly_devicename daily consumption
-    id: ${low_devicename}_total_daily_energy
-    power_id: ${low_devicename}_power
-    filters: 
-      - multiply: 0.001 # to kWh
-    unit_of_measurement: kWh
-
-
-text_sensor:
-  - platform: template
-    name: Uptime Human Readable
-    id: uptime_human
-    icon: mdi:clock-start
-  - platform: wifi_info
-    ip_address:
-      name: IP Address
-      entity_category: diagnostic
-
-light:
-  - platform: status_led
-    name: "led"
-    internal: true
-    id: led
-    pin:
-      number: P8
-      inverted: true
-
-status_led:
-    pin:
-      number: P10
-      inverted: true
-
-binary_sensor:
-  - platform: status
-    name: Status
-    entity_category: diagnostic
-
-  - platform: gpio
-    pin:
-      number: P7
-      mode:
-        input: true
-        pullup: true
-      inverted: true
-    id: button1
-    filters:
-      - delayed_on: 50ms
-      - delayed_off: 50ms
-    on_click:
-      - switch.toggle: outlet
-
-  - platform: status
-    name: ${friendly_devicename} status
-
-switch:
-  - platform: gpio
-    name: ${friendly_devicename} Outlet
-    id: outlet
-    pin: P6
-    icon: mdi:power-socket-eu
-    on_turn_on:
-      - light.turn_on: led
-    on_turn_off:
-      - light.turn_off: led
-    restore_mode: RESTORE_DEFAULT_OFF
-  # Switch to restart the plug
-  - platform: restart
-    name: ${friendly_devicename} Restart Switch
-
-# Enable time component to reset energy at midnight
-time:
-  - platform: homeassistant
-    id: homeassistant_time

+ 5 - 10
lscp02.yaml

@@ -14,19 +14,14 @@ bk72xx:
   #framework:
   #   version: dev
 
-# Enable logging
+packages:
+  # Enable Home Assistant API
+  esphome: !include common/keys.yaml
+
 logger:
 
 web_server:
   port: 80
-  
-# Enable Home Assistant API
-api:
-  encryption:
-    key: "ejeMnlF5M60w/yuYwAWn/kIBz701xLwVkUGf9iN8uLA="
-
-ota:
-  password: "2c27af3ab81f992e23745c20ab5dfc02"
 
 wifi:
   ssid: !secret iot_ssid
@@ -242,4 +237,4 @@ switch:
 # Enable time component to reset energy at midnight
 time:
   - platform: homeassistant
-    id: homeassistant_time
+    id: homeassistant_time

+ 0 - 188
lscp02.yaml~

@@ -1,188 +0,0 @@
-# https://github.com/FlorianSoler/OpenBeken-Action-lsc-smartplug-with-monitoring-guide/tree/main?tab=readme-ov-file
-substitutions:
-  devicename: lscp02
-  low_devicename: lscp02
-  friendly_devicename: LSC Plug 02
-  update_interval_seconds: "15s"
-  
-esphome:
-  name: $devicename
-  friendly_name: $friendly_devicename
-
-bk72xx:
-  board: generic-bk7231t-qfn32-tuya
-  #framework:
-  #   version: dev
-
-# Enable logging
-logger:
-
-web_server:
-  port: 80
-  
-# Enable Home Assistant API
-api:
-  encryption:
-    key: "ejeMnlF5M60w/yuYwAWn/kIBz701xLwVkUGf9iN8uLA="
-
-ota:
-  password: "2c27af3ab81f992e23745c20ab5dfc02"
-
-wifi:
-  ssid: !secret iot_ssid
-  password: !secret iot_password
-  domain: .int.mmax.cloud
-
-
-sensor:
-  - platform: wifi_signal
-    name: "WiFi Signal Sensor"
-    update_interval: 60s
-
-  - platform: uptime
-    name: Uptime Sensor
-    id: uptime_sensor
-    update_interval: 60s
-    on_raw_value:
-      then:
-        - text_sensor.template.publish:
-            id: uptime_human
-            state: !lambda |-
-              int seconds = round(id(uptime_sensor).raw_state);
-              int days = seconds / (24 * 3600);
-              seconds = seconds % (24 * 3600);
-              int hours = seconds / 3600;
-              seconds = seconds % 3600;
-              int minutes = seconds /  60;
-              seconds = seconds % 60;
-              return (
-                (days ? to_string(days) + "d " : "") +
-                (hours ? to_string(hours) + "h " : "") +
-                (minutes ? to_string(minutes) + "m " : "") +
-                (to_string(seconds) + "s")
-              ).c_str();
-#
-# power monitoring
-#
-    # PC191HA includes a BL0937 chip for measuring power consumption
-    #     and BL0937 is a variation of hlw8012, but using inverted SEL pin functionality
-  - platform: hlw8012
-    model: BL0937     # note that the model must be specified to use special calculation parameters
-    sel_pin:          # I believe that cf_pin reports either Voltage or Current depending on this select pin
-      inverted: true  # determine whether true reports Voltage
-      number: P11
-    cf_pin:           # current or voltage (ele_pin: 7)
-      inverted: true  # the logic of BL0937 is opposite from HLW8012
-      number: P24
-    cf1_pin:          #  Power (vi_pin: 8)
-      inverted: true  # the logic of BL0937 is opposite from HLW8012
-      number: P26
-    update_interval: $update_interval_seconds
-
-    # PC191HA measures and returns Voltage OR Current according to the value of sel_pin,
-    #     but it can change the value of sel_pin periodically
-    initial_mode: "VOLTAGE"
-    change_mode_every: "5"
-    # Adjust according to the actual resistor values on board to calibrate the specific unit
-    voltage_divider:  "895"               # LOWER VALUE GIVES LOWER VOLTAGE
-    current_resistor: "0.0006"          # HIGHER VALUE GIVES LOWER WATTAGE
-
-# how the power monitoring values are returned to ESPHome
-    voltage:
-      name: $friendly_devicename Voltage
-      id:   ${low_devicename}_voltage
-      unit_of_measurement: V
-      accuracy_decimals: 1
-      filters:
-        - skip_initial: 2
-    power:
-      name: $friendly_devicename Power
-      id:   ${low_devicename}_power
-      unit_of_measurement: W
-      accuracy_decimals: 2
-      filters:
-        - skip_initial: 2
-    current:
-      name: $friendly_devicename Current
-      id:   ${low_devicename}_current
-      unit_of_measurement: A
-      accuracy_decimals: 2
-      filters:
-        - multiply: 0.18
-        - skip_initial: 2
-
-    # power is simply current x voltage -- except that the pc191ha doesn't follow that formula.
-        # Setting current_resistor to give an accurate Amperage does NOT also give the correct Wattage
-        # my work-around is to calculate current from power / voltage
-        #  - platform: template  
-        #    name: $friendly_devicename Current
-        #    id:   ${low_devicename}_current
-        #    unit_of_measurement: A
-        #    accuracy_decimals: 2
-        #    update_interval: $update_interval_seconds
-        #    lambda: |-
-        #      return (id(${low_devicename}_power).state / id(${low_devicename}_voltage).state);
-        #    filters:  
-        #      - skip_initial: 5     # give time for data to settle to avoid NaN
-
-text_sensor:
-  - platform: template
-    name: Uptime Human Readable
-    id: uptime_human
-    icon: mdi:clock-start
-  - platform: wifi_info
-    ip_address:
-      name: IP Address
-      entity_category: diagnostic
-
-light:
-  - platform: status_led
-    name: "led"
-    internal: true
-    id: led
-    pin:
-      number: P8
-      inverted: true
-  - platform: status_led
-    name: "netled"
-    internal: true
-    id: netled
-    pin:
-      number: P10
-      inverted: true
-
-binary_sensor:
-  - platform: status
-    name: Status
-    entity_category: diagnostic
-
-  - platform: gpio
-    pin:
-      number: P7
-      mode:
-        input: true
-        pullup: true
-      inverted: true
-    id: button1
-    filters:
-      - delayed_on: 50ms
-      - delayed_off: 50ms
-    on_click:
-      - switch.toggle: outlet
-
-  - platform: status
-    name: ${friendly_devicename} status
-
-switch:
-  - platform: gpio
-    name: ${friendly_devicename} Outlet
-    id: outlet
-    pin: P6
-    icon: mdi:power-socket-eu
-    on_turn_on:
-      - light.turn_on: led
-    on_turn_off:
-      - light.turn_off: led
-  # Switch to restart the plug
-  - platform: restart
-    name: ${friendly_devicename} Restart Switch