Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esphome:
- name: ekf_udlinitel
- friendly_name: EKF_udlinitel
- esp8266:
- board: esp01_1m
- # Enable logging
- logger:
- # Enable Home Assistant API
- api:
- encryption:
- key: "ваш ключ"
- reboot_timeout: 15min
- ota:
- password: "ваш пароль"
- wifi:
- ssid: !secret wifi_ssid
- password: !secret wifi_password
- # Enable fallback hotspot (captive portal) in case wifi connection fails
- ap:
- ssid: "Ekf-Udlinitel Fallback Hotspot"
- password: "ваш пароль"
- captive_portal:
- substitutions:
- device_name: ekf_udlinitel
- plug_icon: mdi:power-socket-eu
- plug1_restore: ALWAYS_ON # состояние розетки при подаче питания
- plug2_restore: ALWAYS_ON
- plug3_restore: ALWAYS_ON
- plug4_restore: ALWAYS_ON
- # Higher value gives lower watt readout. Нужно подбирать коэффициент для правильного подсчета потребления
- current_res: "0.0010035"
- # Lower value gives lower voltage readout. Нужно подбирать для правильного отображения вольтажа, по эталону.
- voltage_div: "1713"
- web_server:
- port: 80
- binary_sensor:
- - platform: gpio
- pin:
- number: GPIO16
- inverted: true
- name: "${device_name}_button"
- on_press:
- - switch.toggle: relay4 # кнопка на корпусе будет включать/выключать только 4ю розетку
- - platform: status
- name: "${device_name}_status"
- switch:
- - platform: gpio
- id: green_led
- pin:
- number: GPIO1
- inverted: true
- restore_mode: ALWAYS_OFF
- - platform: gpio
- name: "${device_name}_plug1"
- pin: GPIO15
- id: relay1
- icon: ${plug_icon}
- restore_mode: ${plug1_restore}
- - platform: gpio
- name: "${device_name}_plug2"
- pin: GPIO13
- id: relay2
- icon: ${plug_icon}
- restore_mode: ${plug1_restore}
- - platform: gpio
- name: "${device_name}_plug3"
- pin: GPIO14
- id: relay3
- icon: ${plug_icon}
- restore_mode: ${plug2_restore}
- - platform: gpio
- name: "${device_name}_plug4"
- pin: GPIO3
- id: relay4
- icon: ${plug_icon}
- restore_mode: ${plug3_restore}
- on_turn_on: #при управлении с физической кнопки будет зажигаться гаснуть светодиод
- - switch.turn_on: green_led
- on_turn_off:
- - switch.turn_off: green_led
- sensor:
- - platform: hlw8012
- sel_pin:
- number: GPIO12
- inverted: true
- cf_pin: GPIO04
- cf1_pin: GPIO05
- current:
- name: "${device_name}_current"
- unit_of_measurement: A
- voltage:
- name: "${device_name}_voltage"
- unit_of_measurement: V
- power:
- id: ${device_name}_wattage
- name: "${device_name}_wattage"
- unit_of_measurement: W
- current_resistor: ${current_res}
- voltage_divider: ${voltage_div}
- change_mode_every: 8
- update_interval: 15s
- - platform: total_daily_energy
- name: "${device_name}_daily_energy"
- power_id: ${device_name}_wattage
- filters:
- - multiply: 0.001
- unit_of_measurement: kWh
- - platform: wifi_signal
- name: "${device_name}_rssi"
- update_interval: 5min
- - platform: uptime
- id: uptime_sec
- name: "${device_name}_uptime"
- update_interval: 5min
- text_sensor:
- - platform: template
- name: "${device_name}_upformat"
- lambda: |-
- uint32_t dur = id(uptime_sec).state;
- int dys = 0;
- int hrs = 0;
- int mnts = 0;
- if (dur > 86399) {
- dys = trunc(dur / 86400);
- dur = dur - (dys * 86400);
- }
- if (dur > 3599) {
- hrs = trunc(dur / 3600);
- dur = dur - (hrs * 3600);
- }
- if (dur > 59) {
- mnts = trunc(dur / 60);
- dur = dur - (mnts * 60);
- }
- char buffer[17];
- sprintf(buffer, "%ud %02uh %02um %02us", dys, hrs, mnts, dur);
- return {buffer};
- icon: mdi:clock-start
- update_interval: 5min
- time:
- - platform: homeassistant
- id: homeassistant_time
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement