09-27-2024, 08:03 AM
i think you want use binary sensor to trigger other device. But you can receive serial port RING trigger AUTOMATION directly.
how to turn on relay by SIM7600E 4G module voice call in ESPHome
|
09-27-2024, 08:03 AM
i think you want use binary sensor to trigger other device. But you can receive serial port RING trigger AUTOMATION directly.
09-27-2024, 02:27 PM
interval:
- interval: 200ms # Shorten the interval to reduce blocking time then: - lambda: |- static std:tring uart_buffer; uint8_t c; int count = 0; const int max_reads = 10; // Limit the number of bytes read per interval while (id(uart_2).available() && count < max_reads) { if (id(uart_2).read_byte(&c)) { uart_buffer += (char)c; count++; // Log each received character (optional for debugging) ESP_LOGD("UART", "Received: %c", (char)c); // Check if we have received the "RING" signal if (uart_buffer.find("RING") != std:tring::npos) { ESP_LOGI("SIM7600", "Incoming call detected, turning on relay 1."); id(relay_1).turn_on(); // Turn on relay 1 HERE I TURN THE RELAY OFF AFTER 1s BUT IT WILL TURN BACK ON AFTER ANOTHER RING uart_buffer.clear(); // Clear the buffer after processing delay(1000); id(relay_1).turn_off(); // Turn off relay 1 } // Clear the buffer if it gets too large if (uart_buffer.length() > 100) { uart_buffer.clear(); } } } So the ideal would be turn on the relay after the missed call. also how do I hang up the call? thanks
09-29-2024, 12:18 AM
To identify an incoming call number on the SIM7600 module, you can enable the Caller Line Identification (CLI) feature using the following AT commands:
AT+CLIP=1 Then when RING will show the phone number, such as: RING +CLIP: "15381188302",128,"",0,,0 |
« Next Oldest | Next Newest »
|
Users browsing this thread: |
1 Guest(s) |