Turn aircon on if above 28deg when not home, mon-fri between 8am-6pm turn off if less than 24.5deg

Hi,

I want to automate turning on and off aircon based on the following logic, need help to do this the right way:

  1. When not home

  2. Temp above 28 deg

  3. Mon-Fri

  4. Between 11am - 6pm

  5. Turn off aircon when temp drops below 24.5deg (intervals are updated every 5 seconds)

  6. Turn off aircon above 6pm even if temp is above 28 deg

     automation:
         - alias: 'Aircon Trigger above 28deg'
             trigger:
               - platform: state  
                 entity_id: device_tracker.mobile
                 to: 'not_home' 
               - platform: numeric_state  
                 entity_id: sensor.a1_sensor_temperature
                 above: 28
               - platform: time
                 after: '08:00:00'
             condition:
               - condition: time
                   weekday:
                     - mon
                     - tues
                     - wed
                     - thur
                     - fri
               - condition: time
                   after: '08:00:00'
                   before: '18:00:00'
               - condition: numeric_state
                   entity_id: sensor.a1_sensor_temperature
                   above: 28
             action:
               - service: broadlink.send_packet_192_168_1_102
                 data:
                   packet:
                     - "oncode" 
         - alias: 'Aircon Trigger below 24.5deg'
                     trigger:
                       - platform: state  
                         entity_id: device_tracker.mobile
                         to: 'not_home' 
                       - platform: numeric_state  
                         entity_id: sensor.a1_sensor_temperature
                         below: 24.5
                       - platform: time
                         after: '11:00:00'
                     condition:
                       - condition: time
                           weekday:
                             - mon
                             - tues
                             - wed
                             - thur
                             - fri
                       - condition: time
                           after: '11:00:00'
                           before: '18:00:00'
                       - condition: numeric_state
                           entity_id: sensor.a1_sensor_temperature
                           below: 24.5
                     action:
                       - service: broadlink.send_packet_192_168_1_102
                         data:
                           packet:
                             - "offcode"`

I would set a single trigger, time, and set the other parameters as conditions.

Hi…interesting are you sure that would work, how would you code it up?

Something like this…

  • alias: ‘Aircon Trigger above 28deg’
    trigger:
    platform: time
    at: ‘11:00:00’
    condition:
    condition: and
    conditions:
    - condition: time
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
    - condition: time
    before: ‘18:00:00’
    - condition: state
    entity_id: ‘group.people’
    state: ‘away’
    - condition: numeric_state
    entity_id: sensor.a1_sensor_temperature
    above: ‘28’
    action:
    service: homeassistant.turn_on
    entity_id: switch.ac_cool

Hi,

Sorry I did not get back to you heaps going on keeping me distracted.

Thanks I will try this code, I have not checked the syntax section for conditions but the nested conditions looks well confusing any way of commenting each condition block as I cannot follow it

Cheers