I’m using a custom sensor component to provide reverse geocode lookups from OpenStreetMap.
It updates itself periodically and seems to work okay for the most part - but it seems to update itself on it’s own schedule and sometimes lags behind the device_tracker location.
So here’s the problem:
I have an automation which is configured as shown below. It triggers off of a device_tracker change - but the notification messages contain information from both the device_tracker entity AND the separate sensor entity - and the sensor entity’s attributes are not up to date at the time the event is triggered. Is there any way I can call a sensor.update() method from my automation to force the sensor to perform an update “on demand” instead of waiting for it to update itself based on it’s own throttling settings? :
- alias: LocationDaughter
trigger:
platform: state
entity_id: device_tracker.daughter_daughter
action:
- service: notify.androidtv_office
data_template:
title: "Daughter: {{ states.device_tracker.daughter_daughter.state }}"
message: >
{{ states.sensor.daughter.attributes["Place Name"] }} / {{ states.sensor.daughter.attributes["Formatted Address"] }}
- service: notify.ios_myiphone
data_template:
title: "Daughter: {{ states.device_tracker.daughter_daughter.state }}"
message: >
Daughter: {{ states.sensor.daughter.attributes["Place Name"] }} / {{ states.sensor.daughter.attributes["Formatted Address"] }} @ {{ now().strftime("%Y-%m-%d %H:%M") }}
data:
push:
category: map
action_data:
latitude: '{{ states.device_tracker.daughter_daughter.attributes.latitude }}'
longitude: '{{ states.device_tracker.daughter_daughter.attributes.longitude }}'
second_latitude: '{{ states.device_tracker.son_son.attributes.latitude }}'
second_longitude: '{{ states.device_tracker.son_son.attributes.longitude }}'
shows_traffic: true
shows_points_of_interest: true
shows_line_between_points: true
# shows_user_location: true
Thanks