@mouthpiec wrote:
I have the following sensors which return the address among other attributes
# Travel time from Dist Location to Home - platform: google_travel_time name: Dist To Home api_key: abcdefghijklmnopqrstuvwxyz origin: device_tracker.life360_mobile destination: zone.home
The above returns a string with the address in the attribute origin_addresses.
Now I am using the following sensor to extract the address, but I would like to extract only the Town/City, which is the string between commas, e.g. [‘8 Big Street, Valletta, Malta’] .
Is there a way to extract only the string Valletta instead of the whole string?# Mobile Current Location - platform: template sensors: mobile_current_location: value_template: '{{ states.sensor.dist_to_home.attributes.origin_addresses|default(0) }}' friendly_name: Mobile Current Location icon_template: mdi:crosshairs-gps
thanks in advance
Posts: 3
Participants: 3