Fan automation based on temperature

Why not use a simpler trigger?

    trigger:
      - platform:state
        entity_id: sensor.wirelesstag_lounge_temperature
    condition:
      condition: and
      conditions:
        - condition: numeric_state
          entity_id: sensor.wirelesstag_lounge_temperature
          above: 26
        - condition: state
          entity_id: fan.lounge_fan
          state: 'on'
        - condition: state
          entity_id: binary_sensor.people_home
          state: 'on'
    action:
      - service: fan.set_speed
        entity_id: fan.lounge_fan
        data_template:
          speed: >
            {% set temp = trigger.to_state.state | float %}
            {% if temp < 28 %} low
            {% elif temp < 30 %} medium
            {% else %} high
            {% endif %}
1 Like

I see. Any state change would trigger it. That is a simpler solution. Thanks.

Please could anyone help? This is my automations.yaml:

- alias: fan on
  initial_state: 'off'
  trigger:
  - platform: numeric_state
    entity_id: sensor.krb_teplota
    above: '45'
  action:
  - service: switch.turn_on
    entity_id: switch.ventilator
- alias: fan off
  initial_state: 'on'
  trigger:
  - platform: numeric_state
    entity_id: sensor.krb_teplota
    below: '41'
  action:
  - service: switch.turn_off
    entity_id: switch.ventilator

but is not working. I also canĀ“t edit his in HASS gui. Other automations run and IĀ“m able to edit them even via GUI. Any idea?

try removing the quotes from around the numbers in above: and below:

in order to make the automation editable in the ui it needs to have a unique_id included.

it can be anything as long as itā€™s unique and not capitalized.

- id: yghygygulfsrdrtrd765687
  alias:...

Thank you. But this is not the question. What could be wrong with this automation?

Itā€™s turned off

Because you didnā€™t add an id: line - see here

yes it wasā€¦

good catch. Didnā€™t even notice that.

Please how to config automation to let the fan start anytime the temperature is above xx, even if I turn it off manually? Automation start after xx temp is reached. But if I turn fan off if temp is above xx it will stay stopped.

Try this. I think you need to add a condition rather than the initial state

- id: fan_on
  alias: fan on
  trigger:
    - platform: numeric_state
      entity_id: sensor.krb_teplota
      above: 45
  condition:
    - condition: state
      entity_id: switch.ventilator
      state: 'on'
  action:
    - service: switch.turn_on
      entity_id: switch.ventilator
- id: fan_off
  alias: fan off
  trigger:
    - platform: numeric_state
      entity_id: sensor.krb_teplota
      below: 41
  condition:
    - condition: state
      entity_id: switch.ventilator
      state: 'off'
  action:
    - service: switch.turn_off
      entity_id: switch.ventilator

Thank you butā€¦ Donā€™ t you have bad conditions? In ON automation should be off and viceversa?

Yep. Switch them around. See how you go.