Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to use binary sensor make VOICE CALL by SIM7600E 4G module in ESPHome
#1

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: "input2"
    on_press:
      then:
        - switch.toggle: light2
    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
download yaml file:
.txt   KC868-A8S-HA-INPUT-SIM7600-CALL.txt (Size: 4.03 KB / Downloads: 79)
Reply
#2
I just bought the A2 + SIM7600

Could you please make an example how to receive a call and trigger one or more outputs depending on the caller ID?

thank you so much
Reply
#3
when have free time, i will have a test. when received a call let relay ON?
Reply
#4
post new code at here: https://www.kincony.com/forum/showthread.php?tid=6763
voice call turn on relay1 ESPHome yaml for KC868-A2 board.
Reply
#5
thank you so much!
Reply
#6
Provide power to the SIM7600E module (ensure the power supply matches the module's requirements).
Reply
#7
Hello!

I've got an A2 as well as a SIM7600E module.

I saw one of your example codes and they have the UART pins for GSM set as GPIO5 for TX and GPIO13 for RX but on the ESPHome website device post for the A2 it has the GPIO34 for RX and GPIO13 for TX. Which is the correct one?

Also I have followed the examples you have posted using a button press on the A8 for a call and a SMS but using the button component as the A2 doesn't have any buttons.

Another question I have is if the SIM module allows it to connect to the internet using a SIM card if no WiFi or Ethernet is available and how to do so.

Thank you.
Reply
#8
1. what's your KC868-A2 pcb version? take a photo.
2. sure, you can use SIM7600E connect to cloud server by MQTT.
Reply
#9
(12-30-2024, 09:55 AM)admin Wrote: 1. what's your KC868-A2 pcb version? take a photo.
2. sure, you can use SIM7600E connect to cloud server by MQTT.

1) It is A2 V2.4.

I tested the module using the latest firmware 2.2.10 and using your own interface I can send a message and call my phone so I know the module works and the SIM does as well.

I want to do the same but using our ESPHome code we have implemented but I am not sure if the pinout is correct and also I can simulate buttons and I see the AT commands coming in but no output and unable to test AT commands.

I am also unsure on how to test if it is working or connecting using only the SIM connection to the internet other than making some mqtt configuration messages.

Code:
button:
  - platform: template
    name: "Call Button"
    on_press:
      then:
        - uart.write:
            id: uart_sim7600
            data: "ATD[phone number];\r\n" # Replace with the phone number to dial
 
  - platform: template
    name: "Send SMS Button"
    on_press:
      then:
        - uart.write:
            id: uart_sim7600
            data: "AT+CMGF=1\r\n" # Set SMS to text mode
        - delay: 1s
        - uart.write:
            id: uart_sim7600
            data: "AT+CMGS=\"[phone number]\"\r\n" # Replace with the recipients phone number
        - delay: 1s
        - uart.write:
            id: uart_sim7600
            data: "testdevice-02\x1A" # Send the message and terminate

So apparently this is the proper pinout for the GSM in the A2, which is different than the one on this website https://devices.esphome.io/devices/KinCony-KC868-A2:
Code:
- id: uart_sim7600
    tx_pin: GPIO5
    rx_pin: GPIO13

Also I don't know if this also was needed but it works for me but in this code of one of your examples 
Code:
- platform: template
    name: "Call Button"
    on_press:
      then:
        - uart.write:
            id: uart_sim7600
            data: "ATD[phonenumber];\r\n" # Replace with the phone number to dial

In [phone number] I also added the area code of the country.

I could recieve a message and a call using button components to simulate the press of a button.

EDIT: MY NEW ISSUE IS THIS: I need to be able to get this device running connecting to the internet using a 4G/LTE connection. I can receive messages and calls and I can send them using your software and ESPHome but as far as I know there is no 4G connection integration with ESPHome so I assume this must come from an external component.

Do you have anything at hand you could help me with for this?
Reply
#10
ESPHome not support SIM7600 4G module directly. i think you can use AT command for internet connection. send AT command one by one manually. 
ESPHome not good for 4G module.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)