Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- substitutions:
- plug_name: lodowka
- # Higher value gives lower watt readout
- current_res: "0.00221"
- # Lower value gives lower voltage readout
- voltage_div: "945"
- esphome:
- name: lodowka
- platform: ESP8266
- board: esp8285
- # WiFi connection
- wifi:
- ssid: 'lan'
- password: 'pass'
- manual_ip:
- static_ip: 192.168.1.94
- gateway: 192.168.1.100
- subnet: 255.255.255.0
- dns1: 192.168.1.100
- dns2: 192.168.1.100
- # Enable logging
- logger:
- # Enable Web server
- #web_server:
- # port: 80
- # Enable Home Assistant API
- api:
- password: 'PASSWORD'
- ota:
- password: 'PASSWORD'
- time:
- - platform: homeassistant
- id: homeassistant_time
- binary_sensor:
- - platform: gpio
- name: "${plug_name}_button"
- pin:
- number: GPIO3
- inverted: True
- on_press:
- - switch.toggle: relay
- - platform: status
- name: ${plug_name}_Status
- switch:
- - platform: gpio
- id: relay
- name: "${plug_name}_Relay"
- pin: GPIO14
- icon: mdi:power-socket-eu
- restore_mode: ALWAYS_ON
- on_turn_on:
- - switch.turn_on: blue_led
- on_turn_off:
- - switch.turn_off: blue_led
- - platform: gpio
- id: blue_led
- name: "${plug_name}_LED_Blue"
- icon: mdi:led-on
- pin: GPIO1
- inverted: True
- restore_mode: ALWAYS_ON
- - platform: gpio
- id: red_led
- name: "${plug_name}_LED_Red"
- pin: GPIO13
- inverted: True
- restore_mode: ALWAYS_OFF
- sensor:
- - platform: hlw8012
- sel_pin:
- number: GPIO12
- inverted: True
- cf_pin: GPIO04
- cf1_pin: GPIO05
- # Higher value gives lower watt readout
- current_resistor: 0.00221
- # Lower value gives lower voltage readout
- voltage_divider: 794
- current:
- name: "${plug_name}_Amperage"
- icon: mdi:current-ac
- unit_of_measurement: A
- voltage:
- name: "${plug_name}_Voltage"
- icon: mdi:flash-circle
- unit_of_measurement: V
- power:
- name: "${plug_name}_Wattage"
- unit_of_measurement: W
- id: "${plug_name}_Wattage"
- change_mode_every: 8
- update_interval: 10s
- - platform: total_daily_energy
- name: "${plug_name}_Total Daily Energy"
- icon: mdi:circle-slice-3
- power_id: "${plug_name}_Wattage"
- filters:
- # Multiplication factor from W to kW is 0.001
- - multiply: 0.001
- unit_of_measurement: kWh
- # Extra sensor to keep track of plug uptime
- - platform: uptime
- id: uptime_sec
- text_sensor:
- - platform: template
- name: ${plug_name}_Uptime Sensor
- lambda: |-
- int seconds = (id(uptime_sec).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 { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
- icon: mdi:clock-start
- update_interval: 113s
- # - platform: uptime
- # name: ${plug_name}_Uptime Sensor
- # - platform: wifi_signal
- # name: ${plug_name}_Wi-Fi_Signal
- # update_interval: 60s
- #text_sensor:
- # - platform: version
- # name: ${plug_name}_firmware_version
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement