Lacking a defined SMS sensor, i have tried, as others have suggested, using the Last Notification sensor for capturing incoming SMS messages; however, at least on Android, these frequently get grouped together or quickly overwritten by another notification – and simply is not a reliable way to do it.
In the meantime I have relied on other clients, such as IFTTT or Tasker, but since I’m already running the HA Mobile Companion, I’d much rather have the functionality in there natively.
Just FYI, my use case… I capture texts from package delivery services (USPS, UPS, FedEx, etc) or Food Delivery services (Doordash, Grubhub, Postmates, etc) and use automations to set lighting, announce deliveries, etc. on home speakers.