Hello all!
I am attempting to write a script that turns off a vent fan when the temperature outside exceeds the temperature inside the room OR if the temperature in the room is below 50F. So far it does turn off the vent fan if the room temp drops below 50, but it gives no regard to the outside temperature and that part isnt working properly. Could anyone help explain why that might be?
alias: Auto Off Room Vent
description: ""
trigger:
- platform: numeric_state
entity_id:
- weather.forecast_home
attribute: temperature
above: sensor.0x048727fffeaba821_temperature
- type: temperature
platform: device
device_id: 4a7c462a2189dcf45cfc0a25bdfae2f6
entity_id: 5315141e22312e9078bfb5699cd51767
domain: sensor
below: 50
condition: []
action:
- type: turn_off
device_id: 5ecd9c5a4bc4c25948c24925a5373993
entity_id: 1db996fd9f65630bcd37ae1748a2c7ce
domain: switch
mode: single
Numeric state triggers require a fixed boundary. It can be an input_helper, but it won’t respond to the changes of a sensor you put there. The solution is to use a template trigger and do the comparison in that template.