4 Komitmen edfc148ddd ... 2cbb4922d3

Pembuat SHA1 Pesan Tanggal
  Patryk M. Gutowski 2cbb4922d3 LSC Power Plugs with monitor 1 tahun lalu
  Patryk M. Gutowski b085045210 bluetooth proxy w lazience znow trackerem i proxy 1 tahun lalu
  Patryk M. Gutowski 9273442d84 ff-asia-light-03 - lampka przy biurku 1 tahun lalu
  Patryk M. Gutowski 1d664bb675 akwarium to teraz światlo 1 tahun lalu
5 mengubah file dengan 573 tambahan dan 6 penghapusan
  1. 81 3
      ff-akwarium-plug-01.yaml
  2. 113 0
      ff-asia-light-03.yaml
  3. 3 3
      ff-bath-bt-proxy-02.yaml
  4. 188 0
      lscp01.yaml
  5. 188 0
      lscp02.yaml

+ 81 - 3
ff-akwarium-plug-01.yaml

@@ -1,7 +1,7 @@
 substitutions:
   devicename: ff-akwarium-plug-01
   low_devicename: ff-akwarium-plug-01
-  friendly_devicename: FF Akwarium Plug 01
+  friendly_devicename: FF Akwarium Light 01
 
 esphome:
   name: $devicename
@@ -85,6 +85,9 @@ binary_sensor:
     name: "Power Button"
     on_press:
       - switch.toggle: relay
+      - select.next:
+          id: mode
+          cycle: true
 
 switch:
   - platform: gpio
@@ -102,10 +105,10 @@ switch:
       inverted: false
 
   - platform: gpio
-    name: Switch
     pin: P8
     id: relay
-
+    internal: true 
+    
     # Turn off red LED to show blue when turned on
     on_turn_on:
       - switch.turn_on: led_2
@@ -121,3 +124,78 @@ button:
     id: restart_button
     name: Restart
     entity_category: diagnostic  
+
+
+globals:
+ - id: current_light
+    type: select
+    restore_value: True
+    initial_value: "0"
+
+select:
+  - platform: template
+    name: "Light Mode"
+    id: mode
+    options:
+     - "Off"
+     - "Day"
+     - Daybreak
+     - Night
+    optimistic: true
+    on_value:
+      then:
+        - if:
+            condition:
+              - lambda: |-
+                  return(id(mode).state) == "Off";
+            then:
+              - switch.turn_off: relay
+        - if:
+            condition:
+              - lambda: |-
+                  return(id(mode).state) == "Day";
+            then:
+              - switch.turn_off: relay
+              - delay: 20s
+              - switch.turn_on: relay
+        - if:
+            condition:
+              - lambda: |-
+                  return(id(mode).state) == "Daybreak";
+            then:
+              - switch.turn_off: relay    
+              - delay: 20s
+              - switch.turn_on: relay
+              - delay: 200ms
+              - switch.turn_off: relay
+              - delay: 200ms
+              - switch.turn_on: relay
+          
+        - if:
+            condition:
+              - lambda: |-
+                  return(id(mode).state) == "Night";
+            then:
+              - switch.turn_off: relay    
+              - delay: 20s
+              - switch.turn_on: relay
+              - delay: 200ms
+              - switch.turn_off: relay
+              - delay: 200ms
+              - switch.turn_on: relay
+              - switch.turn_off: relay
+              - delay: 200ms
+              - switch.turn_on: relay
+
+light:
+  - platform: template
+    name: None
+    restore_mode: RESTORE_AND_OFF
+    effects:
+      - lambda:
+          name: Day
+      - lambda:
+          name: Daybreak
+      - lambda:
+          name: Night
+              

+ 113 - 0
ff-asia-light-03.yaml

@@ -0,0 +1,113 @@
+substitutions:
+  devicename: ff-asia-light-03
+  low_devicename: ff_asia_light_03
+  friendly_devicename: FF Asia Light 03
+
+esphome:
+  name: $devicename
+  friendly_name: ${friendly_devicename}
+
+bk72xx:
+  board: generic-bk7231t-qfn32-tuya
+
+# 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
+
+
+text_sensor:
+  #  - platform: debug
+  #  reset_reason:
+  #    name: Reset Reason
+  - platform: libretiny
+    version:
+      name: LibreTiny Version
+packages:
+  diag: !include common/diag.yaml
+
+output:
+  - platform: libretiny_pwm
+    id: output_cold_white
+    frequency: 500Hz
+    pin: P24
+  - platform: libretiny_pwm
+    id: output_warm_white
+    frequency: 500Hz
+    pin: P26
+
+
+# Example configuration entry
+light:
+  - platform: cwww
+    name: ${friendly_devicename}
+    id: the_light
+    cold_white: output_cold_white
+    warm_white: output_warm_white
+    cold_white_color_temperature: 6500 K
+    warm_white_color_temperature: 2700 K
+    constant_brightness: true
+    restore_mode: RESTORE_AND_ON
+    effects:
+      - random:
+          name: "Slow Random"
+          transition_length: 30s
+          update_interval: 30s
+      - random:
+          name: "Fast Random"
+          transition_length: 4s
+          update_interval: 5s
+      - strobe:
+      - flicker:
+          alpha: 50% #The percentage that the last color value should affect the light. More or less the “forget-factor” of an exponential moving average. Defaults to 95%.
+          intensity: 50% #The intensity of the flickering, basically the maximum amplitude of the random offsets. Defaults to 1.5%.
+      - lambda:
+          name: Throb
+          update_interval: 1s
+          lambda: |-
+            static int state = 0;
+            auto call = id(the_light).turn_on();
+            // Transtion of 1000ms = 1s
+            call.set_transition_length(1000);
+            if (state == 0) {
+              call.set_brightness(1.0);
+            } else {
+              call.set_brightness(0.01);
+            }
+            call.perform();
+            state += 1;
+            if (state == 2)
+              state = 0;
+
+## Blink the light if we aren't connected to WiFi.
+## Uncomment below
+#interval:
+#- interval: 500ms
+#  then:
+#  - if:
+#      condition:
+#        not:
+#          wifi.connected:
+#      then:
+#        - light.turn_on:
+#            id: the_light
+#            brightness: 50%
+#            transition_length: 0s
+#        - delay: 250ms
+#        - light.turn_off:
+#            id: the_light
+#            transition_length: 250ms

+ 3 - 3
ff-bath-bt-proxy-02.yaml

@@ -64,15 +64,15 @@ wifi:
   password: !secret iot_password
   domain: .int.mmax.cloud
   
-# esp32_ble_tracker:
+esp32_ble_tracker:
 #  scan_parameters:
     # We currently use the defaults to ensure Bluetooth
     # can co-exist with WiFi In the future we may be able to
     # enable the built-in coexistence logic in ESP-IDF
 #    active: true
 
-bluetooth_proxy:
-  active: true
+# bluetooth_proxy:
+#  active: true
 
 sensor:
   - platform: xiaomi_miscale

+ 188 - 0
lscp01.yaml

@@ -0,0 +1,188 @@
+# 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
+  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

+ 188 - 0
lscp02.yaml

@@ -0,0 +1,188 @@
+# 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