Hi,
I am new to home assistant but spent a lot of time getting everything to work. So far so good but I have one ESPHome device that is giving me problems. Mabe it’s the hardware I am using but at the moment I do not think that is the case. This is the device:
Now I managed to program the ESP32 with ESP home and configured the yaml file to work with the SIM800. The device shows up in my dashboard but all the entitiy states are ‘Unknown’. I have a power switch and if I flip it, I do see 2 leds on the board switch on so I can communicated with the hardware. This is my yaml file:
esphome:
name: gsm-module
friendly_name: GSM module
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
baud_rate: 0 # disable uart logger on esp 8266
level: VERBOSE
# Enable Home Assistant API
api:
encryption:
key: "TR038ZTw3uK7U8/Yat0/YtxNUL6D/XP6a00x7nCjjiw="
actions:
- action: send_sms
variables:
recipient: string
message: string
then:
- sim800l.send_sms:
recipient: !lambda 'return recipient;'
message: !lambda 'return message;'
- logger.log: "GSM Send SMS"
- action: dial
variables:
recipient: string
then:
- sim800l.dial:
recipient: !lambda 'return recipient;'
- logger.log: "GSM Dial"
- action: connect
then:
- sim800l.connect
- logger.log: "GSM Connect"
- action: disconnect
then:
- sim800l.disconnect
- logger.log: "GSM Disconnect"
- action: send_ussd
variables:
ussdCode: string
then:
- sim800l.send_ussd:
ussd: !lambda 'return ussdCode;'
- logger.log: "GSM Send USSD"
ota:
- platform: esphome
password: "69d8cda5ed596a25734674cad3d6d682"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Gsm-Module Fallback Hotspot"
password: "XYjcTMoWUkLr"
captive_portal:
i2c:
sda: GPIO21
scl: GPIO22
scan: true
id: bus_a
switch:
- platform: gpio
pin: GPIO25
name: "SIM800C Power"
- platform: gpio
pin: GPIO4
name: "SIM800C Power Key"
binary_sensor:
- platform: sim800l
registered:
name: "Sim800L Registered"
sensor:
- platform: sim800l
rssi:
name: "Sim800L RSSI"
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:
baud_rate: 9600
tx_pin: TX
rx_pin: RX
sim800l:
on_sms_received:
- lambda: |-
id(sms_sender).publish_state(sender);
id(sms_message).publish_state(message);
- logger.log: "SMS Received"
on_incoming_call:
- lambda: |-
id(caller_id_text_sensor).publish_state(caller_id);
- logger.log: "Incoming Call"
on_call_connected:
- logger.log:
format: Call connected
- logger.log: "Connected"
on_call_disconnected:
- logger.log:
format: Call disconnected
- logger.log: "Disconnected"
on_ussd_received:
- lambda: |-
id(ussd_message).publish_state(ussd);
- logger.log: "USSD Received"
In the home-assistant.log I see these messages (log level: INFO)
2024-10-26 11:46:59.873 INFO (MainThread) [aioesphomeapi.reconnect_logic] Successfully connected to gsm-module @ 192.168.0.106 in 0.009s
2024-10-26 11:47:00.006 INFO (MainThread) [aioesphomeapi.reconnect_logic] Successful handshake with gsm-module @ 192.168.0.106 in 0.133s
If I initiate an action via developer tools I get these messages:
2024-10-26 11:47:06.550 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2024-10-26 11:47:06.550 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
This is the log from the device itself:
INFO ESPHome 2024.10.2
INFO Reading configuration /config/esphome/gsm-module.yaml...
INFO Starting log output from 192.168.0.106 using esphome API
INFO Successfully connected to gsm-module @ 192.168.0.106 in 0.071s
INFO Successful handshake with gsm-module @ 192.168.0.106 in 0.080s
[12:25:25][I][app:100]: ESPHome version 2024.10.2 compiled on Oct 26 2024, 11:54:14
[12:25:25][C][wifi:600]: WiFi:
[12:25:25][C][wifi:428]: Local MAC: 40:22:D8:FC:67:9C
[12:25:25][C][wifi:433]: SSID: [redacted]
[12:25:25][C][wifi:436]: IP Address: 192.168.0.106
[12:25:25][C][wifi:440]: BSSID: [redacted]
[12:25:25][C][wifi:441]: Hostname: 'gsm-module'
[12:25:25][C][wifi:443]: Signal strength: -31 dB ▂▄▆█
[12:25:25][V][wifi:445]: Priority: 0.0
[12:25:25][C][wifi:447]: Channel: 9
[12:25:25][C][wifi:448]: Subnet: 255.255.255.0
[12:25:25][C][wifi:449]: Gateway: 192.168.0.1
[12:25:25][C][wifi:450]: DNS1: 213.46.228.196
[12:25:25][C][wifi:451]: DNS2: 62.179.104.196
[12:25:25][C][logger:185]: Logger:
[12:25:25][C][logger:186]: Level: VERBOSE
[12:25:25][C][logger:188]: Log Baud Rate: 0
[12:25:25][C][logger:189]: Hardware UART: UART0
[12:25:25][C][i2c.arduino:071]: I2C Bus:
[12:25:25][C][i2c.arduino:072]: SDA Pin: GPIO21
[12:25:25][C][i2c.arduino:073]: SCL Pin: GPIO22
[12:25:25][C][i2c.arduino:074]: Frequency: 50000 Hz
[12:25:25][C][i2c.arduino:086]: Recovery: bus successfully recovered
[12:25:25][I][i2c.arduino:096]: Results from i2c bus scan:
[12:25:25][I][i2c.arduino:102]: Found i2c device at address 0x34
[12:25:25][C][uart.arduino_esp32:151]: UART Bus 0:
[12:25:25][C][uart.arduino_esp32:152]: TX Pin: GPIO1
[12:25:25][C][uart.arduino_esp32:153]: RX Pin: GPIO3
[12:25:25][C][uart.arduino_esp32:155]: RX Buffer Size: 256
[12:25:25][C][uart.arduino_esp32:157]: Baud Rate: 9600 baud
[12:25:25][C][uart.arduino_esp32:158]: Data Bits: 8
[12:25:25][C][uart.arduino_esp32:159]: Parity: NONE
[12:25:25][C][uart.arduino_esp32:160]: Stop bits: 1
[12:25:25][C][switch.gpio:068]: GPIO Switch 'SIM800C Power'
[12:25:25][C][switch.gpio:091]: Restore Mode: always OFF
[12:25:25][C][switch.gpio:031]: Pin: GPIO25
[12:25:25][C][switch.gpio:068]: GPIO Switch 'SIM800C Power Key'
[12:25:25][C][switch.gpio:091]: Restore Mode: always OFF
[12:25:25][C][template.text_sensor:020]: Template Sensor 'Sms Message'
[12:25:25][C][template.text_sensor:020]: Template Sensor 'Caller ID'
[12:25:25][C][template.text_sensor:020]: Template Sensor 'Ussd Code'
[12:25:25][C][sim800l:465]: SIM800L:
[12:25:25][C][sim800l:467]: Registered 'Sim800L Registered'
[12:25:25][C][sim800l:467]: Device Class: 'connectivity'
[12:25:25][C][sim800l:470]: Rssi 'Sim800L RSSI'
[12:25:25][C][sim800l:470]: Device Class: 'signal_strength'
[12:25:25][C][sim800l:470]: State Class: 'measurement'
[12:25:25][C][sim800l:470]: Unit of Measurement: 'dBm'
[12:25:25][C][sim800l:470]: Accuracy Decimals: 0
[12:25:25][C][captive_portal:089]: Captive Portal:
[12:25:25][C][mdns:116]: mDNS:
[12:25:25][C][mdns:117]: Hostname: gsm-module
[12:25:25][V][mdns:118]: Services:
[12:25:25][V][mdns:120]: - _esphomelib, _tcp, 6053
[12:25:25][V][mdns:122]: TXT: friendly_name = GSM module
[12:25:25][V][mdns:122]: TXT: version = 2024.10.2
[12:25:25][V][mdns:122]: TXT: mac = 4022d8fc679c
[12:25:25][V][mdns:122]: TXT: platform = ESP32
[12:25:25][V][mdns:122]: TXT: board = esp32dev
[12:25:25][V][mdns:122]: TXT: network = wifi
[12:25:25][V][mdns:122]: TXT: api_encryption = Noise_NNpsk0_25519_ChaChaPoly_SHA256
[12:25:25][C][esphome.ota:073]: Over-The-Air updates:
[12:25:25][C][esphome.ota:074]: Address: gsm-module.local:3232
[12:25:25][C][esphome.ota:075]: Version: 2
[12:25:25][C][esphome.ota:078]: Password configured
[12:25:25][C][safe_mode:018]: Safe Mode:
[12:25:25][C][safe_mode:020]: Boot considered successful after 60 seconds
[12:25:25][C][safe_mode:021]: Invoke after 10 boot attempts
[12:25:25][C][safe_mode:023]: Remain in safe mode for 300 seconds
[12:25:25][C][api:140]: API Server:
[12:25:25][C][api:141]: Address: gsm-module.local:6053
[12:25:25][C][api:143]: Using noise encryption: YES
Any help would be very much appreciated! I am running the latest version of HA on a Raspberry PI 5.