Advertisement
Guest User

Untitled

a guest
Jul 11th, 2022
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.93 KB | None | 0 0
  1. esphome:
  2.   name: skuter
  3.   platform: esp8266
  4.   board: esp01_1m
  5.   esp8266_restore_from_flash: true
  6. # Enable logging
  7. logger:
  8. # Enable Home Assistant API
  9. api:
  10.   encryption:
  11.     key: "key"
  12.  
  13. ota:
  14.   password: "passw"
  15.  
  16. wifi:
  17.   ssid: !secret wifi_ssid
  18.   password: !secret wifi_password
  19. #  use_address: 192.168.254.15
  20. # Optional manual IP
  21.   manual_ip:
  22.     static_ip: 192.168.254.19
  23.     gateway: 192.168.254.254
  24.     subnet: 255.255.255.0
  25.  
  26.   # Enable fallback hotspot (captive portal) in case wifi connection fails
  27.   ap:
  28.     ssid: "Skuter Fallback Hotspot"
  29.     password: "pass"
  30.  
  31. time:
  32.   - platform: homeassistant
  33.     id: homeassistant_time
  34.     timezone: Europe/Warsaw
  35.  
  36. substitutions:
  37.   plug_name: skuter
  38.   # Higher value gives lower watt readout
  39.   current_res: "0.0012"
  40.   # Lower value gives lower voltage readout
  41.   voltage_div: "771"
  42.  
  43. # Enable Web server
  44. web_server:
  45.   port: 80
  46.  
  47. sensor:
  48.   - platform: wifi_signal
  49.     name: "${plug_name} - WiFi Signal"
  50.     update_interval: 60s
  51.  
  52.   - platform: uptime
  53.     name: "${plug_name} - Uptime"
  54.     icon: mdi:clock-outline
  55.     update_interval: 60s
  56.    
  57.   - platform: hlw8012
  58.     sel_pin:
  59.       number: GPIO12
  60.       inverted: True
  61.     cf_pin: GPIO05
  62.     cf1_pin: GPIO04
  63.     current_resistor: ${current_res}
  64.     voltage_divider: ${voltage_div}
  65.    
  66.     current:
  67.       name: "${plug_name} - Ampere"
  68.       unit_of_measurement: A
  69.       accuracy_decimals: 3
  70.       icon: mdi:flash-outline
  71.       filters:
  72.      # Map from sensor -> measured value
  73.         - calibrate_linear:
  74.            - 0.25416 -> 0
  75.             - 0.17338 -> 0
  76.             - 0.43453 -> 0.4167
  77.             - 0.43856 -> 0.4267
  78.             - -0.61162 -> 0.000
  79.     voltage:
  80.       name: "${plug_name} - Volt"
  81.       unit_of_measurement: V
  82.       accuracy_decimals: 1
  83.       icon: mdi:flash-outline
  84.       filters:
  85.      # Map from sensor -> measured value
  86.         - calibrate_linear:
  87.            - 242.96107 -> 239
  88.             - 239.74483 -> 236
  89.  
  90.     power:
  91.       name: "${plug_name} - Watt"
  92.       unit_of_measurement: W
  93.       id: "${plug_name}_Wattage"
  94.       icon: mdi:flash-outline
  95.       accuracy_decimals: 0
  96.       filters:
  97.      # Map from sensor -> measured value
  98.         - calibrate_linear:
  99.            - -51.42855 -> 0.000
  100.             - 18.58305 -> 0.000
  101.             - 8.94716 -> 0.000
  102.             - 5.31689 -> 0.000
  103.             - 3.58723 -> 0
  104.             - 2.62106 -> 0
  105.             - 91.60732 -> 100
  106.             - 166.78029 -> 75
  107.             - 199.75945 -> 100
  108.     change_mode_every: 4
  109.     update_interval: 3s
  110.    
  111.   - platform: total_daily_energy
  112.     name: "${plug_name} - Consumption"
  113.     power_id: "${plug_name}_Wattage"
  114.     filters:
  115.        # Multiplication factor from W to kW is 0.001
  116.         - multiply: 0.001
  117.     unit_of_measurement: kWh
  118.     icon: mdi:clock-alert
  119.  
  120. text_sensor:
  121.   - platform: version
  122.     name: "${plug_name} - ESPHome Version"
  123.   - platform: wifi_info
  124.     ip_address:
  125.       name: skuter IP Address
  126.     ssid:
  127.       name: skuter Connected SSID
  128.     bssid:
  129.       name: skuter Connected BSSID
  130.     mac_address:
  131.       name: skuter Mac Wifi Address
  132.     scan_results:
  133.       name: skuter Latest Scan Results
  134.  
  135. binary_sensor:
  136.  # Binary sensor for the button press
  137.   - platform: gpio
  138.     name: Physical Button Sensor
  139.     pin:
  140.       number: GPIO13
  141.       inverted: true
  142.     on_press:
  143.       - switch.toggle: relay
  144.  
  145. switch:
  146.  # Switch to toggle the relay
  147.   - platform: gpio
  148.     id: relay
  149.     name: skuter
  150.     pin: GPIO15
  151.     on_turn_on:
  152.       - light.turn_on: led
  153.     on_turn_off:
  154.       - light.turn_off: led
  155.  
  156. output:
  157.  # Relay state led
  158.   - platform: esp8266_pwm
  159.     id: state_led
  160.     pin:
  161.       number: GPIO00
  162.       inverted: true
  163.  
  164. light:
  165.  # Relay state light
  166.   - platform: monochromatic
  167.     output: state_led
  168.     id: led
  169.  
  170. # Uses the red LED as a ESPhome status indicator
  171. status_led:
  172.   pin:
  173.     number: GPIO2
  174.     inverted: true
  175.  
  176. captive_portal:
  177.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement