Open andypnz opened 2 years ago
As far as I can see in most parts of the world 2G stays as it's based on plain GSM and used by older IoT, not planned to be removed any time soon. 3G is being removed as it's a separate network (frequencies needed for 5G SA), and 4G is still in active operation as even 5G relies on it as NSA network.
Where are you located?
I am in New Zealand. Some cellular providers here have already shut down their 2G networks here..... Others plan to do the same by 2025 despite potentially millions of devices still using 2G..... So looking for a 3G / 4G solution.....
And I would like to send the sms direct from a ESPHome device, not something more central (like Home Assistant).
Ideally I would use something like this SIM7600SA-H 4G HAT for Raspberry Pi 4G 3G 2G Communication connected to a Wemos D1 mini or ESP32.... I wonder if I could use serial protocol directly to send AT commands? Really, it is just to send sms messages on alarm.....
Thank you for your thoughts....
Afaik SMS is a standalone GSM transport, works without 2G, it's among with the voice channels. You don't even need 2G to send SMS. You only need (some kind of)G for internet/data.
Don't invest on 3G as it will be shut down soon. You need a 4G/5G device on long term for mobile data.
But given the super low cost of SIM800L it still might be worth using it in your area until 2025 as it's supported at the moment by ESPHome. You will be able to do SMS without 2G even after 2025.
Agree..... and I think the SIM7600 fits the bill..... hoping for a solution to use 4G/5G now :-)
Unfortunately the 800L is not working for me here - and confirmed 2g is already not supported on my chosen network. So I do need a 3G/4G/5G solution - I have ordered a SIM7600 - looking on GitHub I wonder if the 800L code code be modified to work with the 7600?
Happy to do some testing if anyone is interested (and has time) in doing that? My 7600 should be here in a week or so…..
@andypnz Did you had some success with the SIM7600 ?
+1
I’m in Thailand and 2G is long gone here.
Has anybody tried actually using a SIM7000/7600/7670 etc using the SIM800 component? They all have UART and use the same AT command set so it might just work? I've just ordered a LillyGo A7670E module and ESP32 "motherboard" and will have a play when it arrives. It might just need some minor fiddling to get it to work.
NB: The 7670 is worth considering if you only need 4G/LTE and there's a version for your region. The 7600 supports "old" 3G comms and is physically larger and much more expensive. Note that the SIM7000 is LTE Cat-M/NB only, which might need a special IoT SIM plan rather than a regular consumer SIM, and might not even be supported on some networks.
Yes, it works as these basic AT commands are the same. Tested with sim7600E.
@andypnz please send me your mail. I have adapted the code that it should be working in case no GSM is available. @randybb I can confirm the SIM800L code is working when GSM is available. If not, it will not be working since the code things the registration was not successful. I have modified slightly and looking for some testers
@chino-lu Hello, If it still possible, I would like to try your code for using SIM7600 by GSM/LTE with my HA server
@chino-lu I would like to test it as well of your offer is still standing. Thank you.
@qnixAVA sorry, hadn't seen your message here. I have uploaded the code to https://github.com/chino-lu/sim7600
@qnixAVA - sorry for my lack of knowledge, but how would I go about using that code ?
Hello @pacmac, I don't know yet, I was thinking about another problem concerning my project. Now it's solved, I can start thinking about how to use the code of chino-lu on esphome.
you only need it to place it in your config folder config
in your esphome yaml you define esphome: includes:
Thanks so much, I have included it and it compiles with no errors, but how do I use it:
sim7600:
on_sms_received:
- logger.log:
format: "Received '%s' from %s"
args: [ 'message.c_str()', 'sender.c_str()' ]
Throws error component not found
Have tried to figure it out, but compile fails with Component not found: sim7600.
:
esphome:
includes:
- sim7600/sim7600.h
custom_component:
- lambda: |-
auto sim7600 = new sim7600();
App.register_component(sim7600);
return {sim7600};
sim7600:
on_sms_received:
- logger.log:
format: "Received '%s' from %s"
args: [ 'message.c_str()', 'sender.c_str()' ]
just checked again, here is my code
esphome:
name: kc868-aio
friendly_name: KC868-AIO
external_components:
- source:
type: local
path: include
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
baud_rate: 0
ota:
password: "xxxx"
wifi:
ssid: "xxxx"
password: "xxxxxx"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Kc868-Aio Fallback Hotspot"
password: "xxxxx"
captive_portal:
# Enable Home Assistant API
api:
encryption:
key: "xxxx"
services:
- service: send_sms
variables:
recipient: string
message: string
then:
- sim7600.send_sms:
recipient: !lambda 'return recipient;'
message: !lambda 'return message;'
- service: dial
variables:
recipient: string
then:
- sim7600.dial:
recipient: !lambda 'return recipient;'
- service: connect
then:
- sim7600.connect
- service: disconnect
then:
- sim7600.disconnect
- service: send_ussd
variables:
ussdCode: string
then:
- sim7600.send_ussd:
ussd: !lambda 'return ussdCode;'
text_sensor:
- platform: template
id: sms_sender
name: "Sms Sender"
- platform: template
id: sms_message
name: "Sms Message"
- platform: template
id: caller_id_text_sensor
name: "Caller ID"
- platform: template
id: ussd_message
name: "Ussd Code"
uart:
tx_pin: GPIO13
rx_pin: GPIO15
baud_rate: 115200
debug:
direction: BOTH
dummy_receiver: false
after:
delimiter: "\n"
sequence:
- lambda: UARTDebug::log_string(direction, bytes);
thanks so much that worked :-)
Well it seems that I can receive SMS but I cannot send and are not sure where to start debugging:
[10:00:05][D][uart_debug:158]: >>> "\x1AAT+CSCS=\"GSM\"\r\n"
[10:00:05][D][uart_debug:158]: <<< "\r\nOK\r\n"
[10:00:05][D][uart_debug:158]: >>> "AT+CMGS=\"+XXXXXXXXXX\"\r\n"
[10:00:05][I][sim7600:343]: Sending to +XXXXXXXXXX message: 'Pong'
[10:00:05][D][uart_debug:158]: <<< "\r\n>"
[10:00:05][D][uart_debug:158]: >>> "Pong\x1A"
[10:00:05][D][uart_debug:158]: <<< " \r\n"
[10:00:13][D][uart_debug:158]: <<< "\r\n+CMS ERROR: Unknown error\r\n"
Any suggestions ?
Hello there, I wanted to know if with that code I will be able to send data from sensor to my home assistant ? I was looking for doing this by 4G/5G, but idk if it's possible to do this by sms ?
@qnixAVA it will not - esphome can use only wifi or ethernet, data transfer via HSDPA/LTE is not implemented. Anyway, these SIM7600 modules have native http/https and mqtt build-in, so this could be one of the possible options. We just need to find a volunteer who will implement it :)
@chino-lu btw, maybe the network registration type could be configurable - AT+CREG for 3g/4g, AT+CGREG for GPRS and AT+CEREG for LTE only then we could have one universal component for all SIMxxxx modules.
@randybb okay.. thanks. Maybe it will be possible by using https webhook ? In this case I will need to establish connection of my SIM7600 first, then add webhook to my home assistant with esphome API ?
@qnixAVA yes, this is why I have mentioned https :) This could be the easiest way - just check "AT Commands for HTTPS" in the manual - should not be hard send couple of AT commands. I have my "tracker" (LilyGo-T-PCIE with SIM7600E) ready on my desk for more than 2 years and had no time to finish it.
@randybb Yes thank's buddy. I was thinking about since the start of my project but I don't have enough programming knowledge to adapt the arduino code to yaml of esphome :/ .
CSCS
could you try 00 instead of +?
I have this problem when compiling the code in esphome: Pls kindly help to check Ah, and the code bellow: 4g-mobile-gateway.zip
please share you folder structure in ESPHome
The structure is: ESPHome/ sim7600/ sim7600.h
hm not sure how you are compiling, because this structure doesn't look like ESPHome in HomeAssistant
Hi guys, I'm starting to get interested in the 4G connection part of my project, I have an A7670E (quite similar to the sim7600 I think). I'm not yet very comfortable with custom components, and I'd like to know if you could help me set up a 4G connection when I start up my esp32?
The ultimate goal is for my esp32 to transmit data from its sensors to my home assistant server located 5km from my esp.
Thanks in advance.
I'm an experienced ESPHome user. I recently got a Lilygo A7670G for monitoring bee hives in a remote location. I'm sending MQTT messages to a cloud instance. I then have a subscriber in my home that republishes the MQTT messages to my Homeassistant. It's slightly kludgy but better than opening ports to allow the device to send MQTT messages directly to Homeassistant. If anybody wants me to test code on this device I'm willing to do that.
I forgot to mention that I am NOT using ESPHome on this device at this time but I'm willing to test any code intended for the A7670G modem.
Reference in new iss @ChadMatsalla
Can you provide the code, please?
I'm not sure what you mean by "Can you provide the code". It is not esphome code. It's code found here: https://github.com/Xinyuan-LilyGO/LilyGO-T-A76XX/tree/main
I have no intention of converting this to a component but if someone wants to do that I'd be willing to test it.
Describe the problem you have/What new integration you would like
Hi. I see there is a ESPHome integration for the SIM800L to send SMS txt messages..... Unfortunately the SIM800L uses the 2G network, which is being removed..... Is there any support for the SIM7600 or similar board to use the 3G / 4G network to send / receive txt messages using ESPHome running on a Wemos D1 mini or ESP32, etc ?
Please describe your use case for this integration and alternatives you've tried:
As above
Additional context