Skip to content

Instantly share code, notes, and snippets.

@0neday
Created Mar 27, 2022
Embed
What would you like to do?
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