Hi,
I’m testing an smtp notification for my Roomba to send out an email when the bin is full.
I’ve configured the automation :
entity : Roomba Bin Full
state trigger
when Roomba Bin Full state changes to “On”
send emaiil
the notification part is working, but the trigger isn’t.
When I don’t put any value of “On”, so it just triggers when it has “a” state change it does trigger.
But I only want it to trigger when it changes to “On”
On, Off, Unavailable are possible values, so that should be OK
- id: '1677757132894'
alias: Roomba Bin Full Notification
description: ''
trigger:
- platform: state
entity_id:
- binary_sensor.roomba_bin_full
to: 'on'
condition: []
action:
- service: notify.email_notification
data:
message: Roomba bin is full
title: Roomba bin is full
mode: single
What’s the current state value of binary_sensor.roomba_bin_full? It can be found in Developer Tools > States.
The automation you posted will trigger when the state of binary_sensor.roomba_bin_full changes to on. In other words, if it’s state is off or unavailable and then changes to on it will trigger the automation.
The YAML example you posted above shows that you already had the correct format on in the State Trigger.
When you select On in the UI, the Automation Editor actually saves it as on in the automation’s YAML.
If you want to test the automation’s trigger, go to Developer Tools > States and select binary_sensor.roomba_bin_full. It should appear in a form at the top the page. Assuming the binary_sensor’s state is currently off, change it to on then click the Set State button. That’s sufficient to trigger the automation’s State Trigger.
thanks!
I already tested it that way, and set the state with the button.
It changes the value correctly, but doesn’t trigger the mail to be sent.
I hope it’ll trigger when it is full, and changes the state itself, but I doubt it.
The strange thing is, that if I don’t put any from / to status, so it just triggers on a changed state, it does send out the email.
But I don’t want to get an email if it goes to unavailable for example
I did an available home assistant update yesterday, and this morning another one was available.
Tested again, and it immediately triggers the event, so working correctly
I did some more testing to be sure, and the issue was indeed the use of the capital O for On.
I used that one in the developer mode, since it showed that way in the dropdown.
So basically when testing, I should always type small characters and no capitals?
As I explained, it doesn’t matter if you select On from the available choices in the UI because the Automation Editor will save it as on in YAML. The proof is visible in what you posted.
If your example contained
to: 'On'
then it would not have triggered.
However it clearly shows it is
Look at what you wrote in your first post. It’s discussing the automation you created, namely the automation you posted containing this line:
to: 'on'
If you tested the automation by using Developer Tools > States to force the value of binary_sensor.roomba_bin_full to On then it will clearly not trigger the automation because it’s listening for on.
And that was, as far as I can tell, the problem. OP was forcing a state change to “On” and not understanding why the automation wasn’t triggering. All sorted now.