Daikin Aircondition doesn't restore scene

Hi all. I’m trying to create an automation to automatically turn my airconditioning down low when not at home then restore it to its previous state when I return. The two automations look like this:

Turn aircon down

alias: "Aircon: Turn down when away"
description: ""
trigger:
  - platform: state
    entity_id:
      - group.people
    to: not_home
    for:
      hours: 0
      minutes: 30
      seconds: 0
condition:
  - condition: state
    entity_id: input_boolean.guests_over
    state: "off"
  - condition: not
    conditions:
      - condition: device
        device_id: 4ac4d062aef87be3fbfe4e681ec360d1
        domain: climate
        entity_id: climate.daikin_ducted_ac
        type: is_hvac_mode
        hvac_mode: "off"
  - condition: state
    entity_id: input_boolean.did_ac_automation_run
    state: "off"
action:
  - service: notify.mobile_app_primary_iphone
    data:
      title: Aircon automation ran
      message: >-
        Old aircon temperature {{ state_attr("climate.daikin_ducted_ac",
        "temperature") }}
  - service: scene.create
    data:
      scene_id: auto_save_ac_state
      snapshot_entities: climate.daikin_ducted_ac
    enabled: true
  - service: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.did_ac_automation_run
    enabled: true
  - choose:
      - conditions:
          - condition: device
            device_id: 4ac4d062aef87be3fbfe4e681ec360d1
            domain: climate
            entity_id: climate.daikin_ducted_ac
            type: is_hvac_mode
            hvac_mode: heat
        sequence:
          - service: climate.set_temperature
            data:
              temperature: 16
            target:
              device_id: 4ac4d062aef87be3fbfe4e681ec360d1
      - conditions:
          - condition: device
            device_id: 4ac4d062aef87be3fbfe4e681ec360d1
            domain: climate
            entity_id: climate.daikin_ducted_ac
            type: is_hvac_mode
            hvac_mode: cool
        sequence:
          - service: climate.set_temperature
            data:
              temperature: 20
            target:
              device_id: 4ac4d062aef87be3fbfe4e681ec360d1
    enabled: true
mode: single

Turn aircon back up:

alias: "Aircon: Restore mode on return"
description: ""
trigger:
  - platform: state
    entity_id:
      - group.people
    to: home
condition:
  - condition: state
    entity_id: input_boolean.guests_over
    state: "off"
  - condition: state
    entity_id: input_boolean.did_ac_automation_run
    state: "on"
action:
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.did_ac_automation_run
  - service: scene.turn_on
    target:
      entity_id: scene.auto_save_ac_state
    metadata: {}
mode: single

For some reason the second automation (the one that restores the previous settings) is incredibly inconsistant and doesn’t seem to work majority of the time. The automation runs but either the scene didn’t accurately capture the previous settings or it doesn’t apply. This results in the temperature staying at the lowered setting which is okay but I’d prefer it to restore it.

I originally had the scene creation step set to this instead but it still didn’t work:

  - service: scene.create
    data:
      scene_id: auto_save_ac_state
      snapshot_entities: 
        - climate.daikin_ducted_ac

Changing it to just climate.daikin_ducted_ac did seem to work once but its now broken again.

I’ve also tried manually applying the scene myself and that doesn’t do anything either, its like the scene was captured at the lower temperature or without any entities at all.

Any idea what I’m doing wrong?

The Daikin unit is a ducted system using the Daikin AC addon/integration and I’m running Home Assistant 2023.5.4 using the Operating System install (10.2 I think?).

Thanks in advance for any help!

I managed to fix this by adding a sleep/pause step between the scene snapshot/create and the step that changes the temperature.

It ended up looking like this:

alias: "Aircon: Turn down when away"
description: ""
trigger:
  - platform: state
    entity_id:
      - group.people
    to: not_home
    for:
      hours: 0
      minutes: 30
      seconds: 0
condition:
  - condition: state
    entity_id: input_boolean.guests_over
    state: "off"
  - condition: not
    conditions:
      - condition: device
        device_id: 4ac4d062aef87be3fbfe4e681ec360d1
        domain: climate
        entity_id: climate.daikin_ducted_ac
        type: is_hvac_mode
        hvac_mode: "off"
  - condition: state
    entity_id: input_boolean.did_ac_automation_run
    state: "off"
action:
  - service: notify.mobile_app_primary_iphone
    data:
      title: Aircon automation ran
      message: >-
        Old aircon temperature {{ state_attr("climate.daikin_ducted_ac",
        "temperature") }}
  - service: scene.create
    data:
      scene_id: auto_save_ac_state
      snapshot_entities: climate.daikin_ducted_ac
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - service: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.did_ac_automation_run
    enabled: true
  - choose:
      - conditions:
          - condition: device
            device_id: 4ac4d062aef87be3fbfe4e681ec360d1
            domain: climate
            entity_id: climate.daikin_ducted_ac
            type: is_hvac_mode
            hvac_mode: heat
        sequence:
          - service: climate.set_temperature
            data:
              temperature: 16
            target:
              device_id: 4ac4d062aef87be3fbfe4e681ec360d1
      - conditions:
          - condition: device
            device_id: 4ac4d062aef87be3fbfe4e681ec360d1
            domain: climate
            entity_id: climate.daikin_ducted_ac
            type: is_hvac_mode
            hvac_mode: cool
        sequence:
          - service: climate.set_temperature
            data:
              temperature: 20
            target:
              device_id: 4ac4d062aef87be3fbfe4e681ec360d1
    enabled: true
mode: single