I’m trying to make an automation to detect if server CPU is above 85% for 5minutes. If that happens, notify my via telegram bot. The script works if i comment out the FOR part.
This is the error:
ERROR (MainThread) [homeassistant.bootstrap] Invalid config for [automation]: [for] is an invalid option for [automation]. Check: automation->trigger->0->for. (See /home/hass/.homeassistant/automation.yaml:0). Please check the docs at Automation - Home Assistant
The code:
- alias: Server Overloaded
hide_entity: false
trigger:
platform: numeric_state
entity_id: sensor.cpu_use
above: '85'
for:
hours: "0"
minutes: "10"
seconds: "0"
action:
- service: notify.vollarisnotifier
data:
message: Server is overloaded!
Not sure that numeric trigger has time conditions. You can use intermediate Boolean input. Change it’s state to on/off depends on CPU usage and another trigger with state on for X minutes