Hi,
I just use Home Assistant for two days in our company and I’m desperate about the imap sensor.
I used it like that in my configurationsfile:
sensor:
- platform: imap
server: owa.xxxxxxxxxxx.de
port: 933
name: emails
username: [email protected]
password: xxxxxxxxxx
I think, that sensor is correct. But I do not get the correct answer for unseen mails.
Is there something I’m doing wrong?
Are you sure port 933 is correct? The default for IMAP is 993.
You can test your IMAP access with curl
:
curl -u username imaps://mail.server.tld:993 -X 'STATUS INBOX (UNSEEN)'
# it will prompt you for a password
i was blind - yes, port 993.
if i use your code i get a “1”. but in dev-ops i’ve got a “0”. i hanged the port there.
do i miss something else?
to check the stte i use:
"{{ states('sensor.emails') | int }}"
so, now have an sensor wich works. in dev-tools i’ve got a reslut - true and false.
i get these for an automation: Automation IMAP Trigger
i tried to get the template with my sensor name. but my automation has no function:
alias: Lichtspiele
description: ''
trigger:
- platform: template
value_template: "{{ state('sensor.check_unread_emails') | int > 0 }}"
condition: []
action:
- type: toggle
device_id: xxxxxxxxxxxxxxx
entity_id: light.philipps_birne
domain: light
mode: single
what is my misstake?
You’re missing an “s” at the end of state
. It is either states.sensor.check_unread_emails.state
or states('sensor.check_unread_emails')
.
EDIT: here is a link to the documentation
hi @paddy0174,
thank you. i tried so many times, that i do not seen the missing “s”. now it works!
thank you!
1 Like