Hi all - brand new HA user, running version 0.52.0., and really liking it!
I’ve created the following rule:
- id: brewing_temperature
alias: "Brewing temperature"
trigger:
- platform: numeric_state
entity_id: sensor.outside_temp
above: 18
below: 15
action:
- service: notify.notify_tweet
data:
message: "Sensor value outside limits. Currently {{ states.sensor.outside_temp.state }} C"
Whilst I know the individual pieces work (sensors are reporting back, notify_tweet works etc) I cannot seem to get the result I’m looking for, that is, send me a tweet when the temp is outside the range of 15 to 18 degC (I tried with using an email notification, again, no joy).
The rule is in the automation.yaml file and there are no errors reported with the config.
I have looked at other examples, scanned this forum, but cannot work out what I’m missing.
Appreciate any guidance. Hopefully once you point out the error of my understanding I’ll be good to go!
–
Regards,
Roland
My temperature conditions and triggers wouldn’t work until I turned them into integers… Here’s a sample of what I did:
- alias: 'Window fan on'
initial_state: true
trigger:
platform: template
value_template: '{{ states.sensor.yr_temperature.state < states.sensor.living_room_temp.state }}'
condition:
condition: template
value_template: '{{ states.sensor.living_room_temp.state | int >= 20 }}'
action:
service: switch.turn_on
entity_id: switch.switch0
- alias: 'Window fan off'
initial_state: true
trigger:
- platform: template
value_template: '{{ states.sensor.yr_temperature.state > states.sensor.living_room_temp.state }}'
- platform: template
value_template: '{{ states.sensor.living_room_temp.state | int < 20 }}'
action:
service: switch.turn_off
entity_id: switch.switch0
Perhaps, you can do something similar.
2 Likes
sjee
August 28, 2017, 10:54pm
3
I’m not sure but I think the temperature range can not be specified like this. In the docs it says:
If both below and above are specified, both tests have to pass.
Thanks.
The example I was mimicking had (in part):
above: 17
below: 25
And a comment of:
Listing above and below together means the numeric_state has to be between the two values. In the example above, a numeric_state that is 17.1-24.9 would fire this trigger.
Hence my rule, with exception I’m wanting only alerts when the temperature was outside my values.
Appreciate your input. Maybe between @GervaisdeM post and your’s I’ll have an answer…have to wait until after work to try!
Personally I would make a template sensor, and trigger off of that, something like:
- platform: template
sensors:
brew_temp:
value_template:
'{% if states.sensor.outside_temp.state | int < 15 or states.sensor.outside_temp.state | int > 18 %}
Alert
{% else %}
Normal
{% endif %}'
friendly_name: 'Brew Temp'
And then build the automation off of that:
- id: brewing_temperature
alias: "Brewing temperature"
trigger:
- platform: state
entity_id: sensor.brew_temp
to: 'Alert'
action:
- service: notify.notify_tweet
data:
message: "Sensor value outside limits. Currently {{ states.sensor.outside_temp.state }} C"
1 Like
Thank you @azeroth12 and @GervaisdeM . Your templating approach is a sucess.
May I say as a new user to HA, your quick and accurate advice is greatly appreciated.
One step closer to automating my home-brew
–
Roland
Now if only we could share beer as quick as we can automation ideas!
1 Like
bdogs
August 29, 2017, 2:42pm
8
Here’s the config I use:
- alias: Room Temp Alert
trigger:
- platform: numeric_state
entity_id: sensor.oroom
above: 85
- platform: numeric_state
entity_id: sensor.oroom
below: 60
action:
- service: notify.gsms
data:
message: Room temp out of range.
lambtho
(Lambtho)
August 29, 2017, 3:08pm
9
you could even go further and customize the message it sends with templates. Like this:
action:
- service: notify.gsms
data:
message: >
{% if sensor.oroom | int > 85 %}
Room temp too high
{% else %}
Room temp too low
{% endif %}
or you coul also just add the temp to your previous action with
action:
- service: notify.gsms
data:
message: Room temp out of range. Temp is currently {states.sensor.oroom.state} .