01-21-2025, 12:15 AM
Code:
esphome:
name: f16
friendly_name: f16
esp32:
board: esp32-s3-devkitc-1
framework:
type: arduino
# Enable logging
# hardware_uart: USB_SERIAL_JTAG
# Enable Home Assistant API
api:
encryption:
key: "WeVOuL5oNhjXcfzXtTirlOwvtWvCD5yqIxd3oV4es1k="
ethernet:
type: W5500
clk_pin: GPIO42
mosi_pin: GPIO43
miso_pin: GPIO44
cs_pin: GPIO41
interrupt_pin: GPIO2
reset_pin: GPIO1
i2c:
- id: bus_a
sda: 8
scl: 18
scan: true
frequency: 400kHz
pcf8574:
- id: 'pcf8574_hub_out_1' # for output channel 1-16
i2c_id: bus_a
address: 0x25
pcf8575: true
- id: 'pcf8574_hub_in_1' # for input channel 1-16
i2c_id: bus_a
address: 0x24
pcf8575: true
uart:
- id: uart_1 #RS485
baud_rate: 9600
debug:
direction: BOTH
dummy_receiver: true
after:
timeout: 10ms
tx_pin: 16
rx_pin: 17
switch:
- platform: uart
uart_id: uart_1
name: "RS485 Button"
data: [0x11, 0x22, 0x33, 0x44, 0x55]
- platform: gpio
name: "f16-output01"
id: "f16_output01"
pin:
pcf8574: pcf8574_hub_out_1
number: 0
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output02"
id: "f16_output02"
pin:
pcf8574: pcf8574_hub_out_1
number: 1
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output03"
id: "f16_output03"
pin:
pcf8574: pcf8574_hub_out_1
number: 2
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output04"
id: "f16_output04"
pin:
pcf8574: pcf8574_hub_out_1
number: 3
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output05"
id: "f16_output05"
pin:
pcf8574: pcf8574_hub_out_1
number: 4
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output06"
id: "f16_output06"
pin:
pcf8574: pcf8574_hub_out_1
number: 5
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output07"
id: "f16_output07"
pin:
pcf8574: pcf8574_hub_out_1
number: 6
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output08"
id: "f16_output08"
pin:
pcf8574: pcf8574_hub_out_1
number: 7
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output09"
id: "f16_output09"
pin:
pcf8574: pcf8574_hub_out_1
number: 8
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output10"
id: "f16_output10"
pin:
pcf8574: pcf8574_hub_out_1
number: 9
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output11"
id: "f16_output11"
pin:
pcf8574: pcf8574_hub_out_1
number: 10
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output12"
id: "f16_output12"
pin:
pcf8574: pcf8574_hub_out_1
number: 11
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output13"
id: "f16_output13"
pin:
pcf8574: pcf8574_hub_out_1
number: 12
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output14"
id: "f16_output14"
pin:
pcf8574: pcf8574_hub_out_1
number: 13
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output15"
id: "f16_output15"
pin:
pcf8574: pcf8574_hub_out_1
number: 14
mode: OUTPUT
inverted: true
- platform: gpio
name: "f16-output16"
id: "f16_output16"
pin:
pcf8574: pcf8574_hub_out_1
number: 15
mode: OUTPUT
inverted: true
binary_sensor:
- platform: gpio
name: "f16-input01"
id: "f16_input01"
pin:
pcf8574: pcf8574_hub_in_1
number: 0
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input02"
id: "f16_input02"
pin:
pcf8574: pcf8574_hub_in_1
number: 1
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input03"
id: "f16_input03"
pin:
pcf8574: pcf8574_hub_in_1
number: 2
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input04"
id: "f16_input04"
pin:
pcf8574: pcf8574_hub_in_1
number: 3
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input05"
id: "f16_input05"
pin:
pcf8574: pcf8574_hub_in_1
number: 4
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input06"
id: "f16_input06"
pin:
pcf8574: pcf8574_hub_in_1
number: 5
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input07"
id: "f16_input07"
pin:
pcf8574: pcf8574_hub_in_1
number: 6
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input08"
id: "f16_input08"
pin:
pcf8574: pcf8574_hub_in_1
number: 7
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input09"
id: "f16_input09"
pin:
pcf8574: pcf8574_hub_in_1
number: 8
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input10"
id: "f16_input10"
pin:
pcf8574: pcf8574_hub_in_1
number: 9
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input11"
id: "f16_input11"
pin:
pcf8574: pcf8574_hub_in_1
number: 10
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input12"
id: "f16_input12"
pin:
pcf8574: pcf8574_hub_in_1
number: 11
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input13"
id: "f16_input13"
pin:
pcf8574: pcf8574_hub_in_1
number: 12
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input14"
id: "f16_input14"
pin:
pcf8574: pcf8574_hub_in_1
number: 13
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input15"
id: "f16_input15"
pin:
pcf8574: pcf8574_hub_in_1
number: 14
mode: INPUT
inverted: true
- platform: gpio
name: "f16-input16"
id: "f16_input16"
pin:
pcf8574: pcf8574_hub_in_1
number: 15
mode: INPUT
inverted: true
##pull-up resistance on PCB
- platform: gpio
name: "f16-W1-io48"
pin:
number: 48
inverted: true
- platform: gpio
name: "f16-W1-io47"
pin:
number: 47
inverted: true
- platform: gpio
name: "f16-W1-io21"
pin:
number: 21
inverted: true
- platform: gpio
name: "f16-W1-io15"
pin:
number: 15
inverted: true
## without resistance on PCB
- platform: gpio
name: "f16-W1-io13"
pin:
number: 13
inverted: false
- platform: gpio
name: "f16-W1-io14"
pin:
number: 14
inverted: false
- platform: gpio
name: "f16-433M"
pin:
number: 40
inverted: false
sensor:
- platform: adc
pin: 5
name: "F16 A1 Voltage"
update_interval: 5s
attenuation: 11db
filters:
- lambda:
if (x >= 3.11) {
return x * 1.60256;
} else if (x <= 0.15) {
return 0;
} else {
return x * 1.51;
}
- platform: adc
pin: 7
name: "F16 A2 Voltage"
update_interval: 5s
attenuation: 11db
filters:
# - multiply: 1.51515
- lambda:
if (x >= 3.11) {
return x * 1.60256;
} else if (x <= 0.15) {
return 0;
} else {
return x * 1.51;
}
- platform: adc
pin: 6
name: "F16 A3 Current"
update_interval: 5s
unit_of_measurement: mA
attenuation: 11db
filters:
- multiply: 6.66666666
- platform: adc
pin: 4
name: "F16 A4 Current"
update_interval: 5s
unit_of_measurement: mA
attenuation: 11db
filters:
- multiply: 6.66666666
web_server:
port: 80
font:
- file: "gfonts://Roboto"
id: roboto
size: 20
display:
- platform: ssd1306_i2c
i2c_id: bus_a
model: "SSD1306 128x64"
address: 0x3C
lambda: |-
it.printf(0, 0, id(roboto), "KinCony F16");
F16-HA-without-Tuya.txt (Size: 8.48 KB / Downloads: 10)