Im trying to run an automation based on a value of energy being below a certain negative value.
What I want to do is whenever energy above -1KW (for clarification anything larger than -1kw means -1,1, -2, etc) run a notification, but the trigger doesnt seem to ever run.
In the future please post properly formatted code instead of images.
The trigger will not fire unless the referenced entity crosses the threshold you’ve specified. Has it done that?
If you created the automation while the value was already below -1, the automation won’t fire until the value raises above -1 and then crosses below -1.
Gosh it took a long time to work out what you are doing here!
You are setting this up in the UI.
Your trigger is probably OK. You even say that it is recording the last time that it ran, so I guess the trigger works.
So if we go with ‘below’ and ‘-3’ is indeed below ‘-1’
So the issue is possibly with the action.
Normally we use entities, and service calls to turn plugs and switches on. You appear to have gone for the ‘device’ option, which is messier and must not be manually edited as this can break it.
Two actions on the same switch (smart plug) in UI (taken from edit YAML mode)
alias: New Automation
description: Test
trigger:
- platform: numeric_state
entity_id:
- sensor.octopus_agile_prices
attribute: import_next
below: 10
condition: []
action:
- type: turn_on
device_id: b4efebd27f11f68763c1ed300c6e5826
entity_id: a871bcb8e2446b0c77b8cba580ce4aa3
domain: switch
mode: single
as a device - turn on, and now as a switch:turn on an entity