Skip to content

Instantly share code, notes, and snippets.

@bessarabov
Created March 16, 2021 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bessarabov/1f0c24d979afc919c63a884bb6720980 to your computer and use it in GitHub Desktop.
Save bessarabov/1f0c24d979afc919c63a884bb6720980 to your computer and use it in GitHub Desktop.
substitutions:
device_name: bw_shp8_towel_rail
upper_devicename: "BW-SHP8 Towel Rail"
# Higher value gives lower watt readout
current_res: '0.00221'
# Lower value gives lower voltage readout
voltage_div: '825'
esphome:
name: ${device_name}
platform: ESP8266
board: esp8285
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
password: !secret api_password
ota:
password: !secret ota_password
time:
- platform: homeassistant
id: homeassistant_time
binary_sensor:
- platform: gpio
name: ${device_name} Button
id: ${device_name}_button
pin:
number: GPIO3
inverted: True
mode: INPUT_PULLUP
output:
- platform: esp8266_pwm
pin: GPIO13
inverted: true
id: ${device_name}_blue_led
light:
- platform: monochromatic
name: "${upper_devicename} Blue LED"
output: ${device_name}_blue_led
id: ${device_name}_blue_led_light
switch:
- platform: gpio
pin: GPIO14
id: ${device_name}_relay
name: '${upper_devicename} Relay'
on_turn_on:
- light.turn_on: ${device_name}_blue_led_light
on_turn_off:
- light.turn_off: ${device_name}_blue_led_light
sensor:
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: true
cf_pin: GPIO04
cf1_pin: GPIO05
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
current:
name: '${upper_devicename} Current'
unit_of_measurement: 'A'
accuracy_decimals: 3
icon: mdi:flash-outline
voltage:
name: '${upper_devicename} Voltage'
unit_of_measurement: 'V'
accuracy_decimals: 0
icon: mdi:flash-outline
power:
id: '${device_name}_power'
name: '${upper_devicename} Power'
unit_of_measurement: 'W'
icon: mdi:flash-outline
change_mode_every: 4
update_interval: 5s
- platform: total_daily_energy
name: "${upper_devicename} Total Daily Energy"
power_id: '${device_name}_power'
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
icon: mdi:clock-alert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment