diff options
author | KaufHA <[email protected]> | 2023-01-01 18:18:16 -0700 |
---|---|---|
committer | KaufHA <[email protected]> | 2023-01-01 18:18:16 -0700 |
commit | 15f07946bbde18de8b394fce7a39b616a87d5b33 (patch) | |
tree | 12bcf87d5a4b120fe1e8dfb46d2b10b42094dd0f | |
parent | c79e75c4e4b6943d48e51969317a89abb4c29692 (diff) | |
download | PLF12-15f07946bbde18de8b394fce7a39b616a87d5b33.tar.gz PLF12-15f07946bbde18de8b394fce7a39b616a87d5b33.zip |
minimal not sure
-rw-r--r-- | kauf-plf12-factory.yaml | 6 | ||||
-rw-r--r-- | kauf-plf12-lite.yaml | 3 | ||||
-rw-r--r-- | kauf-plf12-minimal.yaml | 201 |
3 files changed, 210 insertions, 0 deletions
diff --git a/kauf-plf12-factory.yaml b/kauf-plf12-factory.yaml new file mode 100644 index 0000000..5e0127c --- /dev/null +++ b/kauf-plf12-factory.yaml @@ -0,0 +1,6 @@ +packages: + kauf.plf12-base: !include kauf-plf12-base.yaml + kauf.plf10-factory: !include ../PLF10/kauf-plug-factory.yaml + +dashboard_import: + package_import_url: github://KaufHA/PLF12/kauf-plf12.yaml diff --git a/kauf-plf12-lite.yaml b/kauf-plf12-lite.yaml new file mode 100644 index 0000000..174a54a --- /dev/null +++ b/kauf-plf12-lite.yaml @@ -0,0 +1,3 @@ +packages:
+ Kauf.PLF12-Base: github://KaufHA/PLF12/kauf-plf12-base.yaml
+ Kauf.PLF10: github://KaufHA/PLF10/kauf-plug-lite.yaml
diff --git a/kauf-plf12-minimal.yaml b/kauf-plf12-minimal.yaml new file mode 100644 index 0000000..995abee --- /dev/null +++ b/kauf-plf12-minimal.yaml @@ -0,0 +1,201 @@ +# https://esphome.io/guides/configuration-types.html#substitutions +substitutions: + + name: kauf-plug # **** CHANGE DEVICE NAME TO SOMETHING UNIQUE PER DEVICE. RENAME YAML FILE TO SAME NAME. **** + # **** USE DASHES (-) INSTEAD OF SPACES OR UNDERSCORE (_). USE ONLY LOWER CASE LETTERS. **** + + friendly_name: Kauf Plug # **** CHANGE FRIENDLY NAME TO SOMETHING UNIQUE PER DEVICE **** + + # substitutions for power monitoring calibration. Allows end users to change calibration in their yaml and still + # incorporate this file as a package to get all the updates we release. + voltage_divider_val: "2001" + sub_hlw_model: BL0937 + current_resistor_val: "0.001" + power_cal_val1_in: "0.0" + power_cal_val1_out: "0.0" + power_cal_val2_in: "879.4" + power_cal_val2_out: "750" + current_cal_val1_in: "0.0" + current_cal_val1_out: "0.0" + current_cal_val2_in: "6.8" + current_cal_val2_out: "3.5" + voltage_cal_val1_in: "0.0" + voltage_cal_val1_out: "0.0" + voltage_cal_val2_in: "132.7" + voltage_cal_val2_out: "119.1" + + # set power monitoring mode in yaml, selecting the "yaml_configured" option in the select entity will cause these + # values to be used after next reboot. + # https://esphome.io/components/sensor/hlw8012.html#configuration-variables + sub_change_mode_every: "1" + sub_update_interval: 10s + sub_initial_mode: CURRENT + + # GPIO definitions + sub_red_led_pin: GPIO1 + sub_button_pin: GPIO3 + sub_pm_cf_pin: GPIO4 + sub_pm_cf1_pin: GPIO5 + sub_blue_led_pin: GPIO12 + sub_relay_pin: GPIO13 + sub_pm_sel_pin: GPIO14 + +# https://esphome.io/components/esphome.html +esphome: + + name: $name + + # https://esphome.io/components/esphome.html#esphome-creators-project + project: + name: "Kauf.PLF12" + version: "2.02(m)" + + +# https://esphome.io/components/esp8266.html +esp8266: + board: esp01_1m + restore_from_flash: true + early_pin_init: false + + +# https://esphome.io/components/wifi.html +wifi: + + # **** ENTER WI-FI CREDENTIALS HERE, USING SECRETS.YAML RECOMMENDED **** + ssid: initial_ap # !secret my_wifi_ssid + password: asdfasdfasdfasdf # !secret my_wifi_pass + + # default is 20, 17 is recommended. + output_power: 17 + + # using fast_connect as default since it is required for hidden networks. + # feel free to change or override. + fast_connect: true + + ap: + + +captive_portal: # https://esphome.io/components/captive_portal.html +web_server: # https://esphome.io/components/web_server.html +logger: # https://esphome.io/components/logger.html +api: # https://esphome.io/components/api.html +ota: # https://esphome.io/components/ota.html + + +# https://esphome.io/components/status_led.html +# red led, blink when not connected to wifi or Home Assistant +status_led: + pin: + number: GPIO0 + inverted: true + + +# https://esphome.io/components/binary_sensor/index.html +binary_sensor: + + # button input toggles relay and thereby blue led + # https://esphome.io/components/binary_sensor/gpio.html + - platform: gpio + id: button + name: $friendly_name Button + pin: + number: GPIO13 + mode: + input: true + pullup: true + inverted: true + + filters: + - delayed_on: 50ms + + on_press: + then: + switch.toggle: relay + + +# https://esphome.io/components/switch/index.html +# https://esphome.io/components/switch/gpio.html +switch: + + # blue LED follows relay power state + - platform: gpio + id: blue_led + pin: + number: GPIO2 + inverted: true + + # relay output + - platform: gpio + id: relay + name: $friendly_name + pin: GPIO4 + + # automatically make blue led equal relay state + on_turn_on: + - switch.turn_on: blue_led + on_turn_off: + - switch.turn_off: blue_led + + +# clock input from Home Assistant used to calculate total daily energy +# https://esphome.io/components/time.html#home-assistant-time-source +time: + - platform: homeassistant + id: homeassistant_time + + +# https://esphome.io/components/sensor/index.html +sensor: # Power monitoring sensors output to Home Assistant + + # https://esphome.io/components/sensor/hlw8012.html + - platform: hlw8012 + id: hlw_main + sel_pin: + number: $sub_pm_sel_pin + inverted: True + cf_pin: $sub_pm_cf_pin + cf1_pin: $sub_pm_cf1_pin + current_resistor: $current_resistor_val + voltage_divider: $voltage_divider_val + + change_mode_every: $sub_change_mode_every + update_interval: $sub_update_interval + initial_mode: $sub_initial_mode + + model: $sub_hlw_model + + power: + name: ${friendly_name} Power + unit_of_measurement: W + id: wattage + filters: + - calibrate_linear: + - $power_cal_val1_in -> $power_cal_val1_out + - $power_cal_val2_in -> $power_cal_val2_out + + current: + name: ${friendly_name} Current + unit_of_measurement: A + id: current + filters: + - calibrate_linear: + - $current_cal_val1_in -> $current_cal_val1_out + - $current_cal_val2_in -> $current_cal_val2_out + + voltage: + name: ${friendly_name} Voltage + unit_of_measurement: V + id: voltage + filters: + - calibrate_linear: + - $voltage_cal_val1_in -> $voltage_cal_val1_out + - $voltage_cal_val2_in -> $voltage_cal_val2_out + + # Reports the total Power so-far each day, resets at midnight + # https://esphome.io/components/sensor/total_daily_energy.html + - platform: total_daily_energy + name: ${friendly_name} Total Daily Energy + power_id: wattage + filters: + - multiply: 0.001 ## convert Wh to kWh + unit_of_measurement: kWh |