[ { "id": "Import water usage", "result": { "structured": "TRIGGER: When the time is 08:30:00 daily OR When the state of next water date sensor [sensor.next_water_date] changes. CONDITIONS: The date value stored in next water date sensor [sensor.next_water_date] is more than one day in the past. ACTIONS: Wait for 1 minute. Set a variable 'next_date' to the current state of next water date sensor [sensor.next_water_date]. If current water mains usage sensor [sensor.current_water_mains_usage] is unavailable OR current water mains usage sensor [sensor.current_water_mains_usage] is unknown, then call service pyscript.force_water_state to reset water usage mains sensor [sensor.water_usage_mains] tally to 0. Then, call service pyscript.import_water_usage with the target_date set to the variable 'next_date'.", "natural_language": { "trigger": "The automation runs every day at 8:30 AM, or whenever the next water date sensor [sensor.next_water_date] changes its state.", "conditions": "It only proceeds if the date value reported by the next water date sensor [sensor.next_water_date] is more than one day old.", "action": "After a one-minute delay, the automation stores the current date from the next water date sensor [sensor.next_water_date]. It then checks if the current water mains usage sensor [sensor.current_water_mains_usage] is unavailable or unknown; if so, it resets the water usage mains sensor [sensor.water_usage_mains] tally to zero. Finally, it imports water usage data for the stored target date." }, "human_like": "Imports water usage data from an external service when the scheduled date is overdue, ensuring the system is ready before fetching new data.", "complexity": "medium" } } ]