Aircon IR control

I have a dumb AC, controlled by IR. I have zigbee temp sensors. I used to do this in tuya, now trying to do this in HA.

script.aircon_power calls tuya IR, toggles power button.

alias: Aircon Off
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.main_bedroom_temperature
    attribute: temperature
    below: 21.4
condition:
  - condition: numeric_state
    entity_id: sensor.sa_consumption_power
    above: 5000
action:
  - service: script.aircon_power
    data: {}
mode: single

1)
Since my ac is dumb, I can only guess it’s on via home power use. I have sa_consumption_power, and AC uses 6-8kW. W/o AC even with microwave/oven I can only use 4kW.

Somehow it’s not working.

Trace says power < 5kW. Maybe the compressor was off?

But I don’t know what to do. If I take the condition off, then the AC gets toggled each time temp changes, and it may be Turning it on instead of off.

If this actually works, I’d want another automation, so we turn it on/off when it hits top/base temp in the room. I once tried a naive version of this in tuya, and it went crazy - lost track of state and would keep toggling all night.

2)
I have a zigbee button linked via automation to this script.aircon_power. For some reason it never works the 1st time.
It’s almost like it needs to warm up, then it will work. Once warm, eg if I press it 15min later, it works 1st time.