the ESPHome yaml demo made for KinCony KC868-A8S relay board. Actually you can use for any KinCony SIM7600 relay board, just replace 4G module's TXD,RXD define.
here is ESPHome yaml demo:
Code:
esphome:
name: a8s
platform: ESP32
board: esp32dev
# Example configuration entry for ESP32
i2c:
sda: 4
scl: 5
scan: true
id: bus_a
# Example configuration entry
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
# Example configuration entry
pcf8574:
- id: 'pcf8574_hub_out_1' # for output channel 1-8
address: 0x24
- id: 'pcf8574_hub_in_1' # for input channel 1-8
address: 0x22
# Individual outputs
switch:
- platform: gpio
name: "light1"
id: light1
pin:
pcf8574: pcf8574_hub_out_1
number: 0
mode: OUTPUT
inverted: true
- platform: gpio
name: "light2"
id: light2
pin:
pcf8574: pcf8574_hub_out_1
number: 1
mode: OUTPUT
inverted: true
- platform: gpio
name: "light3"
id: light3
pin:
pcf8574: pcf8574_hub_out_1
number: 2
mode: OUTPUT
inverted: true
- platform: gpio
name: "light4"
id: light4
pin:
pcf8574: pcf8574_hub_out_1
number: 3
mode: OUTPUT
inverted: true
- platform: gpio
name: "curtain1-up"
id: relay5
interlock: [relay6]
pin:
pcf8574: pcf8574_hub_out_1
number: 4
mode: OUTPUT
inverted: true
- platform: gpio
name: "curtain1-down"
id: relay6
interlock: [relay5]
pin:
pcf8574: pcf8574_hub_out_1
number: 5
mode: OUTPUT
inverted: true
- platform: gpio
name: "curtain2-up"
id: relay7
interlock: [relay8]
pin:
pcf8574: pcf8574_hub_out_1
number: 6
mode: OUTPUT
inverted: true
- platform: gpio
name: "curtain2-down"
id: relay8
interlock: [relay7]
pin:
pcf8574: pcf8574_hub_out_1
number: 7
mode: OUTPUT
inverted: true
# UART configuration for SIM7600E
uart:
id: uart_2
tx_pin: GPIO13
rx_pin: GPIO15
baud_rate: 115200
debug:
direction: BOTH
dummy_receiver: true
after:
timeout: 10ms
sequence:
- lambda: UARTDebug::log_string(direction, bytes);
binary_sensor:
- platform: gpio
name: "Call Button"
on_press:
then:
- uart.write:
id: uart_2
data: "ATD15381188302;\r\n" # Replace with the phone number you want to dial
pin:
pcf8574: pcf8574_hub_in_1
number: 0
mode: INPUT
inverted: true
- platform: gpio
name: "Send SMS Button"
on_press:
then:
- uart.write:
id: uart_2
data: "AT+CMGF=1\r\n" # Set SMS to text mode
- delay: 1s
- uart.write:
id: uart_2
data: "AT+CMGS=\"15381188302\"\r\n" # Replace with the recipient's phone number
- delay: 1s
- uart.write:
id: uart_2
data: "KinCony-SMS-Sensor\x1A" # Send the message "KinCony-SMS-Sensor" and terminate with Ctrl+Z
pin:
pcf8574: pcf8574_hub_in_1
number: 1
mode: INPUT
inverted: true
- platform: gpio
name: "input3"
on_press:
then:
- switch.toggle: light3
pin:
pcf8574: pcf8574_hub_in_1
number: 2
mode: INPUT
inverted: true
- platform: gpio
name: "input4"
on_press:
then:
- switch.toggle: light4
pin:
pcf8574: pcf8574_hub_in_1
number: 3
mode: INPUT
inverted: true
- platform: gpio
name: "input5"
on_press:
then:
- switch.toggle: relay5
pin:
pcf8574: pcf8574_hub_in_1
number: 4
mode: INPUT
inverted: true
- platform: gpio
name: "input6"
on_press:
then:
- switch.toggle: relay6
pin:
pcf8574: pcf8574_hub_in_1
number: 5
mode: INPUT
inverted: true
- platform: gpio
name: "input7"
on_press:
then:
- switch.toggle: relay7
pin:
pcf8574: pcf8574_hub_in_1
number: 6
mode: INPUT
inverted: true
- platform: gpio
name: "input8"
on_press:
then:
- switch.toggle: relay8
pin:
pcf8574: pcf8574_hub_in_1
number: 7
mode: INPUT
inverted: true
# Enable logging
logger:
# Enable Home Assistant API
api:
web_server:
port: 80
KC868-A8S-HA-INPUT-SIM7600-SMS.txt (Size: 4.45 KB / Downloads: 65)