Mode restart or queued or something else?

Hi all
I need to make an automation for my air condition. What I want to achieve is to make it “run” for 3 minutes the stop for 3 minutes and to continue this cycle until I turn it off.

will this automation work?

below when I set the temperature to 30 it actually stops, and when I set the temperature to 25 it is turning on.

- id: Bedroom AC 
  alias: Bedroom AC 
  description: ''
  mode: queued
  trigger:
   - platform: numeric_state
     entity_id: sensor.shelly1pm_98cdac300d6d_power
     for:
       hours: 0
       minutes: 3
       seconds: 0
     above: '100'
     
  condition: []
  action:
    - service: climate.set_hvac_mode
      data:
        hvac_mode: cool
      target:
        entity_id: climate.bedroom_ac
    - service: climate.set_temperature
      data:
        temperature: 30
      target:
        entity_id: climate.bedroom_ac
    - service: climate.set_fan_mode
      data:
        fan_mode: low
      target:
        entity_id: climate.bedroom_ac
    - delay:
        hours: 0
        minutes: 3
        seconds: 00
        milliseconds: 0
    - service: climate.set_hvac_mode
      data:
        hvac_mode: cool
      target:
        entity_id: climate.bedroom_ac
    - service: climate.set_temperature
      data:
        temperature: 25
      target:
        entity_id: climate.bedroom_ac
    - service: climate.set_fan_mode
      data:
        fan_mode: mid
      target:
        entity_id: climate.bedroom_ac
    
  max: 10000

If you just want the AC turn on and off forever you can use some form of a “repeat:” in the actions.

But I’m not sure how you are doing this part:

The trigger doesn’t seem to have any switch to trigger it. It just uses the power of a device. I’m assuming that’s the device that controls the AC power?

Is that what you mean? i.e. you will turn on the outlet then you want the automation to run forever until you turn off the power device (the shelly)?

you could use the “repeat-until” form of the repeat and use the shelly power going below a value as the “until” part of the automaton.

But be aware that if you reload automations while the automation is running it will stop and never start again until the trigger is met again (below 100 to above 100).

that’s not a problem. I will turn it off manual.

That’s right.

Yes, I would prefer the repeat until or while but I can not think any reasonable argument. I was testing something with the room temperature but aqara sensors are not that fast.

You are right. This is a problem if I reload the automations or restart while the temperature is set to 30 because the AC will turn on (by it’s program) at 30.1

I am testing it right now with mode: queued and it is working. The most annoying thing right now although is that I hear 3-4 bib sounds from the unit in every change of the temperature. :frowning:

The problem with the AC unit is that when I set it to 27 cool it will work until it gets to 25. Then it stops until it will reach 27.1 where it starts it’s cycle again. With this automation I hope to get more stable temperature in the room.
It seems that it could work. The main problem is the noise I hear every time the broadlink sends the signals to the unit. I am waiting the wife complains from minute to minute :slight_smile:

Hi,
I think this can do the job:

alias: Bedroom AC
description: ''
mode: ''
trigger:
  - platform: time_pattern
    minutes: /6
condition:
  - condition: numeric_state
    entity_id: YOUR TEMPERATURE SENSOR HERE
    above: '25'
    value_template: '{{ float(state.state) }}'
  - condition: numeric_state
    entity_id: sensor.temperatura_bano
    below: '30'
    value_template: '{{ float(state.state) }}'
action:
  - service: climate.turn_on
    data: {}
    target:
      entity_id: climate.bedroom_ac
  - delay:
      hours: 0
      minutes: 3
      seconds: 0
      milliseconds: 0
  - service: climate.turn_off
    data: {}
    target:
      entity_id: climate.bedroom_ac

While automation is enabled, it will run every 6 minutes (/6) , will check temperature and if it is between thresholds (25 and 30) will turn on the AC. It will wait 3 minutes and then it will turn it off.

If you don’t have a termometer and want to turn it on and off manually, just remove the condition and enable and disable the automation when you want it on or off.

I hope this helps.

BTW: Are you sure that turning on and off the AC so frequently won’t harm it?

Thanks for the code.
As I explained above I can not use my aqara temperatures because they are not responding as fast as I need. That’s why I choose the option of time.

That’s why in my code I am changing its temperature to “force” it to turn on and off.
In a way it is working like this so I hope that this isn’t a problem

Just a word of caution: You should read up on short cycling air conditioners. A Google search will yield lots of results.

Yes, I know about it.