Is not firing. What is wrong? If I trigger the automation manually is notifying correctly. If I open the window (the binary_sensor works; and the power value is 600 so is above 10) the notification is not coming …
- alias: Attenzione A/C Gilma ON con finestra aperta
initial_state: 'on'
trigger:
platform: numeric_state
entity_id: sensor.neo_coolcam_power_plug_12a_power
above: '10'
condition:
condition: or
conditions:
- condition: state
entity_id: binary_sensor.door_window_sensor_158d0001a3e8f1
state: 'on'
- condition: state
entity_id: binary_sensor.door_window_sensor_158d0001106bd2
state: 'on'
action:
- service: notify.claudio_pushbullet
data_template:
message: 'Attenzione A/C Gilma ON con finestra aperta'
- service: notify.claudio_zanzito
data_template:
message: 'Attenzione A/C Gilma ON con finestra aperta'
The automation is only triggered when sensor.neo_coolcam_power_plug_12a_power goes to above 10, from 10 or less. Only at that point are the conditions for the windows checked. As a result, this automation will notify you that your windows are open, when your AC comes on.
You’ll want another automation with the windows being opened as the triggers, and sensor.neo_coolcam_power_plug_12a_power being above 10 as the condition. Something like this
- alias: Attenzione A/C Gilma ON con finestra aperta 2
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.door_window_sensor_158d0001a3e8f1
to: 'on'
- platform: state
entity_id: binary_sensor.door_window_sensor_158d0001106bd2
to: 'on'
condition:
condition: numeric_state
entity_id: sensor.neo_coolcam_power_plug_12a_power
above: '10'
action:
- service: notify.claudio_pushbullet
data_template:
message: 'Attenzione A/C Gilma ON con finestra aperta'
- service: notify.claudio_zanzito
data_template:
message: 'Attenzione A/C Gilma ON con finestra aperta'
I think initial_state: should be True or False not ‘on’ however it maybe interchangeable I’m not sure however the docs don’t mention ‘on’. I think Tinkerer is correct it won’t trigger unless it transitions from 10 to 11, so if it’s at 600 it can’t trigger.
But in you automation if the window is ALREADY open (ON), and I turn ON the A/C will I get the notification?
So basically it should trigger
a) when the A/C is ON (power consumption high above 10) and somebody open the windows EDIT THIS WORKS IN TINKERER EXAMPLE
b) when the window is ON and somebody turns ON the A/C (power goes from 0 to above 10) EDIT THIS IS NOT WORKING (NEITHER IN MINE NOR IN TINKERER AUTOMATION)
The most common problem I see when automation’s don’t fire is type conversion problems.
This is problematic, because states don’t report what their type is, but automations are heavily dependent upon type.
For example, if sensor.neo_coolcam_power_plug_12a_power doesn’t report it’s state as an numeric type, then the numeric_state trigger will never fire. Even if you look at the state in the inspector, and see something like 10 as the value, that doesn’t guarantee that it’s a number, and the numeric_state trigger doesn’t do any type conversion.
If the result in the template editor is blank, that means you have a type conversion problem.
If the result is true or false in the template editor, then there is some other problem.
If sensor.neo_coolcam_power_plug_12a_power isn’t a numeric type, then you need to convert your trigger to a template trigger and trigger on something like this:
The one you wrote should cover (b), if it isn’t you need to look at whether it’s not triggering, or whether the conditions aren’t matching. One test would be to remove the conditions and try again. If that still doesn’t trigger a notification, then the problem is with the trigger.