diff options
author | KaufHA <[email protected]> | 2023-07-18 21:37:34 -0700 |
---|---|---|
committer | KaufHA <[email protected]> | 2023-07-18 21:37:34 -0700 |
commit | 0c703cd2fb0750aced8ad208701fae5579d17da2 (patch) | |
tree | 76456c76d84b2d4f7fd0a44b8129a336e3111432 | |
parent | 2973da17141afefd2ccaa19c21021d209de596b0 (diff) | |
download | PLF10-0c703cd2fb0750aced8ad208701fae5579d17da2.tar.gz PLF10-0c703cd2fb0750aced8ad208701fae5579d17da2.zip |
update for ESPHome 2023.7
-rw-r--r-- | kauf-plug-factory.yaml | 100 | ||||
-rw-r--r-- | kauf-plug-lite.yaml | 22 | ||||
-rw-r--r-- | kauf-plug.yaml | 25 |
3 files changed, 9 insertions, 138 deletions
diff --git a/kauf-plug-factory.yaml b/kauf-plug-factory.yaml deleted file mode 100644 index 52125b7..0000000 --- a/kauf-plug-factory.yaml +++ /dev/null @@ -1,100 +0,0 @@ -substitutions: - project_ver_let: "f" - select_monitor_mode_initial_option: " 2s P / 8s V,I" - - -packages: - kauf_plug_update: !include kauf-plug-update.yaml - - -esphome: - on_boot: - then: - - script.execute: script_factory_test - - -script: - - id: script_factory_test - then: - # little sequence so factory can confirm firwmare is working. - - if: - condition: - lambda: 'return id(first_boot);' - then: - - # get AP going ASAP - - lambda: 'wifi_wificomponent->set_ap_timeout(1);' - - # turn on relay - - switch.turn_on: relay - - delay: 1s - - light.turn_off: blue_led - - - delay: 16s - - # ensure all 3 values are reported - - wait_until: - lambda: return(!std::isnan(id(wattage).state) && !std::isnan(id(current).state) && !std::isnan(id(voltage).state)); - - # set scaling factors to expected test load. - # required ranges helps prevent calibration without proper test load. - - lambda: |- - uint32_t num_ok = 0; - - if ( (id(wattage).state > 20) && (id(wattage).state < 40) ) { - auto call = id(scale_power).make_call(); - call.set_value(ceil((10.0f*100.0f*26.800f) / id(wattage).state) / 10.0f); - call.perform(); - num_ok++; - } - if ( (id(current).state > 0.05) && (id(current).state < 1.0) ) { - auto call = id(scale_current).make_call(); - call.set_value(ceil((10.0f*100.0f*0.226f) / id(current).state) / 10.0f); - call.perform(); - num_ok++; - } - if ( (id(voltage).state > 90) && (id(voltage).state < 150) ) { - auto call = id(scale_voltage).make_call(); - call.set_value(ceil((10.0f*100.0f*120.0f) / id(voltage).state) / 10.0f); - call.perform(); - num_ok++; - } - - //test passed, clear first_boot variable so we don't run this again - id(first_boot) = false; - - // finish factory test with results argument - id(finish_factory_test)->execute(num_ok); - - - id: finish_factory_test - parameters: - num_ok: int - then: - - # blink led to indicate finish test until button is pressed then stay on - - while: - condition: - binary_sensor.is_off: button_in - then: - - lambda: |- - if ( num_ok == 3 ) { - auto call = id(blue_led).toggle(); - call.perform(); - } else { - auto call = id(red_led).toggle(); - call.perform(); - } - - delay: 100ms - - # set power monitoring mode to lower frequency default - - select.set: - id: select_monitor_mode - option: "10s P / 40s V,I" - - lambda: global_preferences->sync(); - - -globals: - - id: first_boot # used to run test routine at factory - type: bool - restore_value: yes - initial_value: 'true' diff --git a/kauf-plug-lite.yaml b/kauf-plug-lite.yaml index 2d9cc54..dec62a7 100644 --- a/kauf-plug-lite.yaml +++ b/kauf-plug-lite.yaml @@ -15,7 +15,7 @@ substitutions: # https://esphome.io/components/esphome.html#esphome-creators-project project_name: Kauf.PLF10 - project_ver_num: "2.054" + project_ver_num: "2.055" project_ver_let: l # https://esphome.io/components/switch/gpio.html?highlight=restore_mode @@ -209,6 +209,8 @@ binary_sensor: } - script.execute: $sub_on_release - script.stop: script_30s_timer + filters: + - delayed_on: !lambda return id(number_debounce).state; # indicates whether plugged-in device is running based on configurable threshold. # https://esphome.io/components/binary_sensor/template.html @@ -375,7 +377,6 @@ switch: id: switch_no_hass name: $friendly_name No HASS optimistic: true - restore_state: true entity_category: config disabled_by_default: $disable_entities icon: mdi:toggle-switch-off-outline @@ -393,7 +394,6 @@ switch: id: blue_led name: $friendly_name Blue LED optimistic: true - restore_state: true disabled_by_default: $disable_entities icon: mdi:led-outline restore_mode: RESTORE_DEFAULT_OFF @@ -406,7 +406,6 @@ switch: id: red_led name: $friendly_name Red LED optimistic: true - restore_state: true disabled_by_default: $disable_entities icon: mdi:led-outline restore_mode: RESTORE_DEFAULT_OFF @@ -639,20 +638,7 @@ number: # used as a threshold for whether the plugged-in devices is running unit_of_measurement: "ms" mode: box disabled_by_default: $disable_entities - set_action: # currently rebooting plug to apply new delayed_on time - - script.execute: script_save_changes - - script.execute: script_setting_reboot - on_value: - - lambda: |- - // add a delayed_on filter to the button binary_sensor with time argument from number_debounce. - if ( !id(global_has_debounce) ) { - binary_sensor::DelayedOnFilter *button_delayedonfilter; - button_delayedonfilter = new binary_sensor::DelayedOnFilter(id(number_debounce).state); - button_delayedonfilter->set_component_source("binary_sensor"); - App.register_component(button_delayedonfilter); - id(button_in).add_filters({button_delayedonfilter}); - id(global_has_debounce) = true; - } + # https://esphome.io/components/select/index.html # https://esphome.io/components/select/template.html diff --git a/kauf-plug.yaml b/kauf-plug.yaml index d89ad71..f5b071f 100644 --- a/kauf-plug.yaml +++ b/kauf-plug.yaml @@ -15,7 +15,7 @@ substitutions: # https://esphome.io/components/esphome.html#esphome-creators-project project_name: Kauf.PLF10 - project_ver_num: "2.054" + project_ver_num: "2.055" project_ver_let: y # https://esphome.io/components/switch/gpio.html?highlight=restore_mode @@ -149,7 +149,7 @@ external_components: - source: type: git url: https://github.com/KaufHA/common - ref: v2023.07.03 + ref: v2023.07.18 refresh: never @@ -232,6 +232,8 @@ binary_sensor: } - script.execute: $sub_on_release - script.stop: script_30s_timer + filters: + - delayed_on: !lambda return id(number_debounce).state; # indicates whether plugged-in device is running based on configurable threshold. # https://esphome.io/components/binary_sensor/template.html @@ -401,7 +403,6 @@ switch: id: switch_no_hass name: $friendly_name No HASS optimistic: true - restore_state: true entity_category: config disabled_by_default: $disable_entities icon: mdi:toggle-switch-off-outline @@ -422,7 +423,6 @@ switch: id: blue_led name: $friendly_name Blue LED optimistic: true - restore_state: true disabled_by_default: $disable_entities icon: mdi:led-outline restore_mode: RESTORE_DEFAULT_OFF @@ -438,7 +438,6 @@ switch: id: red_led name: $friendly_name Red LED optimistic: true - restore_state: true disabled_by_default: $disable_entities icon: mdi:led-outline restore_mode: RESTORE_DEFAULT_OFF @@ -454,7 +453,6 @@ switch: id: switch_early_publish name: $friendly_name Early Publish optimistic: true - restore_state: true disabled_by_default: $disable_entities restore_mode: RESTORE_DEFAULT_OFF on_turn_on: @@ -716,20 +714,7 @@ number: # used as a threshold for whether the plugged-in devices is running forced_hash: 2232959069 forced_addr: 40 global_addr: global_forced_addr - set_action: # currently rebooting plug to apply new delayed_on time - - script.execute: script_save_changes - - script.execute: script_setting_reboot - on_value: - - lambda: |- - // add a delayed_on filter to the button binary_sensor with time argument from number_debounce. - if ( !id(global_has_debounce) ) { - binary_sensor::DelayedOnFilter *button_delayedonfilter; - button_delayedonfilter = new binary_sensor::DelayedOnFilter(id(number_debounce).state); - button_delayedonfilter->set_component_source("binary_sensor"); - App.register_component(button_delayedonfilter); - id(button_in).add_filters({button_delayedonfilter}); - id(global_has_debounce) = true; - } + # https://esphome.io/components/select/index.html # https://esphome.io/components/select/template.html |