Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95402

Automation based on the value of a sensor in a given time

$
0
0

@Denny_d wrote:

Hi everyone, these days I have been working on automating cooling fans based on the CPU temperature of the RPI4.
I created this automation which based on a certain temperature that I set with input_text as the minimum and maximum value increases or decreases the fan speed.
This is one of the automations:

  - alias: ventole_bassa_velocita_s1
    trigger:
      platform: state
      entity_id: sensor.cpu_temperature
    condition:
      condition: and
      conditions:  
        - condition: template
          value_template: >
            {{ trigger.to_state.state|float   >= states('input_text.velocita_bassa_sopra_s1')|float and 
               trigger.from_state.state|float <=  states('input_text.velocita_bassa_sotto_s1')|float }}
        - condition: state
          entity_id: input_boolean.attivazione_automazione_s1
          state: 'on'
        - condition: state
          entity_id: input_boolean.bassa_velocita_s1
          state: 'off'
    action:
    - service: light.turn_on
      data:
        entity_id: light.tutte_le_ventole_s1
        brightness: 255
    - delay: 00:00:05
    - service: light.turn_on
      data_template:
        {"brightness": "{{ states('input_number.velocita_bassa_s1')|int }}","entity_id": "light.tutte_le_ventole_s1"}
    - service: input_boolean.turn_on
      entity_id: input_boolean.bassa_velocita_s1
    - service: input_boolean.turn_off
      entity_id:
        - input_boolean.ventole_spente_s1
        - input_boolean.media_velocita_s1
        - input_boolean.alta_velocita_s1

It all works only that by doing tests I realized that many times the CPU temperature exceeds the set parameters for a few seconds and the speed changes very often.

My goal is that if the minimum and maximum CPU temperature

        - condition: template
          value_template: >
            {{ trigger.to_state.state|float   >= states('input_text.velocita_bassa_sopra_s1')|float and 
               trigger.from_state.state|float <=  states('input_text.velocita_bassa_sotto_s1')|float }}

it goes back in those values for 5 minutes then everything starts without being instantaneous.
how can i do it? thanks

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>