Automating Ceiling Fan Speed from Ecobee Sensor

I can’t afford one of those Haiku fans, so I have an Ecobee sensor just under my lights for temperature sensing in the tallest part of my house. This reports to the Ecobee and I want to take that value and compare it to the temperature of the temperature on the Ecobee. These values would then set the speeds high, medium, or low. What I don’t know is if this should be created with a template or not? I’m not familiar enough with templates to feel comfortable, I sort of understand what they are doing at each step but I still feel lost.

There is a field in the states of Ecobee, current_temperature: 66 and then I can retrieve the numerical state value from the sensor, but I’m not sure how I would do a comparison for more than, equal to, and less than.

Can anybody confirm if I will need to use a template and if so, can you guide me on how to set that up?

Thank you,
Paul

post the ecobee entity that you will be using to retrieve the temperature with. Is the "current_temperature in the “state” column or is it one of the attributes? I’m assuming it’s the latter.

But generally the value will be (if it’s an attribute):

value_template: >
  {% if state_attr('sensor.ecobee', 'current_temperature') | float < 5 %}
    do something
  {% elif  state_attr('sensor.ecobee', 'current_temperature') | float = 5 %}
    do something else 
  {% elif  5 < state_attr('sensor.ecobee', 'current_temperature') | float < 20 %}
    do some third thing
  {% else %}
    do the default thing
  {% endif %}

you can also use != to check if value1 is not equal to value2.

and if you don’t want to use ‘float’ you can use ‘int’ instead.

You can use any logical combination of the above as long as your ‘if’ statement ends with ‘endif’. And you don’t even technically need to use ‘else’ but if the if or elif statements don’t return true then you will get an error in your log for invalid data.

I wasn’t able to work on this for a little bit, but I’m now able to spend time on this again. My programming understanding is a lot more rusty than I thought. I don’t remember float or integers. Anyway, I created this in the template editor and it shows the values I was expecting, but this isn’t working. Should I be using IF statements? Thank you

- id: '1578617233616'
  alias: New Automation
  description: 'If the lower level temperatures are higher than the ceiling, set the fan to low.'
  trigger:
  - platform: template
    value_template: 'value_template: {{(states.sensor.home_temperature.state|float
      + states.sensor.living_room_temperature.state|float)/2 > states.sensor.vaulted_temperature.state|float}}'
  condition: []
  action:
  - data:
      group: 31
    service: insteon.scene_on
- id: '1578624924296'
  alias: 'New Automation 2'
  description: 'If the ceiling temperature is higher than the lower temperatures, set the fan to high.'
  trigger:
  - platform: template
    value_template: 'value_template: {{states.sensor.vaulted_temperature.state|float
      > (states.sensor.home_temperature.state|float + states.sensor.living_room_temperature.state|float)/2}}'
  condition: []
  action:
  - data:
      group: 32
    service: insteon.scene_on