![]() |
|
how to turn on relay by SIM7600E 4G module voice call in ESPHome - Printable Version +- Smart Home Automation Forum (https://www.kincony.com/forum) +-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=1) +--- Forum: Getting Started with ESPHome and Home Assistant (https://www.kincony.com/forum/forumdisplay.php?fid=54) +--- Thread: how to turn on relay by SIM7600E 4G module voice call in ESPHome (/showthread.php?tid=6763) Pages:
1
2
|
RE: how to turn on relay by SIM7600E 4G module voice call in ESPHome - admin - 09-27-2024 i think you want use binary sensor to trigger other device. But you can receive serial port RING trigger AUTOMATION directly. RE: how to turn on relay by SIM7600E 4G module voice call in ESPHome - attilhacks - 09-27-2024 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 RE: how to turn on relay by SIM7600E 4G module voice call in ESPHome - admin - 09-29-2024 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 |