aboutsummaryrefslogtreecommitdiffhomepage
path: root/config/kauf-plf12-minimal.yaml
diff options
context:
space:
mode:
authorKaufHA <[email protected]>2024-05-14 13:32:23 -0700
committerKaufHA <[email protected]>2024-05-14 13:32:23 -0700
commitcefc8013f6e9b9545bfb74ba6d5e56cceeab5429 (patch)
tree50671898fc136f44f008fa295ca2c5c6245fabcb /config/kauf-plf12-minimal.yaml
parent5bc4d2c50e5d683b3eb994e338deb0beab65d6b2 (diff)
downloadPLF12-cefc8013f6e9b9545bfb74ba6d5e56cceeab5429.tar.gz
PLF12-cefc8013f6e9b9545bfb74ba6d5e56cceeab5429.zip
move configs to subdir
Diffstat (limited to 'config/kauf-plf12-minimal.yaml')
-rw-r--r--config/kauf-plf12-minimal.yaml203
1 files changed, 203 insertions, 0 deletions
diff --git a/config/kauf-plf12-minimal.yaml b/config/kauf-plf12-minimal.yaml
new file mode 100644
index 0000000..48dcd3f
--- /dev/null
+++ b/config/kauf-plf12-minimal.yaml
@@ -0,0 +1,203 @@
+# 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: $sub_red_led_pin
+ 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: $sub_button_pin
+ 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: $sub_blue_led_pin
+ inverted: true
+ restore_mode: RESTORE_DEFAULT_ON
+
+ # relay output
+ - platform: gpio
+ id: relay
+ name: $friendly_name
+ pin: $sub_relay_pin
+ restore_mode: RESTORE_DEFAULT_ON
+
+ # 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