I’m still struggling with my first automation.
I’ve been trying to get the following automation working for a couple of weeks now. The actions work fine but I cant get the trigger and timing to work correctly. I’m building this using the UI and not yaml. I’d apricate help if possible so I can both get this working and learn how to approach this type of situation.
I’m trying to auto shut off and then back on a plug in fan. When the fan is plugged in, and in its standby mode, it pulls less than .4 amps. When the fan is running it pulls over .4 amps. When the fan is unplugged and plugged back in it reverts to its standby mode.
I have it plugged into a zwave plug that measure power values.
What I want to happen is if the fan is pulling .4 amps or more for 60 mins then. If the amps drop below .4 before that 60 mins then just watch for the next situation but don’t trigger the actions. If the 60 min limit is hit then Turn the power off on the fan, Wait 15 seconds, then turn the power back on. For testing purposes I have the timing set to 2 minutes right now.
Sounds simple but I’m pulling my hair out trying to get this to work.
alias: Bathroom master fan/heater auto off
description: ""
triggers:
- trigger: state
entity_id:
- binary_sensor.bathroom_master_heater_amp_threshold
attribute: upper
from: ".399"
for:
hours: 0
minutes: 2
seconds: 0
conditions: []
actions:
- action: switch.turn_off
target:
entity_id: switch.mini_plug_with_power_meter_testing1_2
data: {}
alias: "Perform Action: turn master bathroom fan/heater off"
- delay:
hours: 0
minutes: 0
seconds: 15
- action: switch.turn_on
target:
entity_id: switch.mini_plug_with_power_meter_testing1_2
data: {}
alias: "Perform Acation: turn master bathroom fan/heater on"
- action: notify.clairhomeautomation_gmail_com
metadata: {}
data:
message: The clearmaster bathroom heater/fan was automatically turned off
target: [email protected]
title: It was left on beyond its allowed run time
mode: single