本帖最后由 shadowba 于 2024-3-8 12:26 编辑
本着少用8266的数量的原则个人做了热水器、热水温度,浴霸灯、卫生间照明灯、微波人体传感器、光纤传感器以及电能计量集成控制,目前工作稳定
esphome:
name: "toliet"
comment: 厕所灯、浴霸、热水器
platform: ESP8266
board: esp01_1m
ota:
password: ""
wifi:
networks:
- ssid:
password:
ap:
ssid: "toliet"
password: ""
captive_portal:
api:
#logger:
web_server:
port: 80
time:
- platform: sntp
timezone: "Asia/Shanghai"
id: sntp_time
servers: "ntp1.aliyun.com"
on_time:
- seconds: 0
minutes: 00
hours: 23
then:
- light.control:
id: lamp
brightness: 50%
- seconds: 0
minutes: 20
hours: 6
then:
- light.control:
id: lamp
brightness: 100%
uart:
- id: uart_bus
tx_pin: 1
rx_pin: 3
baud_rate: 256000
parity: NONE
stop_bits: 1
- id: uart_bus1
tx_pin: 2
rx_pin: 12
baud_rate: 4800
stop_bits: 1
i2c:
sda: 4
scl: 5
scan: true
id: bus_a
pcf8574:
- id: 'pcf8574_hub'
address: 0x20
pcf8575: true
dallas:
- pin: GPIO13
update_interval: 60s
sensor:
- platform: dallas
address: 0x61220ad445eef528
name: "Toliet-water heater temperature"
id: temperature
- platform: bl0942
uart_id: uart_bus1
voltage:
name: 'Toliet Voltage'
current:
name: 'Toliet Current'
power:
name: 'Toliet Power'
id: power
energy:
name: 'Toliet Energy'
accuracy_decimals: 2
frequency:
name: "Toliet Frequency"
update_interval: 60s
- platform: total_daily_energy
name: 'Toliet Total Daily Energy'
power_id: power
restore: true
unit_of_measurement: 'kWh'
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
- platform: adc
pin: A0
name: "Toliet Brightness"
id: VNButton
update_interval: 1s
filters:
- multiply: 3.3
on_value_range:
- below: 2.2
then:
- binary_sensor.template.publish:
id: fxp
state: ON
- above: 2.2
then:
- binary_sensor.template.publish:
id: fxp
state: OFF
ld2410:
- uart_id: uart_bus
light:
- platform: monochromatic
id: lamp
icon: "mdi:wall-sconce-round"
name: "Toliet-Lamp"
output: pwm_output
restore_mode: RESTORE_DEFAULT_OFF
- platform: binary
id: lamp1
icon: "mdi:lightbulb"
name: "Toliet-Lamp1"
output: light_output1
restore_mode: RESTORE_DEFAULT_OFF
- platform: binary
id: lamp2
icon: "mdi:lightbulb-group"
name: "Toliet-Lamp2"
output: light_output2
restore_mode: RESTORE_DEFAULT_OFF
output:
- platform: esp8266_pwm
pin: GPIO15
frequency: 5000Hz
id: pwm_output
- platform: gpio
pin:
pcf8574: pcf8574_hub
# Use pin number 0
number: 6
# One of INPUT or OUTPUT
mode:
output: true
inverted: false
id: light_output1
- platform: gpio
pin:
pcf8574: pcf8574_hub
# Use pin number 0
number: 5
# One of INPUT or OUTPUT
mode:
output: true
inverted: false
id: light_output2
binary_sensor:
- platform: ld2410
has_moving_target:
id: motion
name: "Toliet Moving Target"
has_still_target:
id: still
name: Toliet Still Target
filters:
- delayed_on: 10ms
- delayed_off: 10s
on_press:
- if:
condition:
and:
- binary_sensor.is_off: fxp
- binary_sensor.is_off: blight
then:
- light.turn_on: lamp
on_release:
- if:
condition:
and:
- binary_sensor.is_off: blight
then:
- light.turn_off: lamp
- platform: gpio
name: "Toliet lamp"
pin:
pcf8574: pcf8574_hub
# Use pin number 0
number: 2
# One of INPUT or OUTPUT
mode:
input: true
inverted: false
id: lampsw
filters:
- delayed_on: 10ms
on_press:
- switch.toggle: template_swi
- platform: gpio
name: "Toliet lamp1"
pin:
pcf8574: pcf8574_hub
# Use pin number 0
number: 3
# One of INPUT or OUTPUT
mode:
input: true
inverted: false
id: lampsw1
filters:
- delayed_on: 10ms
on_press:
- light.toggle: lamp1
- platform: gpio
name: "Toliet lamp2"
pin:
pcf8574: pcf8574_hub
# Use pin number 0
number: 4
# One of INPUT or OUTPUT
mode:
input: true
inverted: false
id: lampsw2
filters:
- delayed_on: 10ms
on_press:
- light.toggle: lamp2
- platform: template
id: blight
lambda: |-
if (id(template_swi).state == true) {
return true;
} else {
return false;
}
- platform: template
name: "light binary_sensor"
id: fxp
device_class: light
climate:
- platform: thermostat
name: "Toliet Water Heater Controller"
sensor: temperature
min_heating_off_time: 120s
min_heating_run_time: 120s
min_idle_time: 30s
heat_deadband: 5
heat_overrun: 5
visual:
min_temperature: 25
max_temperature: 65
temperature_step: 1°C
heat_action:
- switch.turn_on: rs_output
idle_action:
- switch.turn_off: rs_output
default_preset: Home
on_boot_restore_from: memory
preset:
- name: Home
default_target_temperature_low: 45°C
switch:
- platform: template
id: template_swi
turn_on_action:
- switch.template.publish:
id: template_swi
state: ON
- light.turn_on: lamp
turn_off_action:
- switch.template.publish:
id: template_swi
state: OFF
- light.turn_off: lamp
- platform: gpio
# name: "Toliet HOT"
pin:
pcf8574: pcf8574_hub
# Use pin number 0
number: 7
# One of INPUT or OUTPUT
mode:
output: true
inverted: false
id: rs_output
- platform: gpio
pin: 14
id: gmdz
name: gmdz_switch
restore_mode: ALWAYS_ON
button:
- platform: restart
name: "Toliet Restart"
嘉立创制版文件
Gerber_PCB1_2024-03-018.zip
(339.29 KB, 下载次数: 1, 售价: 2 金钱)
|