diff --git a/source/_integrations/data_grand_lyon.markdown b/source/_integrations/data_grand_lyon.markdown index b68e37e234e4..4bc0b654cf75 100644 --- a/source/_integrations/data_grand_lyon.markdown +++ b/source/_integrations/data_grand_lyon.markdown @@ -89,6 +89,32 @@ For each transit stop you add, the following sensor entities are created: - **Next departure 3 type** - **Description**: Whether the departure time is _estimated_ or _theoretical_. Disabled by default. +## Examples + +### Refresh data more frequently during a time window + +Get fresher upcoming-departure data before your commute without raising the polling rate the rest of the day. This blueprint refreshes a transit stop's sensors at a configurable interval inside a time window — by default, every minute between 8:00 and 9:00. + +{% my blueprint_import badge blueprint_url="https://www.home-assistant.io/blueprints/integrations/data_grand_lyon_refresh_during_time_window.yaml" %} + +{% details "Example YAML" %} + +```yaml +triggers: + - trigger: time_pattern + minutes: "/1" +conditions: + - condition: time + after: "08:00:00" + before: "09:00:00" +actions: + - action: homeassistant.update_entity + target: + entity_id: sensor.my_stop_next_departure_1 +``` + +{% enddetails %} + ## Data updates The integration polls data from the Data Grand Lyon API every 5 minutes by default. diff --git a/source/blueprints/integrations/data_grand_lyon_refresh_during_time_window.yaml b/source/blueprints/integrations/data_grand_lyon_refresh_during_time_window.yaml new file mode 100644 index 000000000000..491454fba769 --- /dev/null +++ b/source/blueprints/integrations/data_grand_lyon_refresh_during_time_window.yaml @@ -0,0 +1,60 @@ +blueprint: + name: "Data Grand Lyon: refresh more frequently during a time window" + description: > + Refresh a Data Grand Lyon transit stop's sensors more frequently during a + configurable time window — by default, every minute between 8:00 and 9:00. + + + Useful to get fresher upcoming-departure data before your commute without + raising the polling rate the rest of the day. + + + Tip: refreshing one sensor of a transit stop refreshes every sensor for + that stop, since they share the same data source. You only need to pick + one sensor per stop. + domain: automation + input: + sensor: + name: Sensor to refresh + description: A sensor from a Data Grand Lyon transit stop. + selector: + entity: + filter: + integration: data_grand_lyon + domain: sensor + start_time: + name: Start time + description: When to start refreshing more frequently. + default: "08:00:00" + selector: + time: + end_time: + name: End time + description: When to stop refreshing more frequently. + default: "09:00:00" + selector: + time: + interval_minutes: + name: Refresh interval (minutes) + description: How often to refresh the data, in minutes. + default: 1 + selector: + number: + min: 1 + max: 5 + step: 1 + unit_of_measurement: min + mode: slider +trigger_variables: + interval_minutes: !input interval_minutes +triggers: + - trigger: time_pattern + minutes: "/{{ interval_minutes }}" +conditions: + - condition: time + after: !input start_time + before: !input end_time +actions: + - action: homeassistant.update_entity + target: + entity_id: !input sensor