Capn_jimbo
(PRANITH PERERA)
November 21, 2019, 8:25pm
1
Hi everyone …
I recently bought one of these to test it out … but I’m stuck …
Integration with ESPHOME works (connect to WiFi) but not able to send or receive SMS …
I checked the sim on a 2g phone , it is able to send and receive SMS …
If anyone has any success with this I would be really grateful for any advice or working yaml …
Thanks in advance
1 Like
nickrout
(Nick Rout)
November 21, 2019, 8:31pm
2
Can you post your yaml and your log please?
Capn_jimbo
(PRANITH PERERA)
November 25, 2019, 4:40pm
3
my esphome yaml
esphome:
name: sim800l
platform: ESP32
board: esp32dev
wifi:
ssid: "XXXXX"
password: "XXXXXXX"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Sim800L Fallback Hotspot"
password: "lBOnTtCvJmiP"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "XXXXXXX"
services:
- service: send_sms
variables:
recipient: string
message: string
then:
- sim800l.send_sms:
recipient: !lambda 'return recipient;'
message: !lambda 'return message;'
text_sensor:
- platform: template
id: sms_sender
name: "Sms Sender"
- platform: template
id: sms_message
name: "Sms Message"
uart:
baud_rate: 9600
tx_pin: GPIO33
rx_pin: GPIO27
sim800l:
on_sms_received:
- lambda: |-
id(sms_sender).publish_state(sender);
id(sms_message).publish_state(message);
ota:
password: "XXXXXXX"
log
INFO Reading configuration /config/esphome/sim800l.yaml…
INFO Starting log output from sim800l.local using esphome API
INFO Connecting to sim800l.local:6053 (192.168.1.XX)
INFO Successfully connected to sim800l.local
[16:35:39][I][app:100]: ESPHome version 1.14.3 compiled on Nov 20 2019, 18:11:00
[16:35:39][C][wifi:415]: WiFi:
[16:35:39][C][wifi:283]: SSID: [redacted]
[16:35:39][C][wifi:284]: IP Address: 192.168.1.XX
[16:35:39][C][wifi:286]: BSSID: [redacted]
[16:35:39][C][wifi:287]: Hostname: ‘sim800l’
[16:35:39][C][wifi:291]: Signal strength: -51 dB ▂▄▆█
[16:35:39][C][wifi:295]: Channel: 5
[16:35:39][C][wifi:296]: Subnet: 255.255.255.0
[16:35:39][C][wifi:297]: Gateway: 192.168.1.1
[16:35:39][C][wifi:298]: DNS1: 192.168.1.1
[16:35:39][C][wifi:299]: DNS2: 0.0.0.0
[16:35:39][C][uart:040]: UART Bus:
[16:35:39][C][uart:042]: TX Pin: GPIO33
[16:35:39][C][uart:045]: RX Pin: GPIO27
[16:35:39][C][uart:047]: Baud Rate: 9600 baud
[16:35:39][C][uart:048]: Stop bits: 1
[16:35:39][C][template.text_sensor:020]: Template Sensor ‘Sms Sender’
[16:35:39][C][template.text_sensor:020]: Template Sensor ‘Sms Message’
[16:35:39][C][logger:175]: Logger:
[16:35:39][C][logger:176]: Level: DEBUG
[16:35:39][C][logger:177]: Log Baud Rate: 115200
[16:35:39][C][logger:178]: Hardware UART: UART0
[16:35:39][C][sim800l:259]: SIM800L:
[16:35:39][C][sim800l:260]: RSSI: 0 dB
[16:35:39][C][captive_portal:169]: Captive Portal:
[16:35:39][C][ota:029]: Over-The-Air Updates:
[16:35:39][C][ota:030]: Address: sim800l.local:3232
[16:35:39][C][ota:032]: Using Password.
[16:35:39][C][api:095]: API Server:
[16:35:39][C][api:096]: Address: sim800l.local:6053
[16:36:38][I][ota:046]: Boot seems successful, resetting boot loop counter.
any thoughts ?
nickrout
(Nick Rout)
November 26, 2019, 5:41am
5
I cannot see any sign of you actually sending an sms message in that log.
Capn_jimbo
(PRANITH PERERA)
November 26, 2019, 7:17am
6
I tried send 2 messages and receive 2 messages while the log was on … But nothing happened
nickrout
(Nick Rout)
November 26, 2019, 7:32am
7
Well yes that is true, no sign of it. I bought one of those esp devices lately, but I don’t have a spare sim, and keep forgetting to get one so I have not tried it yet.
You could try bumping up the logging?
Capn_jimbo
(PRANITH PERERA)
November 26, 2019, 11:21am
8
Haven’t tried different levels of logging… don’t know how to do it …
nickrout
(Nick Rout)
November 26, 2019, 10:26pm
10
Oh come on, straight off the esphome home page
syphernl
(Frank)
December 7, 2019, 1:59pm
11
Just received a T-Call as well and experiencing the same here. In both your and my output I do see “RSSI: 0 dB” which might be pointing in the direction of either the antenna being crappy or the wrong pinout is being used to let the ESP communicate with the SIM800L.
Capn_jimbo
(PRANITH PERERA)
December 7, 2019, 2:34pm
12
I’m more inclined to think it has something to do with the pinout … because I added a better antenna and still have the same issue …
I have the ttgo-t-call and the sim800l connected with d1 mini with a voltage regulator still same problem …
Driving me nuts …
syphernl
(Frank)
December 7, 2019, 3:28pm
13
Must be it. It is trying to send “AT” but never gets a response. I’ve tried a bunch of GPIO ports I found online but so far nothing…
nickrout
(Nick Rout)
December 8, 2019, 8:30am
14
You do realise these devices only do gsm/gprs. basically 2g. There are also specific power requirements including the ability to provide 2A.
This listing is quite specific https://www.trademe.co.nz/a/marketplace/electronics-photography/other-electronics/electronic-components/other/listing/2426429996
worth a read.
reliable
(Bob MRPL Reliable)
December 17, 2019, 10:31am
15
To initialize the sim800l, you need to bring some pins to a certain state.
Try it like this:
switch:
- platform: gpio
name: "SIM800_PWKEY"
pin: 4
restore_mode: ALWAYS_OFF
- platform: gpio
name: "SIM800_RST"
pin: 5
restore_mode: ALWAYS_ON
- platform: gpio
name: "SIM800_POWER"
pin: 23
restore_mode: ALWAYS_ON
It should be remembered that if the LED blinks frequently, then the module is not connected to the operator. If the LED blinks slowly, the module is connected to the service provider.
4 Likes
syphernl
(Frank)
December 17, 2019, 4:32pm
16
Awesome, now we’re getting somewhere! The LED wasn’t blinking before, it is now. It seems to register fine to the network, but it doesn’t appear to be reacting to text messages yet.
The logs are showing this so perhaps the wrong GPIO pins are being used since I assume the AT needs to be acknowledged.
[17:29:32][VV][sim800l:230]: Buffer pos: 3 10
[17:29:32][V][sim800l:048]: R: AT - 2
[17:29:32][W][sim800l:062]: Not ack. 2 AT
Edit. Got it!
This seems to work:
uart:
baud_rate: 9600
tx_pin: 27
rx_pin: 26
3 Likes
Capn_jimbo
(PRANITH PERERA)
December 20, 2019, 4:36pm
17
i did both ,
but my loogin states
[16:34:29][W][sim800l:062]: Not ack. 2 ???
[16:34:32][D][sim800l:216]: Unhandled: a? - 0
[16:34:40][D][sim800l:216]: Unhandled: ?#??? - 0
[16:34:40][D][sim800l:216]: Unhandled: ? - 0
[16:34:45][I][ota:046]: Boot seems successful, resetting boot loop counter.
Capn_jimbo
(PRANITH PERERA)
December 31, 2019, 3:44pm
18
working solution here
My approach is:
1. Variant
gsm modem on linux (in my case host of hassio docker)
install gammu-smsd
configure stored data in sql database (install/configuration of sql server needed)
configure gammu-smsd to call script after received sms (curl command to call homeassistant webhook with json data from sms)
#!/bin/sh
from=$SMS_1_NUMBER
message=$SMS_1_TEXT
curl --request POST \
--url 'https://homeassistanturl/api/webhook/incomingsms' \
--header 'content-type: application/json' \
…
thank you @reliable @bigstation
mushkin92
(lombard)
February 20, 2020, 7:55am
19
Hi, i tried ESPHOME script from @bigstation but it doesn’t work : Loop with “Registration fail”.
I removed pin code and simcard works fine on my phone
Any idea ?
[07:50:38][I][app:100]: ESPHome version 1.14.3 compiled on Feb 12 2020, 19:20:03
[07:50:38][C][wifi:415]: WiFi:
[07:50:38][C][wifi:283]: SSID: [redacted]
[07:50:38][C][wifi:284]: IP Address: 192.168.1.148
[07:50:38][C][wifi:286]: BSSID: [redacted]
[07:50:38][C][wifi:287]: Hostname: ‘gsm_esp32’
[07:50:38][C][wifi:291]: Signal strength: -41 dB ▂▄▆█
[07:50:38][C][wifi:295]: Channel: 1
[07:50:38][C][wifi:296]: Subnet: 255.255.255.0
[07:50:38][C][wifi:297]: Gateway: 192.168.1.1
[07:50:38][C][wifi:298]: DNS1: 192.168.1.1
[07:50:38][C][wifi:299]: DNS2: 0.0.0.0
[07:50:38][C][uart:040]: UART Bus:
[07:50:38][C][uart:042]: TX Pin: GPIO27
[07:50:38][C][uart:045]: RX Pin: GPIO26
[07:50:38][C][uart:047]: Baud Rate: 9600 baud
[07:50:38][C][uart:048]: Stop bits: 1
[07:50:39][C][switch.gpio:042]: GPIO Switch ‘key_pin’
[07:50:39][C][switch.gpio:043]: Pin: GPIO4 (Mode: OUTPUT)
[07:50:39][C][switch.gpio:059]: Restore Mode: Always OFF
[07:50:39][C][switch.gpio:042]: GPIO Switch ‘reset_pin’
[07:50:39][C][switch.gpio:043]: Pin: GPIO5 (Mode: OUTPUT)
[07:50:39][C][switch.gpio:059]: Restore Mode: Always ON
[07:50:39][C][switch.gpio:042]: GPIO Switch ‘power_pin’
[07:50:39][C][switch.gpio:043]: Pin: GPIO23 (Mode: OUTPUT)
[07:50:39][C][switch.gpio:059]: Restore Mode: Always ON
[07:50:39][C][template.text_sensor:020]: Template Sensor ‘Sms Sender’
[07:50:39][C][template.text_sensor:020]: Template Sensor ‘Sms Message’
[07:50:39][C][logger:175]: Logger:
[07:50:39][C][logger:176]: Level: DEBUG
[07:50:39][C][logger:177]: Log Baud Rate: 115200
[07:50:39][C][logger:178]: Hardware UART: UART0
[07:50:39][C][sim800l:259]: SIM800L:
[07:50:39][C][sim800l:260]: RSSI: 0 dB
[07:50:39][C][ota:029]: Over-The-Air Updates:
[07:50:39][C][ota:030]: Address: gsm_esp32.local:3232
[07:50:39][C][api:095]: API Server:
[07:50:39][C][api:096]: Address: gsm_esp32.local:6053
[07:50:39][D][sim800l:216]: Unhandled: SMS Ready - 0
[07:50:52][W][sim800l:062]: Not ack. 3 ATE0AT+CMGF=1
[07:50:52][D][sim800l:216]: Unhandled: OK - 0
[07:50:57][D][sim800l:216]: Unhandled: OK - 0
[07:51:08][W][sim800l:107]: Registration Fail
[07:51:08][W][sim800l:107]: Registration Fail
[07:51:11][W][sim800l:107]: Registration Fail
glmnet
(Guillermo Ruffino)
February 20, 2020, 7:48pm
20
does it require “roaming”? in that case there is a patch on dev which causes it to accept roaming simcards