I’m stuck in how to template a message for a SIM800L to send sensor data.
I’m building an alarm and tracker unit with an ESP32, GPS and SIM800L. I have the GPS and SIM working, but am only able to send basic messages (as shown in sim800l.send_sms Action) and not the position data of the GPS. Obviously there is no wifi connection to Home Assistant, so everything needs to be processed within the ESP32. As it will be used in several automations, I’m writing it in a script. Obviously this is not yet the correct way to write this Lambda… Thanks for your help!
script:
# Send SMS with location
- id: tortu_position_script
then:
- sim800l.send_sms:
recipient: !secret MyNumber
message: !lambda |-
return "Tortu Position report: " + id(tortu_lat).state + id(tortu_long).state + " SOG: " + id(tortu_sog).state + " COG: " + id(tortu_cog).state;
Or perhaps it should be more similar to writing to a display, e.g.
lambda: |-
return(0, 0, id(my_font), "Position report - Latitude: %.3f°N, Longitude: %.3f°E, SOG: %.1fKT, COG: : %.0°" , id(tortu_lat).state), id(tortu_long).state), id(tortu_sog).state), id(tortu_cog).state);