Skip to content

Instantly share code, notes, and snippets.

@0neday
Created March 27, 2022 00:35
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 0neday/2db07b1d0513863b96dbdaaca8b849e2 to your computer and use it in GitHub Desktop.
Save 0neday/2db07b1d0513863b96dbdaaca8b849e2 to your computer and use it in GitHub Desktop.
esp32 for pzem-004t
esphome:
name: esp32
# on_boot:
# priority: -100
# then:
# - fan.turn_on:
# id: living_room_fan
# speed: 50
esp32:
board: nodemcu-32s
framework:
type: arduino
logger:
# level: VERY_VERBOSE
web_server:
port: 80
auth:
username: admin
password: ""
api:
password: "12345678"
ota:
password: "12345678"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.1.99
gateway: 192.168.1.1
subnet: 255.255.255.0
dns1: 192.168.1.1
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp32-S Fallback Hotspot"
password: "12345678"
captive_portal:
# Led flicker
status_led:
pin:
number: GPIO2
#inverted: true
# BLE
esp32_ble_tracker:
# pwm fan
output:
- platform: ledc
pin: GPIO16
frequency: 1000 Hz
id: pwm_output_p16
fan:
- platform: speed
output: pwm_output_p16
name: "Living Room Fan"
id: "living_room_fan"
# on_turn_on:
# then:
# - fan.turn_on:
# id: living_room_fan
# speed: 60
# soft uart
uart:
rx_pin: GPIO22
tx_pin: GPIO23
baud_rate: 9600
modbus:
sensor:
# pzemac-004T
- platform: pzemac
address: 1
current:
name: 'PZEM-004T Current'
voltage:
name: 'PZEM-004T Voltage'
energy:
name: 'PZEM-004T Energy'
filters:
- multiply: 0.001
unit_of_measurement: 'kWh'
accuracy_decimals: 3
power:
name: 'PZEM-004T Power'
frequency:
name: 'PZEM-004T Frequency'
power_factor:
name: 'PZEM-004T Power Factor'
update_interval: 30s
# xiaomi temperature meter
- platform: xiaomi_lywsd03mmc
mac_address: ""
bindkey: "47CF9F14B8CE5C668DE3C6799B008D28"
temperature:
name: "Room LYWSD03MMC Temperature"
humidity:
name: "Room LYWSD03MMC Humidity"
battery_level:
name: "Room LYWSD03MMC Battery Level"
- platform: xiaomi_lywsd03mmc
mac_address: ""
bindkey: "47CF9F14B8CE5C668DE3C6799B008D28"
temperature:
name: "Router LYWSD03MMC Temperature"
humidity:
name: "Router LYWSD03MMC Humidity"
battery_level:
name: "Router LYWSD03MMC Battery Level"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment