Hi,
I’m trying to setup an IMAP event trigger. When a new email from a specific recipient with a number X in the body comes in, activate my water heater for X minutes. The email body has only the number in it.
I setup the following in configuration.yaml:
sensor:
- platform: imap_email_content
server: imap.gmail.com
port: 993
name: "email"
username: XXX
password: xxx
senders:
- XXX@gmail.com
template:
- sensor:
- name: "Water Heater Manual Time"
unit_of_measurement: "min"
state: >
{% set heater_time = state_attr('sensor.email','body') | int %}
{{ heater_time }}
I see the email come in:
from: XXX@gmail.com
subject: Water Heater On
date: Mon, 7 Mar 2022 01:08:54 -0800
body: 4
and I successfully see the sensor state update with the correct values for each email being received./
When I setup my automation though, I can’t seem to be able to get the event to trigger when a number X larger than 0 comes in. the event never gets triggered - even though under developer tools I can see the value for sensor.water_heater_manual_time gets updated correctly. This is my automation:
alias: Set water heater on - email time
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.water_heater_manual_time
above: '0'
condition: []
action:
- type: turn_on
device_id: XXX (I deleted this for this post)
entity_id: switch.water_heater
domain: switch
- delay: >-
{{ '00:{:02}:00'.format(states('sensor.water_heater_manual_time') | int)
}}
- type: turn_off
device_id: XXX (I deleted this for this post)
entity_id: switch.water_heater
domain: switch
mode: single
Any help or thoughts would be much appreciated!
1 post - 1 participant