esphome:
name: mydevice
esp32:
board: esp32-c3-devkitm-1
framework:
type: arduino
type: esp-idf
esp8266:
board: esp01_1m
substitutions:
upper_devicename: Athom Smart Plug
http_request:
useragent: esphome/device
timeout: 10s
verify_ssl: false
logger:
captive_portal:
web_server:
api:
password: ""
ota:
- platform: esphome
password: ""
wifi:
ssid: "Scruffy"
password: "Marmalade!"
output_power: 9dB
ap:
ssid: "C3Pir Fallback Hotspot"
password: "tj8UsqNPoQom"
manual_ip:
static_ip: 192.168.72.22
gateway: 192.168.72.1
subnet: 255.255.255.0
status_led:
pin: 7
output:
# lolin c3 mini led pin is 7
- platform: gpio
id: led_1
pin:
number: 7
inverted: false
mode: OUTPUT
binary_sensor:
- platform: gpio
id: sensor_1
name: "PIR"
pin:
number: 10
mode:
input: true
pullup: true
device_class: motion
on_press:
- output.turn_on: led_1
- http_request.post: "http://192.168.72.21/light/default/turn_on"
on_release:
- output.turn_off: led_1
- http_request.post: "http://192.168.72.21/light/default/turn_off"
filters:
# - delayed_on: 10ms
- delayed_off: 5000ms
#
- http_request.post:
url: https://api/messages.json
headers:
Content-Type: application/json
json:
title: ESPHome
message: Hello from ESPHome Device
- http_request.get:
url: !lambda |-
std::string payload;
payload.append("http://heating/temps/update.php?key=test1&tempc=");
char pubtemp[10];
dtostrf(x,2,1,pubtemp);
payload.append(pubtemp);
return payload;
interval:
- interval: 1sec
then:
- output.turn_on: led_1
- interval: 3sec
then:
- output.turn_off: led_1
https://community.home-assistant.io/t/esphome-to-esphome-direct-communication/101370/6
https://github.com/esphome/feature-requests/issues/52#issuecomment-719043862
output:
- platform: gpio
id: relay_1
pin:
number: 14
mode: OUTPUT
inverted: false
light: # <---
- platform: binary
name: "default" # <---
id: light_1
output: relay_1
http_request:
useragent: esphome/device
timeout: 10s
verify_ssl: false
binary_sensor:
- platform: gpio
on_press:
- http_request.post: "http://device1/light/default/turn_on"
^^^^^ ^^^^^^^
1 meter of RP-L-110 is about 20 rmb.
See esp32-smart-plug
| GPIO | Purpose |
|---|---|
| 3 | Button 1 |
| 4 | BL0937 CF |
| 5 | HLWBL CF1 |
| 12 | HLWBL SELi |
| 13 | LedLink |
| 14 | Relay 1 |
sensor:
- platform: hlw8012
model: BL0937
# SEL pin indicates whether CF pin is VOLTAGE or CURRENT
sel_pin:
number: 12
inverted: true
# CF pin monitors CURRENT OR VOLTAGE
cf_pin: 4
# CF1 pin monitors the POWER used
cf1_pin: 5
# voltage_divider: "775"
# current_resistor: "0.0009"
# initial_mode: "VOLTAGE"
change_mode_every: 10
update_interval: 1s
current:
name: current
unit_of_measurement: A
accuracy_decimals: 3
voltage:
name: voltage
unit_of_measurement: V
accuracy_decimals: 3
power:
name: power
unit_of_measurement: W
accuracy_decimals: 3