--- substitutions: devicename: powplug4 friendly_name: Kaffeemaschine device_ip: 192.168.178.124 room: Küche upper_room: Wohnung update_interval: 1min reboot_timeout: 7d mqtt_topic_prefix: energy/powplug4/ esphome: esp8266_restore_from_flash: true name: powplug4 platform: ESP8266 board: esp8285 board_flash_mode: dout build_path: builds/powplug4 arduino_version: espressif8266@2.6.2 platformio_options: {} includes: [] libraries: [] globals: - id: activated type: bool restore_value: true initial_value: 'false' logger: baud_rate: 0 tx_buffer_size: 512 hardware_uart: UART0 level: DEBUG logs: {} esp8266_store_log_strings_in_flash: true uart: - rx_pin: 3 baud_rate: 4800 rx_buffer_size: 256 stop_bits: 1 data_bits: 8 parity: NONE time: - platform: homeassistant timezone: CET-1CEST-2,M3.4.0/2,M10.5.0/3 id: ha_time binary_sensor: - platform: status name: Status powplug4 id: powplug4_connect device_class: connectivity - platform: gpio name: Button powplug4 device_class: power id: powplug4_button pin: number: 12 mode: INPUT_PULLUP inverted: true on_press: - then: - switch.toggle: id: powplug4_relay - platform: template name: Kaffeemaschine läuft filters: - delayed_off: 90s lambda: !lambda |- if (isnan(id(power).state)) { // Error reading power consumption return {}; } else if (id(power).state > 2) { // Running and heating return true; } else { // Not running, in standby return false; } sensor: - platform: uptime name: Uptime powplug4 filters: - lambda: !lambda |- return int(x / 60.0); unit_of_measurement: min icon: mdi:alarm update_interval: 1min force_update: true accuracy_decimals: 0 - platform: adc pin: VCC name: Voltage MCU powplug4 unit_of_measurement: V accuracy_decimals: 2 id: powplug4_voltage update_interval: 1min filters: - calibrate_linear: - from: 0.0 to: 0.0 - from: 3.39 to: 3.277 - from: 3.4 to: 3.244 - from: 3.43 to: 3.248 - from: 3.44 to: 3.293 on_value_range: - below: 2.9 then: [] force_update: false icon: mdi:flash - platform: cse7766 update_interval: 1min current: force_update: true name: Current powplug4 unit_of_measurement: A accuracy_decimals: 2 icon: mdi:flash-auto filters: - calibrate_linear: - from: 0.0 to: 0.012 - from: 0.082 to: 0.071 - from: 1.342 to: 1.066 - from: 5.571 to: 4.408 - from: 6.691 to: 5.259 - from: 6.971 to: 5.54 - lambda: !lambda |- if (x < 0.015) return 0; else return (x - 0.012); voltage: id: voltage name: Voltage powplug4 unit_of_measurement: V accuracy_decimals: 1 icon: mdi:flash-circle filters: - calibrate_linear: - from: 0.0 to: 0.0 - from: 0.01 to: 0.01 force_update: false power: id: power name: Power powplug4 unit_of_measurement: W accuracy_decimals: 2 icon: mdi:power-plug filters: - calibrate_linear: - from: 0.0 to: 1.14 - from: 62.062 to: 10.9 - from: 1503.272 to: 247.6 - from: 1599.812 to: 263.7 - from: 3923.677 to: 631.4 - from: 7109.509 to: 1148.0 - lambda: !lambda |- if (x < 1.5) return 0; else return (x - 1.14); on_value_range: - above: 2.0 then: - light.turn_on: id: led state: true - lambda: !lambda |- id(activated) = true; - below: 1.0 then: - light.turn_off: id: led state: false - lambda: !lambda |- id(activated) = false; force_update: false - platform: total_daily_energy force_update: true name: Tagesverbrauch Kaffeemaschine power_id: power icon: mdi:calendar-month filters: - multiply: 0.001 unit_of_measurement: kWh accuracy_decimals: 5 switch: - platform: restart name: Restart powplug4 id: restart_powplug4 icon: mdi:restart - platform: gpio id: powplug4_relay name: Kaffeemaschine pin: number: 14 mode: OUTPUT inverted: false restore_mode: RESTORE_DEFAULT_OFF on_turn_on: - then: - light.turn_on: id: led state: true - lambda: !lambda |- id(activated) = true; on_turn_off: - then: - light.turn_off: id: led state: false - lambda: !lambda |- id(activated) = false; interlock_wait_time: 0ms output: - platform: esp8266_pwm id: state_led pin: number: 13 mode: OUTPUT inverted: false frequency: 1000.0 light: - platform: monochromatic output: state_led id: led restore_mode: RESTORE_DEFAULT_OFF gamma_correct: 2.8 default_transition_length: 1s name: led internal: true status_led: pin: number: 13 inverted: true mode: OUTPUT wifi: reboot_timeout: 7d fast_connect: true domain: !secret 'domain' power_save_mode: NONE manual_ip: static_ip: 192.168.178.124 gateway: !secret 'wifi_dns1' subnet: !secret 'wifi_subnet' dns1: !secret 'wifi_dns1' dns2: !secret 'wifi_dns2' ap: ssid: powplug4 password: !secret 'wifi_ap_password' ap_timeout: 1min output_power: 20.0 networks: - ssid: !secret 'wifi_ssid' password: !secret 'wifi_password' priority: 0.0 use_address: 192.168.178.124 captive_portal: {} api: reboot_timeout: 7d password: !secret 'api_password' port: 6053 ota: safe_mode: true password: !secret 'api_password' port: 8266 web_server: port: 80 auth: username: !secret 'ota_user' password: !secret 'api_password' css_url: https://esphome.io/_static/webserver-v1.min.css js_url: https://esphome.io/_static/webserver-v1.min.js text_sensor: - platform: wifi_info ip_address: name: IP Address powplug4 icon: mdi:wifi