Where are you seeing that warning? If in the Template editor tool, that is normal. The variable trigger has no definition in the the Template editor (unless you give it one). In the linked documented configurations it is generated by the actual trigger of the sensor and is only available inside the sensor.
You will need to post the configuration… almost any error in the trigger or state could lead to a state value of ‘unavailable’ that doesn’t update the way you expect it to.
Doh. Thanks. When I was originally getting this set up I had wondered if that was the case, but didn’t see ‘Templates’ anywhere in my configuration file. It’s working now. Thanks a million for your help.
I want to drop in and shout out my thanks. I was able to use this entire thread to get it to work. I’m sure I’ll figure out a way to display some sort of color change or icon change based on the state, but I’m in exactly the same boat dealing with Cox Home Security trying to alter home behavior based on that and I was able to get it to work. My only major issue was the fact I had to use gmail instead. I had an old yahoo account I was initially trying to use but the imap integration just wasn’t working the same way for some reason.
By the way, what helped, following your discussion of how the event worked, was using the event listener listening for the imap_content event to see what data it pulled.
your imap integration setup screen isn’t what I see though. Maybe its because I’m using a docker container installation? All I see is folder and search options.
The post marked as Solution has a lot of “moving parts”. So the first thing to do is to make sure you have all the parts in place:
Alarm Folder in Gmail
Filters to move the desired emails to the folder
3 IMAP integration sensors each with a specific search criteria:
UnDeleted X-GM-RAW “disarm”
UnDeleted X-GM-RAW “arm -disarm -part”
UnDeleted X-GM-RAW “arm part -disarm”
If all of that is in order, the next step is to check that the events are being created. You can monitor events using the Events tool. Start the listener for the imap_content event…
I don’t think that you need to do that… you should be able to extract the data using templates.
We can probably advise you on the best approach if you provide a few examples of the emails’ body text, explain what information you are trying to extract, and how you want it handled. It could be added as either an attribute or a separate sensor.
For ease of comparison in the History tool, I think it would be best to set it as a separate sensor instead of an attribute. There are many ways to search the email’s text for the names, the simplest way is listing the names (separated only by the | symbol) in a regex_findall() filter as follows:
There is a limit of the size of the event, so it’s best to not include the message headers if you don’t need them.
You’re going to need to look at the actual value held by the text variable. You can get it directly by using the Events tool or add a sensor to your configuration that gets the value.
- name: Security Email Body Text
state: "{{ trigger.event.data['text'] }}"
Once you get the value you can use the Template editor tool to figure out if the template works.
hi, i have test now (holiday)
the problem is email text. (allarm send a text but on HA i can’t filtrer)
i resolve with a single trigger inserimento e disinserimento for each person.
when person start allarm or stop allarm arrive a email on gmail . gmail filtred the email and HA control singol different folder on gmail.
i need help fo 2 problems:
1 - the email counter check email but i need to now how and when is the last email
2 - there is a way for see on HA entire email Object?
There is also an action imap.fetch which can be used to get the text, subject, sender contents of a message. However you must have extracted the uid from the event in order to use the action.