Using time from HA within ESPHome SMS message

Hi. I am not sure how to create a string to send as a SMS that includes the time. Any direction appreciated… My current code is below…

time:
- platform: homeassistant
  id: hatime
  timezone: NZST-12NZDT,M9.5.0,M4.1.0/3

  on_time:
      - seconds: 0
        minutes: 0
        hours: 6
        days_of_week: MON
        then:
              - sim800l.send_sms:
                  recipient: "+xxxxxxxxxx"
                  message: ALIVE txt The time is
                  #  args: [ 'hatime->now().timestamp']
              - logger.log:
                  format: "ALIVE txt The time is: T%lu\n"
                  args: [ 'hatime->now().timestamp' ]

Solved on discord - thank you!

message:  !lambda 'return "ALIVE txt The time is " + id(hatime).now().strftime("%H:%M");'

Hi @andypnz , fellow kiwi here. What cellular provider are you using with that thing?

Changed the data rate to 115200 and using a SIM7600 (4g) with vodafone…

1 Like